mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

[Bug]: `mcp upstream import` drops the `oauth` block in a batch file

Open felipecrs opened this issue 1 week ago • 1 comments

What happened?

upstream add-json accepts mcpproxy's own server shape, including the oauth block (client_id, client_secret, redirect_uri, scopes). But upstream import cannot read it. The import path goes through format detection first, and none of the parsers knows mcpproxy's native dialect, so a shared mcpServers file with an oauth entry either lands on the Cursor fallback (which has no oauth field, so JSON decoding silently drops it) or gets detected as some other client's dialect and loses the fields that dialect doesn't have.

The result is that there is no way to move servers with OAuth in bulk. You can create one with add-json, but you cannot import a pack of them: importing works, then you remove the OAuth servers and add them back one by one. That second step is what I'd like to avoid.

Expected behavior

Since mcpproxy defines this format itself (mcp_config.json stores it, add-json parses it), it feels like upstream import should understand it too. The import path could reuse what add-json already has: the same accepted key set, the same validation, the same unknown-key rejection. Detection is also easy to make unambiguous: snake_case keys inside oauth (client_id, client_secret, redirect_uri) match no other client's dialect (Cursor uses auth.CLIENT_ID, Gemini and Claude Code use camelCase), so a high-confidence detection rule is a few lines.

A shared server pack was my use case: one JSON file a colleague can import and go. Right now the pack has to ship without the OAuth servers, and each person repeats the manual dance.

Open to writing this as a PR if the direction sounds good.

Steps to reproduce

Observed while reading master (commit 5363c34d, which is what taught add-json and daemon-mode import to keep oauth that a parser actually parsed).

MCPProxy version

5363c34d

Operating system

macOS

Relevant logs


Pre-submission checklist

  • [x] I searched existing issues and did not find a duplicate
  • [ ] I ran mcpproxy doctor and reviewed the output

felipecrs avatar Nov 26 '26 15:11 felipecrs

Thanks @felipecrs, the direction is right. upstream import should read the format mcpproxy writes itself, and it should reuse what add-json already has (same key set, same validation, same rejection of unknown keys) instead of a second parser.

A PR is welcome. Two things I would ask for:

  1. Detection must not guess. A file is treated as mcpproxy's own format only on keys no other client uses (the snake_case oauth keys you named, protocol, working_dir, isolation), and a test should show that the Cursor, Claude Code and Gemini fixtures still detect as before.
  2. A test that imports a file with two servers, one with an oauth block, and checks the block is stored as written, in both daemon mode and standalone mode.

If you would rather not, say so and I will pick it up.

Dumbris avatar Nov 26 '26 17:11 Dumbris