opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Opencode hangs after loading Context7 Remote MCP server

Open lichman0405 opened this issue 1 year ago • 10 comments

Description:

We are experiencing a critical issue when attempting to load a remote MCP server in Opencode using the context7 endpoint.

After launching Opencode with the following configuration, the interface loads but completely freezes upon trying to send a message. The input prompt becomes unresponsive, and no messages are sent or rendered.

Reproduction Steps:

  1. Add the following configuration to opencode.json: { "$schema": "https://opencode.ai/config.json", "theme": "opencode", "provider": { "moonshot": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://api.moonshot.ai/v1" }, "models": { "kimi-k2-0711-preview": {} } } }, "autoshare": false, "autoupdate": true, "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "enabled": true } } }

  2. Launch Opencode.

  3. Wait for the interface to fully load.

  4. Attempt to enter a prompt and press Enter.

  5. Observe: the interface freezes — no response, no error message shown.

Please advise if:

There's a known compatibility issue with this endpoint?

MCPs require specific response schema to be valid?

Additional debugging or logs are needed from our side?

Thanks in advance for your support!

lichman0405 avatar Jul 23 '25 06:07 lichman0405

I think the same happens with Github remote MCP servers.

ingwarsw avatar Jul 23 '25 09:07 ingwarsw

So I think the issue appears to be related to MCP... Related: https://github.com/sst/opencode/issues/1208

RoRep1ay avatar Jul 23 '25 10:07 RoRep1ay

So I think the issue appears to be related to MCP... Related: #1208

Truely. I am working on it to find out the issue.

BTW: DeepSeek-Chat is not able to "call tools", have you ever try?

lichman0405 avatar Jul 23 '25 10:07 lichman0405

I think the same happens with Github remote MCP servers.

Yah. Same Here for other remote ones.

lichman0405 avatar Jul 23 '25 11:07 lichman0405

Same here for remote ones. Had to use local context7

dan-myles avatar Jul 23 '25 14:07 dan-myles

Seems like this is what I have been experiencing now. As a note, it seems like after about 5 minutes of waiting the agent "times out" and works on a first retry.

My log: https://gist.github.com/BasixKOR/2a30a9be382e63ce3d51ff9acae2785d

BasixKOR avatar Jul 23 '25 17:07 BasixKOR

This is an issue with multiple MCPs that doesn't occur in other tools. I haven't been able to get any remote MCPs to work since before *.46. I have three I use mainly, Honeycomb, Context7, and then one I wrote. None work within OpenCode. All work within other tools. Log's don't provide any information.

adrielp avatar Jul 24 '25 18:07 adrielp

@lichman0405 - if you set https://mcp.context7.com/mcp to https://mcp.context7.com/sse it should work. Basically, the current MCP code for Remote only supports sse which is deprecated (IIRC) in favor of http streaming. The current ai library being used in opencode is a pretty minimal client that doesn't full support the current MCP spec. To get http streamable to work we'd need to pass in the http streamable transport directly.

adrielp avatar Jul 24 '25 19:07 adrielp

Thanks for the insight, @adrielp . I’ve also deployed a few scientific-computation-oriented MCPs on a private cloud. The architecture looks like this: host → client → fastMCP → FastAPI (containerized). These MCPs are callable via OpenCode without issue.

However, context7 seems to be the only one that fails in this setup. I had suspected it might be due to transport protocol incompatibilities—possibly related to the server not responding correctly to the SSE expectations or the client mishandling HTTP streaming fallback.

I’m still actively debugging this and will share more once I have concrete findings.

lichman0405 avatar Jul 25 '25 02:07 lichman0405

fixed in latest

thdxr avatar Jul 25 '25 23:07 thdxr