Skip to content

MCP: http entry in ~/.claude.json silently displaces a working stdio server from ~/.jcode/mcp.json #653

Closed

Description

@paulbettner

~/.jcode/mcp.json defines github as a stdio server (via mcp-remote, which works). ~/.claude.json defines the same name as type: http. The http entry wins the merge, then gets dropped for being non-stdio — so a working server silently disappears.

Repro

~/.jcode/mcp.json:

{ "mcpServers": { "github": { "type": "stdio", "command": "npx",
  "args": ["-y", "[email protected]", "https://api.githubcopilot.com/mcp/", "--header", "Authorization: Bearer ${TOKEN}"] } } }

~/.claude.json:

{ "mcpServers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/" } } }

Log:

MCP: Skipping non-stdio server 'github' (http); HTTP/SSE transports are not yet supported
MCP: Found 2 server(s) in config

The server is gone, with no indication that a usable definition was overwritten.

Cause

In crates/jcode-base/src/mcp/protocol.rs, load_for_dir() loads ~/.jcode/mcp.json, then .extend()s ~/.claude.json over it. extend replaces on key collision, so the http entry displaces the stdio one. The non-stdio filter afterwards then removes it.

Suggestion

When an incoming entry would replace an existing one and the incoming entry is a transport jcode can't run, keep the existing one. Something like: skip the replacement if !incoming.is_stdio() && existing.is_stdio().

Logging the displacement would also help — the current message reads as "you configured http" rather than "your working stdio config was overwritten".

An opt-out for external-config import would solve it too, for users who want jcode's own MCP config to be authoritative.

Activity

  1. added
    bug
    triage: reproducible
    autonomous: clear
    priority: medium
    on Jul 29, 2026
  2. 1jehuang commented on Jul 29, 2026

    @1jehuang
    Owner

    Confirmed, and the failure mode is as bad as you describe: the http entry wins the merge, the non-stdio filter then drops it, and the log message blames a config the user did not write.

    Fixed in #656, taking your suggestion directly: a collision no longer replaces an existing entry when the incoming one is a transport jcode cannot run and the existing one is stdio. It also logs the displacement it skipped, so the situation is visible rather than silent.

    The guard is deliberately one-directional, and both directions are tested: a runnable stdio entry still overrides a non-runnable http one, and same-transport collisions keep the existing last-writer-wins precedence. Applied to the ~/.claude.json merge and to the project-local chain, which had the same hazard. cargo test -p jcode-base --lib mcp:: passes with 3 new tests.

    Your third suggestion, an opt-out for external-config import so jcode's own MCP config is authoritative, is a genuine config-surface decision rather than a bug fix, so I have left it for the maintainer instead of inventing a flag.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  3. 1jehuang commented on Jul 29, 2026

    @1jehuang
    Owner

    Follow-up: my first fix was incomplete, and I want to correct the record.

    It guarded load_for_dir and the project-local chain, but missed three other merge points with the identical hazard: import_from_external's Claude-legacy and Codex merges, and load_claude_json's per-project override of the same file's global mcpServers. An http entry could still displace a working stdio server in those paths and then be dropped by the non-stdio filter. All merge sites now share the guard (2970d5479).

    More importantly, I have now added a test for your exact configuration rather than only the project-local equivalent I tested first, and mutation-verified it: with the guard reverted, github disappears from the merged config entirely, exactly as you reported. It survives with the guard.

    Worth recording for anyone testing this area: under JCODE_HOME, user_home_path() resolves external configs to $JCODE_HOME/external/, so a test that writes .claude.json at the JCODE_HOME root never loads it and passes vacuously. My first attempt did exactly that and looked green while proving nothing.

    Your third suggestion, an opt-out so jcode's own MCP config is authoritative, remains open for the maintainer as a config-surface decision.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  4. 1jehuang commented on Jul 29, 2026

    @1jehuang
    Owner

    Final verification: confirmed in the built binary, not just unit tests.

    I ran a real jcode build against your exact configuration (stdio github in ~/.jcode/mcp.json, http github in ~/.claude.json) in an isolated JCODE_HOME, and read jcode's own log output.

    With the fix:

    [INFO] MCP: Found 1 server(s) in config
    [INFO] MCP: Keeping existing stdio server 'github'; ignoring http definition from a lower-precedence config
    

    With the guard reverted and rebuilt, i.e. the version you reported:

    [INFO] MCP: Skipping non-stdio server 'github' (http); HTTP/SSE transports are not yet supported
    

    That is your symptom reproduced exactly, including the misleading log line you flagged, then resolved. Note the difference in what the log now tells you: previously it implied you had configured http, and now it names the displacement it prevented.

    Worth mentioning, since it affects how this can be tested: there is no CLI subcommand that prints the merged MCP config (no jcode mcp list), so this had to be verified through the log path. If you have a use for inspecting the effective merged config, that might be worth its own feature request.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  5. added a commit that references this issue on Jul 31, 2026
    41f9142
  6. added 10 commits that reference this issue on Aug 30, 2026
    cc3425b
    5e77bc5
    5961508
    fc8ca16
    118db83
    80c91ea
    dfc2f85
    8e67944
    191faa7
    e541ded
  7. added 2 commits that reference this issue on Sep 18, 2026
    edb4917
    852fb1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: clearbugpriority: mediumtriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions