cli
Command line entry point (google-scholar-mcp): serve, setup and
install-skill.
Command line entry point: run the server, configure clients, install the skill.
google-scholar-mcp with no arguments still starts the stdio server, so MCP
client configs written before these subcommands existed keep working.
- google_scholar_search_mcp.cli.setup(args)[source]
Register the server with detected MCP clients and install the skill.
- Parameters:
args (argparse.Namespace) – Parsed
setupoptions (no_claude_desktop,no_claude_code,no_skill,force,target).- Returns:
int – Exit code,
0if something was configured,1if not.- Return type:
- google_scholar_search_mcp.cli.main(argv=None)[source]
Run the
google-scholar-mcpcommand.Without a subcommand (or with
serve) the stdio MCP server starts.- Parameters:
argv (list[str] | None) – Arguments;
Nonemeanssys.argv[1:].- Returns:
None –
setupandinstall-skillend the process viaSystemExit;serveblocks until the client disconnects.- Raises:
SystemExit – With the command’s exit code, or
2on invalid arguments.- Return type:
None
clients
Registering the server with MCP clients (Claude Desktop/Code, Cursor, …).
- google_scholar_search_mcp.cli.clients.find_executable()[source]
Locate the installed
google-scholar-mcpcommand.- Returns:
str – Absolute path if found on
PATHor viasys.argv[0], otherwise the bare command name.- Return type:
- google_scholar_search_mcp.cli.clients.claude_desktop_configs()[source]
Find Claude Desktop config files for the current platform.
- google_scholar_search_mcp.cli.clients.update_json_client(config_path, command, label)[source]
Add or replace our entry under
mcpServersin a JSON config file.Used for every client that stores MCP servers as JSON (Claude Desktop, Cursor, Windsurf, Gemini CLI). Other servers and keys are preserved; an existing
envof our entry is kept.- Parameters:
- Returns:
bool –
Trueif written,Falseif the file holds invalid JSON (it is left untouched).- Raises:
OSError – If the file cannot be read or written.
- Return type:
- google_scholar_search_mcp.cli.clients.update_claude_desktop(config_path, command)[source]
Register the server in a Claude Desktop config file.
- google_scholar_search_mcp.cli.clients.other_json_clients()[source]
List JSON-configured MCP clients besides Claude Desktop.
- google_scholar_search_mcp.cli.clients.existing_claude_code_entry()[source]
Read our user-scope Claude Code entry from
~/.claude.json.- Returns:
dict – The entry (
command,args,env, …), or{}if the file or entry is missing or unreadable.- Return type:
- google_scholar_search_mcp.cli.clients.existing_claude_code_env()[source]
Read the env vars of our user-scope Claude Code entry.
- google_scholar_search_mcp.cli.clients.update_claude_code(command)[source]
Register the server with Claude Code (user scope) if the CLI is present.
An existing entry is replaced, but its env vars (proxy, delays, …) are carried over so re-running
setupnever drops the user’s settings. If the new registration fails, the previous entry is restored.
targets
Per-agent skill destinations (Claude, Cursor, Windsurf, AGENTS.md, Gemini).
Write the full skill to
.agents/skillsfor pointer blocks to refer to.
- google_scholar_search_mcp.cli.targets.pointer_block(skill_path, root, description)[source]
Build the short marked block that points an agent at the skill file.
- Parameters:
skill_path (Path) – Location of the full skill; must be inside
root.root (Path) – Project directory the path is made relative to.
description (str) – One-line skill description shown in the block.
- Returns:
str – Markdown block including the
BEGIN/ENDmarkers.- Raises:
ValueError – If
skill_pathis not insideroot.- Return type:
- google_scholar_search_mcp.cli.targets.detect_targets(root)[source]
List the agents that appear to be used in a project.
- google_scholar_search_mcp.cli.targets.install_skill(targets=None, root=None, force=False)[source]
Install the skill into several agents.
Never overwrites a differing file unless
forceis set. Per-target write errors are printed and reported as"error"instead of raised.- Parameters:
- Returns:
list[tuple[str, str, Path | None]] –
(target, status, path)per target, status beinginstalled,current,skippedorerror(path isNoneon error).- Raises:
KeyError – If a name in
targetsis not inTARGETS.- Return type:
skill
Fetching the skill and writing it without clobbering user files.
- google_scholar_search_mcp.cli.skill.bundled_skill()[source]
Read the SKILL.md shipped inside the package.
- Returns:
str – Full text of the bundled SKILL.md.
- Raises:
FileNotFoundError – If the package was built without the skill file.
- Return type:
- google_scholar_search_mcp.cli.skill.fetch_skill(url, timeout=10.0)[source]
Download the skill, falling back to the bundled copy.
Any failure (network, TLS, 404, non-https URL, content that does not look like a SKILL.md) is reported on stdout and never raised.
- google_scholar_search_mcp.cli.skill.split_skill(content)[source]
Split a SKILL.md into its description and body.
- google_scholar_search_mcp.cli.skill.write_file(dst, text, force)[source]
Write a file without clobbering differing content.
- Parameters:
- Returns:
str –
"installed"if written,"current"if the file already has this content,"skipped"if it differs andforceis false.- Raises:
OSError – If the file cannot be read or written.
- Return type:
- google_scholar_search_mcp.cli.skill.upsert_block(path, block, force)[source]
Insert or update only our marked block in a shared file.
Text outside the
BEGIN/ENDmarkers is never modified.- Parameters:
- Returns:
str –
"installed","current"or"skipped"(existing block differs andforceis false).- Raises:
OSError – If the file cannot be read or written.
- Return type: