Skip to content

feat(cli): six-client MCP init with --dry-run - #153

Open
PatrickSys wants to merge 1 commit into
masterfrom
cursor/mcp-init-six-clients-2776
Open

PatrickSys wants to merge 1 commit into
masterfrom
cursor/mcp-init-six-clients-2776

Conversation

@PatrickSys

Copy link
Copy Markdown
Owner

Summary

  • Extends codebase-context init from four to six clients: Claude Code, Cursor, Codex, VS Code (Copilot workspace .vscode/mcp.json), Windsurf (user ~/.codeium/windsurf/mcp_config.json), and OpenCode.
  • Adds --dry-run to print Would create / Would update / Unchanged without writing files (preview-before-write pattern aligned with MCP filesystem server docs).
  • Keeps idempotent merge behavior for existing MCP entries; VS Code uses the official top-level servers shape per @modelcontextprotocol/server-filesystem workspace examples.

Tests

  • tests/cli-init.test.ts — VS Code/Windsurf config generation and six-client table
  • tests/cli-init-dry-run-home.test.ts — temp HOME dry-run and VS Code merge
  • Full suite: 1301 passed (after pnpm run build)

Docs

  • README install section, docs/cli.md, docs/client-setup.md wizard section

Avoids PR #145 embedding files and #68/#71 Ollama work.

Open in Web Open in Cursor 

Configure Claude Code, Cursor, Codex, VS Code, Windsurf, and OpenCode in one
pass with idempotent merges, user-scoped Windsurf paths, and explicit create/
update output. Add temp-HOME tests and document init in the README.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T22:33:36.993383Z 83698db PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83698db785

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli-init.ts
filePath: string,
generatedContent: string,
client: Extract<Client, 'claude-code' | 'cursor' | 'opencode'>
client: Extract<Client, 'claude-code' | 'cursor' | 'opencode' | 'vscode' | 'windsurf'>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept JSONC when merging VS Code MCP configurations

When an existing .vscode/mcp.json contains comments or trailing commas, selecting VS Code now aborts setup with “existing JSON is invalid” because _buildMergedMcpContent uses JSON.parse. These are valid VS Code configurations: VS Code explicitly registers mcp.json as JSONC. Since all selected clients are prepared before any writes, this also prevents other selected tools from being configured. Use a JSONC-aware merge for the newly supported VS Code client, preserving unrelated configuration.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect the CLI setup workflow and the client configs it creates.

Fix commented VS Code config support and the shared Windsurf root before merging.

Findings

  1. P1 Commented configs stop setup ▶
  2. P1 Setup replaces another project's default ▶
  3. P2 Tests leave temporary folders ▶

Summary

Adds VS Code and Windsurf to init, plus --dry-run and per-file change reports.

  • Init can configure VS Code and Windsurf alongside four other clients.
  • Init previews config changes with --dry-run and leaves files untouched.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Parse init options] --> B[Choose clients]
  B --> C[Generate and merge every config]
  C --> D{All checks pass?}
  D -->|No| E[Report failure without writes]
  D -->|Yes| F{Dry run?}
  F -->|Yes| G[Print proposed changes]
  F -->|No| H[Write changed configs]
  H --> I[Print results]
Loading

Reviews (1) · Last reviewed commit: "feat(cli): extend init to six MCP client..." · Reviewed by Greptile

Comment thread src/cli-init.ts
filePath: string,
generatedContent: string,
client: Extract<Client, 'claude-code' | 'cursor' | 'opencode'>
client: Extract<Client, 'claude-code' | 'cursor' | 'opencode' | 'vscode' | 'windsurf'>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Commented configs stop setup

VS Code allows comments and trailing commas in .vscode/mcp.json, but the new VS Code path passes that file to _buildMergedMcpContent, which uses strict JSON.parse. Either feature makes normal setup and --dry-run fail. Since every selected config is checked before any writes, this also stops setup for the other clients. Use a parser that accepts VS Code's config format and add a commented-file test.

Comment thread src/cli-init.ts
const paths = platform === 'win32' ? path.win32 : path.posix;
const home = resolveHome(env, platform);
if (client === 'codex') return path.join(rootPath, '.codex', 'config.toml');
if (client === 'windsurf') return path.join(home, '.codeium', 'windsurf', 'mcp_config.json');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Setup replaces another project's default

Windsurf now saves a project-specific launch in one user-wide file. Running init in project B after project A replaces A's saved root with B's: isGeneratedLaunch accepts any absolute root, and the merge replaces args. If a session does not announce workspace roots, later calls without an explicit project can use B while the user is working in A. Keep the shared registration project-neutral, or require confirmation before replacing a different saved root.

Comment on lines +17 to +19
if (tempHome) await fs.rm(tempHome, { recursive: true, force: true });
tempHome = '';
projectRoot = '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests leave temporary folders

The new tests create a separate temporary projectRoot, but afterEach deletes only tempHome before clearing both paths. The VS Code test leaves a config behind on every run. Remove projectRoot before resetting it so repeated test runs do not accumulate temporary folders.

Suggested change
if (tempHome) await fs.rm(tempHome, { recursive: true, force: true });
tempHome = '';
projectRoot = '';
if (tempHome) await fs.rm(tempHome, { recursive: true, force: true });
if (projectRoot) await fs.rm(projectRoot, { recursive: true, force: true });
tempHome = '';
projectRoot = '';

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.

2 participants