feat: ship .mcp.json with scaffolded projects (#55)#56
Merged
Conversation
Add template/.mcp.json using `node --env-file=.env ./dist/index.js` so every scaffolded project is immediately testable in Claude Code after init + discover + npm run build, with no manual `claude mcp add` required. - template/.mcp.json: registers the MCP server via stdio, reads credentials from .env at startup (Node 22 --env-file flag; no secrets in git) - template/README.md: add "Testing with Claude Code" section - template/CLAUDE.md: reference .mcp.json in the testing section - CLAUDE.md (root): note that scaffolded projects ship with .mcp.json - packages/create-mcp-server/src/scaffold.ts: extend next-steps output to include discover, build, and `claude .` steps - packages/create-mcp-server/src/__tests__/scaffold.test.ts: add test asserting .mcp.json is emitted into the scaffolded project - template-structure snapshot updated to include .mcp.json in file listing https://claude.ai/code/session_01Pmjb71MfDGFeDmqbx9nj1K
The previous "claude ." suggestion appeared before /build-tools, so users were told to exercise tools that hadn't been generated yet. Drop the premature `npm run build` + `claude .` lines and replace them with a note pointing users through the plugin's tool-build phase first. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the trailing prose lines about the Claude Code plugin and `.mcp.json` from the post-scaffold console output. Terminal output should stay terse — the plugin/testing workflow is covered in the docs, not repeated here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After /build-tools and /build-tools-tests, the user still needs to build the server and know that .mcp.json makes it immediately callable in Claude Code. Add steps 5 and 6 to complete the flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Step 6 ("your tools are now callable via .mcp.json") added nothing — by
the time /build-tools-tests has run, the user is already in Claude Code
and the shipped .mcp.json works without being announced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
scaffold.ts should stay as-is. The init command already prints a full "Next steps" list pointing users at discover, so adding discover to the post-scaffold output duplicates guidance the user sees at the right moment anyway. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hifi-phil
added a commit
that referenced
this pull request
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
template/.mcp.jsonso every scaffolded project is immediately testable in Claude Code afterinit+discover+npm run build— no manualclaude mcp addrequiredtemplate/README.mdwith a "Testing with Claude Code" section describing the full setup flowtemplate/CLAUDE.mdto reference.mcp.jsonin the testing sectionCLAUDE.mdto note that scaffolded projects ship with.mcp.jsonpackages/create-mcp-server/src/scaffold.tsnext-steps output to includediscover,build, andclaude .steps pointing users at Claude Code.mcp.jsonis emitted into every new projecttemplate-structuresnapshot to include.mcp.jsonin the file listingDesign decision: Option 2 —
node --env-file=.env ./dist/index.js.mcp.jsonuses the Node.js 22--env-fileflag to load credentials at startup:{ "mcpServers": { "umbraco": { "command": "node", "args": ["--env-file=.env", "./dist/index.js"] } } }Rationale:
.envis already gitignored by the template and populated byinit. Inlining credentials in.mcp.json(option 1 / example file approach) would either require an extrainitstep to write the real file or leave secrets in git. With--env-file=.envthe committed file is always safe,initwrites exactly one file (.env, which it was already doing), and there is no.mcp.json.example/.mcp.jsonduplication to confuse users. Node.js 22 is the minimum runtime required by the template, so--env-fileis always available.NODE_TLS_REJECT_UNAUTHORIZED=0is already in.env.example(and therefore in the.envthatinitproduces), so local HTTPS with self-signed certs works out of the box.Test commands run
npm installnpm run buildnpm run testnpm test -w packages/hosted-mcpnpm run build -w packages/create-mcp-servernpm test -w packages/create-mcp-server.mcp.jsontest added)npm run build -w templatenpm run test:templateTests skipped and why
npm run test:clinpm run test:integration/test:integration:chainednpm run test:e2e/test:e2e:chainednpm run test:cli:evalsANTHROPIC_API_KEYor Claude Code subscriptionTEST_SQL_CONNECTION_STRING=... npm run test:e2e -w packages/create-mcp-serverConflict note
Issue #52 (unify
initaround{url, username, password}) is in flight in parallel. That PR will change howinitpopulates.env. The.mcp.jsonadded here is unaffected by that change — both options write the same credentials to.env. No resolution needed here; whichever PR lands second will not conflict on.mcp.jsonitself.Closes #55