mcp-context-forge icon indicating copy to clipboard operation
mcp-context-forge copied to clipboard

[Bug]: Claude Desktop is getting invalid type from mcp-context-forge gateway

Open playground opened this issue 1 month ago • 5 comments

@kevalmahajan

🐞 Bug Summary

This was working a few of weeks ago, today I'm getting these errors

Fatal error: ServerError: HTTP 404: Invalid OAuth error response: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "error"
    ],
    "message": "Required"
  }
]

🧩 Affected Component

Select the area of the project impacted:

  • [ ] mcpgateway - API
  • [ ] mcpgateway - UI (admin panel)
  • [ ] mcpgateway.wrapper - stdio wrapper
  • [ ] Federation or Transports
  • [ ] CLI, Makefiles, or shell scripts
  • [ ] Container setup (Docker/Podman/Compose)
  • [X] Other (explain below)

🔁 Steps to Reproduce

  1. here is the claude_desktop_config.json that was working a few weeks ago
{
  "mcpServers": {
    "open-horizon-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:4444/servers/224831b6cd344fb6b35179401ee8b7cc/mcp",
        "--header",
        "exchange-org:<orgId>",
        "--header",
        "exchange-url:http://open-horizon.lfedge.iol.unh.edu:3090/v1/orgs",
        "--header",
        "exchange-credential:<your_credential",
        "--header",
        "Authorization:Bearer *****************"
      ]
    }
  }
}
  1. ...
  2. ...

🤔 Expected Behavior

Claude Desktop should be able to discover this mcp server and tools


📓 Logs / Error Output

[49584] Recursively reconnecting for reason: falling-back-to-alternate-transport
[49584] [49584] Connecting to remote server: http://localhost:4444/servers/224831b6cd344fb6b35179401ee8b7cc/mcp
[49584] Using transport strategy: sse-only
[49584] Connection error: ServerError: HTTP 404: Invalid OAuth error response: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "error"
    ],
    "message": "Required"
  }
]. Raw body: {"detail":"Not Found"}
    at parseErrorResponse (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:12229:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async registerClient (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:12617:11)
    at async authInternal (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:12272:29)
    at async auth (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:12235:12)
    at async SSEClientTransport._authThenStart (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:13046:16)
    at async SSEClientTransport.start (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:13136:12)
    at async connectToRemoteServer (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-AKJME7CQ.js:13838:7)
    at async runProxy (file:///Users/jeff/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/proxy.js:141:29) {
  errorUri: undefined
}
[49584] Fatal error: ServerError: HTTP 404: Invalid OAuth error response: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "error"
    ],
    "message": "Required"
  }
]

🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Image Image

playground avatar Oct 28 '25 14:10 playground

Hi, thanks for checking. Can you test if:

  1. The previous release 0.7.0, or 0.8.0 still work?
  2. Does #1343 address the issues?

Wondering if something changed in the client implementation.

Thanks!

crivetimihai avatar Oct 29 '25 00:10 crivetimihai

@MohanLaksh can you please retest latest so we can close? Thanks!

crivetimihai avatar Nov 09 '25 14:11 crivetimihai

fyi, I tried with 0.9.0, it's failing with this error

2025-11-10T21:37:35.705Z [info] [open-horizon-mcp] Message from client: {"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0} 2025-11-10T21:37:37.511Z [info] [open-horizon-mcp] Server transport closed 2025-11-10T21:37:37.511Z [info] [open-horizon-mcp] Client transport closed 2025-11-10T21:37:37.512Z [info] [open-horizon-mcp] Server transport closed unexpectedly

playground avatar Nov 11 '25 15:11 playground

Hi @playground

It seems like this issue is related to how Claude (or Cursor) is handling the space after the "Bearer" token in the --header argument, rather than being an issue with the code in this repository itself. When using Claude, it doesn't seem to render the space after "Bearer" correctly in the --args section.

As a workaround, something like this should work for you:

{
  "mcpServers": {
    "open-horizon-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:4444/servers/e6f0f120b06b4807883f880db3e44f3e/mcp",
        "--header",
        "Authorization:${AUTH_TOKEN}"
      ],
      "env": {
        "AUTH_TOKEN": "Bearer <replace-your-token>"
      }
    }
  }
}

More details on the issue with rendering spaces in args in claude/cursor : https://www.npmjs.com/package/mcp-remote Feel free to keep me posted on how it goes!

kevalmahajan avatar Nov 11 '25 16:11 kevalmahajan

These two configuration used to work

{
  "mcpServers": {
    "open-horizon-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:4444/servers/e31a9930c636433e84cb885d168482be/mcp",
        "--header",
        "exchange-org:ieam-dev-jefflu",
        "--header",
        "exchange-url:https://ibm-edge.ieam-poc-574c25a9e145dd8c8db5b5c614b682cb-0000.us-south.containers.appdomain.cloud/edge-exchange/v1/orgs",
        "--header",
        "exchange-credential:*****
        "--header",
        "Authorization:${AUTH_TOKEN}"
      ],
      "env": {
        "AUTH_TOKEN": "Bearer **********"
      }
  } 
}

{
  "mcpServers": {
    "open-horizon-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:4444/servers/e31a9930c636433e84cb885d168482be/mcp",
        "--header",
        "exchange-org:ieam-dev-jefflu",
        "--header",
        "exchange-url:https://ibm-edge.ieam-poc-574c25a9e145dd8c8db5b5c614b682cb-0000.us-south.containers.appdomain.cloud/edge-exchange/v1/orgs",
        "--header",
        "exchange-credential:*****
        "--header",
        "Authorization:Bearer *****"
      ]
    }
  } 
}

This the error logs

2025-11-11T17:12:30.564Z [info] [open-horizon-mcp] Message from client: {"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0} 2025-11-11T17:12:32.174Z [info] [open-horizon-mcp] Server transport closed 2025-11-11T17:12:32.174Z [info] [open-horizon-mcp] Client transport closed 2025-11-11T17:12:32.175Z [info] [open-horizon-mcp] Server transport closed unexpectedly, this is likely due to the process exiting early

the same mcp server running locally or in CodeEngine, both works with claude desktop if I point

"mcp-remote",
"http://localhost:3000/mcp"

OR

"mcp-remote",
"https://open-horizon-mcp-server-dev.1zcqw752hw76.us-south.codeengine.appdomain.cloud/mcp"

playground avatar Nov 11 '25 21:11 playground