diff --git a/packages/gittensory-mcp/README.md b/packages/gittensory-mcp/README.md index 621e0cd820..c03b6ce695 100644 --- a/packages/gittensory-mcp/README.md +++ b/packages/gittensory-mcp/README.md @@ -46,6 +46,7 @@ gittensory-mcp cache clear gittensory-mcp init-client --print codex gittensory-mcp init-client --print claude gittensory-mcp init-client --print cursor +gittensory-mcp init-client --print vscode gittensory-mcp init-client --print codex --agent-profile miner-planner gittensory-mcp completion bash gittensory-mcp completion zsh @@ -154,6 +155,10 @@ The same capabilities are exposed to MCP clients as: - `gittensory_agent_explain_next_action` - `gittensory_agent_prepare_pr_packet` +### Client config + +`init-client --print ` prints the stdio MCP config for a host: `codex` (TOML), `claude`, `cursor`, and `mcp` (the shared `mcpServers` JSON shape), and `vscode` (VS Code's native `servers` map with `"type": "stdio"`, for `.vscode/mcp.json`). It prints config only; it never edits client files. + ### Agent profiles `init-client` can print optional agent-profile instructions next to the MCP client config: diff --git a/packages/gittensory-mcp/bin/gittensory-mcp.js b/packages/gittensory-mcp/bin/gittensory-mcp.js index 3d79a71dda..cab349031e 100755 --- a/packages/gittensory-mcp/bin/gittensory-mcp.js +++ b/packages/gittensory-mcp/bin/gittensory-mcp.js @@ -1779,7 +1779,7 @@ function printHelp() { gittensory-mcp changelog [--json] gittensory-mcp doctor [--profile name] [--cwd path] [--exit-code] [--json] gittensory-mcp cache status|clear [--json] - gittensory-mcp init-client --print codex|claude|cursor|mcp [--agent-profile miner-planner|maintainer-triage|repo-owner-intake] [--json] + gittensory-mcp init-client --print codex|claude|cursor|mcp|vscode [--agent-profile miner-planner|maintainer-triage|repo-owner-intake] [--json] gittensory-mcp decision-pack --login [--json] gittensory-mcp repo-decision --login --repo owner/repo [--json] gittensory-mcp analyze-branch --login [--repo owner/repo] [--base origin/main] [--branch-eligibility eligible|ineligible|unknown] [--pending-merged-prs 3] [--expected-open-prs 0] [--projected-credibility 0.8] [--scenario-note "..."] [--validation "passed|npm test|summary"] [--json] @@ -2319,7 +2319,7 @@ function shellArg(value) { function initClient(options) { const client = String(options.print ?? options.client ?? "").toLowerCase(); - if (!client) throw new Error("Pass --print codex, --print claude, --print cursor, or --print mcp."); + if (!client) throw new Error("Pass --print codex, --print claude, --print cursor, --print mcp, or --print vscode."); const command = options.command ?? "gittensory-mcp"; const snippet = clientSnippet(client, command); const agentProfile = resolveAgentProfile(options.agentProfile); @@ -2725,7 +2725,24 @@ function clientSnippet(client, command) { 2, ); } - throw new Error(`Unsupported client: ${client}. Use codex, claude, cursor, or mcp.`); + // VS Code's native MCP support uses a `servers` map with an explicit transport type, not the + // `mcpServers` shape the other JSON hosts use, so it needs its own snippet (see .vscode/mcp.json). + if (client === "vscode") { + return JSON.stringify( + { + servers: { + gittensory: { + type: "stdio", + command, + args: ["--stdio"], + }, + }, + }, + null, + 2, + ); + } + throw new Error(`Unsupported client: ${client}. Use codex, claude, cursor, mcp, or vscode.`); } async function getDecisionPackWithCache(login) { diff --git a/test/unit/mcp-cli-basics.test.ts b/test/unit/mcp-cli-basics.test.ts index eb7239cb4a..c16bceede9 100644 --- a/test/unit/mcp-cli-basics.test.ts +++ b/test/unit/mcp-cli-basics.test.ts @@ -27,6 +27,13 @@ describe("gittensory-mcp CLI — basics", () => { const generic = JSON.parse(run(["init-client", "--print", "mcp", "--json"])) as { snippet: string }; expect(generic.snippet).toBe(claude.snippet); + + const vscode = JSON.parse(run(["init-client", "--print", "vscode", "--json"])) as { snippet: string }; + // VS Code uses a `servers` map with an explicit transport type, not the `mcpServers` shape. + expect(vscode.snippet).toContain('"servers"'); + expect(vscode.snippet).toContain('"type": "stdio"'); + expect(vscode.snippet).toContain('"gittensory"'); + expect(vscode.snippet).not.toContain('"mcpServers"'); }); it("prints human-approved agent profile instructions for supported MCP clients", () => {