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.
| Agent | File | Found by |
|---|---|---|
| Claude Code | .mcp.json | always |
| 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
installwas 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
oldandnew, each marked:both have it,-onlyold,+onlynew(a longest common subsequence). - install
- Installs as
optionssay inroot, onmachine, the server run ascommand;askis asked whether to write the files it is shown. After writing,readyis 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 installwithargsin the working foldercwd: in the project’s folder (orcwdoutside one), the server run as--command, or the project’scommand, orshuyi. Returns the exit code.- parse_
args - Reads
install’s arguments. - plan
- The file of each agent found in
rootor onmachine, with the server run ascommand’s words andmcp, and Claude Code’s settings after its file. - run_
ready - Runs the server as
command’s words andmcp --readyinroot, its output passed through: how long it took, or why it failed. - said_
yes - Whether the line
inputgives says yes (y,Yoryes). - settings_
text - Claude Code’s settings with
env’sMCP_TIMEOUTat leastMCP_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).