Skip to content

fix: read and merge file-path MCP configs instead of dropping them#1192

Open
qozle wants to merge 1 commit intoanthropics:mainfrom
qozle:fix/mcp-config-file-path-merge
Open

fix: read and merge file-path MCP configs instead of dropping them#1192
qozle wants to merge 1 commit intoanthropics:mainfrom
qozle:fix/mcp-config-file-path-merge

Conversation

@qozle
Copy link
Copy Markdown
Contributor

@qozle qozle commented Apr 8, 2026

Summary

Fixes #1191. mergeMcpConfigs() silently dropped file-path MCP configs when inline JSON configs were also present.

  • The action always prepends its own inline JSON config (github_comment, etc.), so merged.mcpServers was always non-empty
  • The old code only returned a file path if no inline configs existed — otherwise it returned JSON.stringify(merged), discarding the file path entirely
  • Now reads file-path configs from disk with readFileSync and merges their mcpServers into the combined config
  • Invalid or missing files log a warning and continue gracefully

Test plan

  • Existing inline-JSON-only merge tests still pass
  • New test: inline JSON + file path produces merged config with all servers (the exact External MCP servers (e.g. Notion) listed in allowedTools but never connected at runtime #1191 scenario)
  • New test: multiple file paths are all read and merged
  • New test: missing file logs warning, doesn't crash, other configs preserved
  • Single file path still passed through to CLI as-is (no merge needed)
  • bun test — 655/655 pass
  • bun run typecheck — clean
  • bun run format:check — clean

…g them

mergeMcpConfigs() stored file paths in a variable but always returned
only the inline-JSON merged result when inline configs were present.
Since the action always prepends its own inline JSON config (e.g.
github_comment server), user-provided file paths (like --mcp-config
/tmp/mcp-notion.json) were silently dropped — the server was never
connected at runtime.

Now reads file-path configs from disk with readFileSync and merges
their mcpServers into the combined config. Invalid or missing files
log a warning and continue gracefully.

Closes anthropics#1191

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qozle qozle force-pushed the fix/mcp-config-file-path-merge branch from 1df531e to 80e204d Compare April 8, 2026 10:40
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.

External MCP servers (e.g. Notion) listed in allowedTools but never connected at runtime

1 participant