Skip to content

feat(#418): create .mcp.json by default during sequant init - #430

Merged
admarble merged 7 commits into
mainfrom
feature/418-sequant-init-create-mcp-json-by-default-for-claude
Mar 25, 2026
Merged

admarble merged 7 commits into
mainfrom
feature/418-sequant-init-create-mcp-json-by-default-for-claude

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • sequant init now always creates .mcp.json in the project root with the sequant MCP server config for Claude Code
  • If .mcp.json exists with a sequant entry, it's skipped; if it exists without one, sequant is merged in
  • .mcp.json appears in the "Will create:" preview during init
  • --mcp flag retains its existing behavior of writing to global client configs (Claude Desktop, Cursor, VS Code)
  • --yes creates .mcp.json (always) but skips global client config changes

Pre-PR AC Verification

AC Description Status Evidence
AC-1 sequant init creates .mcp.json by default ✅ init.ts:540 calls createProjectMcpJson() unconditionally
AC-2 .mcp.json in "Will create:" preview ✅ init.ts:389 preview line added
AC-3 Skip if .mcp.json already has sequant ✅ mcp-config.ts:191 returns skipped: true
AC-4 Merge into existing .mcp.json ✅ mcp-config.ts:195 preserves existing servers
AC-5 --mcp retains global client behavior ✅ Global MCP block unchanged at init.ts:552+
AC-6 --yes creates .mcp.json, skips global ✅ init.test.ts verifies both behaviors
AC-7 Tests pass with new coverage ✅ 56/56 tests pass in changed files
AC-8 Corrupt .mcp.json handled ✅ mcp-config.test.ts corrupt file test
AC-9 No cwd/env in .mcp.json ✅ mcp-config.test.ts verifies undefined

Test plan

  • npm run build passes
  • npm run lint passes (0 errors, 0 warnings)
  • npm test — 1909/1911 pass (2 pre-existing timeouts unrelated to this PR)
  • New unit tests for createProjectMcpJson (create/merge/skip/corrupt/no-cwd-env)
  • New integration tests in init.test.ts (default creation, --yes, --mcp, preview)

Closes #418

🤖 Generated with Claude Code

sequant init now always creates .mcp.json in the project root with the
sequant MCP server config for Claude Code. This is the primary integration
point since Claude Code reads MCP configs from .mcp.json at project root.

- Add createProjectMcpJson() to mcp-config.ts with create/merge/skip logic
- Integrate into init.ts before global client detection (always runs)
- Show .mcp.json in "Will create:" preview section
- No cwd/env in .mcp.json (Claude Code runs from project root)
- --mcp flag retains existing behavior for global client configs

Closes #418

Entire-Checkpoint: 547a1b233a7e
Gate env inclusion in getSequantMcpConfig() on clientType being present.
Without a clientType (i.e., project-level .mcp.json which is committed to
git), env is never included — preventing secrets from being checked in.

Also fixes import ordering and adds a security-focused test.

Entire-Checkpoint: 66f4e1170119
- Guard against mcpServers being an array (typeof [] === "object")
  in both addSequantToMcpConfig and createProjectMcpJson
- Only show .mcp.json in "Will create:" preview when sequant
  is not already configured there
- Add test for array edge case

Entire-Checkpoint: 547a1b233a7e
Replace inline JSON parsing in init preview with a shared predicate
in mcp-config.ts. Check logic now lives in one place instead of being
duplicated between preview and createProjectMcpJson.

Entire-Checkpoint: 547a1b233a7e
Always show .mcp.json in the "Will create:" preview unconditionally,
matching the pattern used by every other preview item. The write phase
already handles created/merged/skipped cases with accurate messaging.
Add Claude Code as the primary client in the setup section, document
automatic .mcp.json creation during sequant init, and update the
automatic setup section to reflect the new default behavior.
@admarble
admarble merged commit 5e35e79 into main Mar 25, 2026
@admarble
admarble deleted the feature/418-sequant-init-create-mcp-json-by-default-for-claude branch March 25, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequant init: create .mcp.json by default for Claude Code MCP integration

1 participant