From 5d812ea941efe8965bd0caedb4a12ff3d21638b4 Mon Sep 17 00:00:00 2001 From: Karstein Phobic Nyvold Kvistad Date: Mon, 27 Apr 2026 20:32:30 +0200 Subject: [PATCH] feat(postinstall): tell users WHERE to put the snippet (project vs user scope) After printing the .mcp.json snippet, also print: - Project-scoped path: /.mcp.json (recommended, git-shareable) - User-scoped path: %USERPROFILE%/.claude.json (resolved for the current user) - 'claude mcp add' CLI alternative - Restart-Claude-Code reminder The path interpolation uses USERPROFILE so the printed path matches the user's actual home, not a generic placeholder. --- src/postinstall.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/postinstall.ts b/src/postinstall.ts index 1fbb4fc..47f1da5 100644 --- a/src/postinstall.ts +++ b/src/postinstall.ts @@ -69,16 +69,32 @@ async function main(): Promise { return; } - process.stdout.write(`Add the following to your .mcp.json (Claude Code configuration):\n\n`); + process.stdout.write(`Add the following to your Claude Code MCP configuration:\n\n`); try { process.stdout.write(printConfig(installs) + '\n\n'); } catch (err) { process.stdout.write(`(printConfig failed: ${(err as Error).message})\n\n`); return; } + + const userScope = process.env.USERPROFILE + ? process.env.USERPROFILE + '\\.claude.json' + : '~/.claude.json'; + process.stdout.write( - `Re-run anytime with: codesys-mcp-sp21-plus --print-config\n` + - `Filter to one SP family with: codesys-mcp-sp21-plus --print-config --sp 22\n\n` + `Where to put it:\n` + + ` - Project-scoped (recommended, shareable via git):\n` + + ` \\.mcp.json\n` + + ` Create the file if it doesn't exist; if it does, merge the "mcpServers"\n` + + ` entries into the existing object.\n` + + ` - User-scoped (applies to every Claude Code session):\n` + + ` ${userScope}\n` + + ` Or use the CLI: claude mcp add codesys-sp22-patch1 codesys-mcp-sp21-plus -- --codesys-path ... --codesys-profile ...\n` + + `\n` + + `After editing, restart Claude Code so it re-reads the MCP config.\n` + + `\n` + + `Re-run anytime: codesys-mcp-sp21-plus --print-config\n` + + `Filter to one SP family: codesys-mcp-sp21-plus --print-config --sp 22\n\n` ); }