Print usage and exit.
()
| 49 | |
| 50 | /** Print usage and exit. */ |
| 51 | function printMcpHelp(): void { |
| 52 | console.log(`orbcode mcp — manage MCP servers |
| 53 | |
| 54 | Usage: |
| 55 | orbcode mcp add [options] <name> <command> [args...] add a stdio server |
| 56 | orbcode mcp add [options] --transport http <name> <url> add an http server |
| 57 | orbcode mcp add [options] --transport sse <name> <url> add an sse server |
| 58 | orbcode mcp remove <name> remove a server |
| 59 | orbcode mcp list list all servers |
| 60 | orbcode mcp migrate [--all] [--dry-run] import MCP servers from |
| 61 | Claude Code / Claude Desktop |
| 62 | |
| 63 | Options: |
| 64 | -s, --scope <user|project|local> config scope (default: project) |
| 65 | -t, --transport <stdio|http|sse> transport type (default: stdio) |
| 66 | -e, --env KEY=value environment variable (repeatable, stdio) |
| 67 | --header KEY=value HTTP header (repeatable, http/sse) |
| 68 | --oauth enable OAuth for http/sse |
| 69 | --oauth-scope <scope> OAuth scope (implies --oauth) |
| 70 | --all (migrate) import every detected server |
| 71 | --dry-run (migrate) show what would be imported, don't write |
| 72 | |
| 73 | Scopes: |
| 74 | project .mcp.json in the current directory (shared, checked into git) |
| 75 | user ~/.orbcode/settings.json (applies to all projects on this machine) |
| 76 | local .orbcode/settings.json (per-project, per-machine, not checked in) |
| 77 | |
| 78 | Migration sources: |
| 79 | orbcode mcp migrate scans these files and copies their mcpServers blocks |
| 80 | into ~/.orbcode/settings.json (user scope). Servers whose name already |
| 81 | exists in the destination are silently skipped. |
| 82 | |
| 83 | Claude Code (user) ~/.claude/settings.json |
| 84 | Claude Code (user, json) ~/.claude.json -> root mcpServers |
| 85 | (the most common location — this is where |
| 86 | "claude mcp add -s user ..." writes) |
| 87 | Claude Code (this project) ~/.claude.json -> projects.<cwd>.mcpServers |
| 88 | Claude Desktop ~/Library/Application Support/Claude/claude_desktop_config.json |
| 89 | (macOS) %APPDATA%\\Claude\\claude_desktop_config.json |
| 90 | (Linux) $XDG_CONFIG_HOME/Claude/claude_desktop_config.json |
| 91 | |
| 92 | When the same name appears in both layers of ~/.claude.json, the |
| 93 | project-layer entry is treated as a per-project override (Claude's own |
| 94 | precedence) and is hidden from the picker — you'll only see the root |
| 95 | version, which is the one that applies across projects. |
| 96 | |
| 97 | Use the /migrate slash command in the TUI for an interactive picker.`) |
| 98 | } |
| 99 | |
| 100 | /** Handle `orbcode mcp ...`. Returns the process exit code. */ |
| 101 | export async function runMcpCommand(args: string[]): Promise<number> { |