0
0
Fork 0

feat(postinstall): tell users WHERE to put the snippet (project vs user scope)

After printing the .mcp.json snippet, also print:
- Project-scoped path: <project>/.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.
This commit is contained in:
Karstein Phobic Nyvold Kvistad 2026-04-27 20:32:30 +02:00
parent 3d75548ba9
commit 5d812ea941

View file

@ -69,16 +69,32 @@ async function main(): Promise<void> {
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` +
` <your-project-root>\\.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`
);
}