Skip to main content

Module install

Module install 

Source
Expand description

shuyi mcp install: registers the server with the agents it finds, in each one’s project file of MCP servers, in the project’s folder (or the working folder outside one). It shows what changes and asks before writing, and keeps each file it changes as <file>.bak, then runs the entry it wrote with --ready, so the server is built before an agent first connects and waits for it. --dry-run writes nothing and prints each file as it would write it.

AgentFileFound by
Claude Code.mcp.jsonalways
Cursor.cursor/mcp.json.cursor/ here or in the home folder
VS Code.vscode/mcp.json.vscode/ here, or code on PATH
Gemini CLI.gemini/settings.json.gemini/ here or in the home folder

Claude Code’s file is also what claude --mcp-config <file> reads. For Claude Code it also sets MCP_TIMEOUT in the project’s .claude/settings.json, so Claude Code waits for the server’s first build to finish (SETTINGS).

Structs§

Agent
An agent the server can be registered with.
Machine
Where agents are looked for on this machine.
Options
What install was asked.
Planned
One file to write.

Constants§

AGENTS
Every agent the server can be registered with, Claude Code first.
MCP_TIMEOUT
How long Claude Code waits for a server to start, in milliseconds (its MCP_TIMEOUT; 30 s if unset): 5 minutes, so a cold build of the server finishes first.
NAME
The server’s name in each agent’s file.
SETTINGS
Claude Code’s project settings, from the project’s folder.

Functions§

diff
The lines of old and new, each marked: both have it, - only old, + only new (a longest common subsequence).
install
Installs as options say in root, on machine, the server run as command; ask is asked whether to write the files it is shown. After writing, ready is given what there is to print so far and runs the server with --ready: how long that took, or why it failed. Returns what to print, or the error.
main
shuyi mcp install with args in the working folder cwd: in the project’s folder (or cwd outside one), the server run as --command, or the project’s command, or shuyi. Returns the exit code.
parse_args
Reads install’s arguments.
plan
The file of each agent found in root or on machine, with the server run as command’s words and mcp, and Claude Code’s settings after its file.
run_ready
Runs the server as command’s words and mcp --ready in root, its output passed through: how long it took, or why it failed.
said_yes
Whether the line input gives says yes (y, Y or yes).
settings_text
Claude Code’s settings with env’s MCP_TIMEOUT at least MCP_TIMEOUT, from the file as it is (old, if there is one), everything else in it kept; or why it can’t be (not a JSON object).