Opencode hangs when adding brave-search as an MCP #2105

Closed
opened 2026-02-16 17:34:10 -05:00 by yindo · 8 comments
Owner

Originally created by @aligg73 on GitHub (Oct 14, 2025).

Originally assigned to: @thdxr on GitHub.

When adding brave-search as a MCP, in opencode.json, inference halts. In other words, in a new session, the LLM (I am using GLM 4.6) is not being queried.

Example config as part of opencode.json:

"mcp": {
   "brave-search": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "@brave/brave-search-mcp-server",
        "--transport",
        "http"
      ],
      "enabled": true,
      "environment": {
        "BRAVE_API_KEY": "xxxxxxxx"
      }
    }

In the tools section, brave-search is set to true:
"brave-search": true

Nothing in the logs I can see are out of the ordinary:

cat ~/.local/share/opencode/log/2025-10-14T162013.log 
INFO  2025-10-14T16:20:13 +72ms service=default version=0.15.2 args=[] opencode
INFO  2025-10-14T16:20:13 +0ms service=project directory=/home/alex/www/prestau fromDirectory
INFO  2025-10-14T16:20:13 +15ms service=config path=/home/alex/.config/opencode/config.json loading
INFO  2025-10-14T16:20:13 +1ms service=config path=/home/alex/.config/opencode/opencode.json loading
INFO  2025-10-14T16:20:13 +0ms service=config path=/home/alex/.config/opencode/opencode.jsonc loading
INFO  2025-10-14T16:20:13 +0ms service=config path=/home/alex/www/prestau/opencode.json loading
INFO  2025-10-14T16:20:13 +6ms service=bun cmd=["/home/alex/.opencode/bin/opencode","add","@opencode-ai/plugin@0.15.2","--exact"] cwd=/home/alex/.config/opencode running
INFO  2025-10-14T16:20:13 +1ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
INFO  2025-10-14T16:20:13 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
INFO  2025-10-14T16:20:13 +12ms service=bus type=* subscribing
INFO  2025-10-14T16:20:13 +0ms service=bus type=session.updated subscribing
INFO  2025-10-14T16:20:13 +0ms service=bus type=message.updated subscribing
INFO  2025-10-14T16:20:13 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-14T16:20:13 +0ms service=format init
INFO  2025-10-14T16:20:13 +0ms service=bus type=file.edited subscribing
INFO  2025-10-14T16:20:13 +4ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers
INFO  2025-10-14T16:20:13 +3ms service=models.dev file={} refreshing
INFO  2025-10-14T16:20:13 +1ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/plugin@0.15.2

[1.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-14T16:20:13 +4ms service=provider init
INFO  2025-10-14T16:20:13 +14ms service=provider providerID=openrouter found
INFO  2025-10-14T16:20:13 +0ms service=provider providerID=zai-coding-plan found
INFO  2025-10-14T16:20:13 +0ms service=provider providerID=opencode found
INFO  2025-10-14T16:20:13 +5ms service=default cmd=["/home/alex/.cache/opencode/tui/tui-5ne1x26y."] tui
INFO  2025-10-14T16:20:13 +16ms service=server method=GET path=/path request
INFO  2025-10-14T16:20:13 +1ms service=server duration=1 response
INFO  2025-10-14T16:20:13 +0ms service=server method=GET path=/project/current request
INFO  2025-10-14T16:20:13 +0ms service=server duration=0 response
INFO  2025-10-14T16:20:13 +0ms service=server method=GET path=/agent request
INFO  2025-10-14T16:20:13 +1ms service=server duration=1 response
INFO  2025-10-14T16:20:13 +1ms service=server method=GET path=/config request
INFO  2025-10-14T16:20:13 +0ms service=server duration=0 response
INFO  2025-10-14T16:20:13 +4ms service=server method=GET path=/command request
INFO  2025-10-14T16:20:13 +0ms service=server duration=0 response
INFO  2025-10-14T16:20:13 +1ms service=server method=GET path=/file/status request
INFO  2025-10-14T16:20:13 +2ms service=tui commands={"agent_cycle":{},"agent_cycle_reverse":{},"agent_list":{},"app_exit":{},"app_help":{},"editor_open":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_page_down":{},"messages_page_up":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_cycle_recent_reverse":{},"model_list":{},"project_init":{},"session_child_cycle":{},"session_child_cycle_reverse":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_timeline":{},"session_unshare":{},"theme_list":{},"thinking_blocks":{},"tool_details":{}} Loaded commands
INFO  2025-10-14T16:20:13 +0ms service=server method=GET path=/tui/control/next request
INFO  2025-10-14T16:20:13 +0ms service=server method=GET path=/event request
INFO  2025-10-14T16:20:13 +0ms service=server event connected
INFO  2025-10-14T16:20:13 +1ms service=bus type=* subscribing
INFO  2025-10-14T16:20:13 +1ms service=server duration=2 response
INFO  2025-10-14T16:20:13 +0ms service=server method=GET path=/config/providers request
INFO  2025-10-14T16:20:13 +1ms service=server duration=1 response
INFO  2025-10-14T16:20:13 +23ms service=server duration=28 response
INFO  2025-10-14T16:20:17 +3585ms service=server method=POST path=/session request
INFO  2025-10-14T16:20:17 +1ms service=session id=ses_61c7a41dcffeOj3V52tEEd2U1P version=0.15.2 projectID=571dab60f1022056cb239bc7044f6296665ab50e directory=/home/alex/www/prestau title=New session - 2025-10-14T16:20:17.059Z time={"created":1760458817059,"updated":1760458817059} created
INFO  2025-10-14T16:20:17 +1ms service=bus type=session.updated publishing
INFO  2025-10-14T16:20:17 +1ms service=server duration=3 response
INFO  2025-10-14T16:20:17 +3ms service=server method=POST path=/session/ses_61c7a41dcffeOj3V52tEEd2U1P/message request
INFO  2025-10-14T16:20:17 +3ms service=session.prompt session=ses_61c7a41dcffeOj3V52tEEd2U1P prompt
INFO  2025-10-14T16:20:17 +2ms service=bus type=message.updated publishing
INFO  2025-10-14T16:20:17 +1ms service=bus type=message.part.updated publishing
INFO  2025-10-14T16:20:17 +1ms service=bus type=session.updated publishing
INFO  2025-10-14T16:20:17 +0ms service=provider providerID=zai-coding-plan modelID=glm-4.6 getModel
INFO  2025-10-14T16:20:17 +0ms service=provider status=started providerID=zai-coding-plan getSDK
INFO  2025-10-14T16:20:17 +45ms service=provider status=completed duration=45 providerID=zai-coding-plan getSDK
INFO  2025-10-14T16:20:17 +2ms service=provider providerID=zai-coding-plan modelID=glm-4.6 found
INFO  2025-10-14T16:20:17 +0ms service=session.prompt session=ses_61c7a41dcffeOj3V52tEEd2U1P sessionID=ses_61c7a41dcffeOj3V52tEEd2U1P locking
INFO  2025-10-14T16:20:17 +44ms service=mcp key=filesystem type=local found
INFO  2025-10-14T16:20:19 +2186ms service=mcp key=chrome-devtools type=local found
INFO  2025-10-14T16:20:22 +3528ms service=mcp key=brave-search type=local found
INFO  2025-10-14T16:21:49 +86302ms service=tui offset=0 x=96 y=29 mouse
INFO  2025-10-14T16:21:49 +1ms service=tui end=-1,-1 start=96,29 mouse selection
INFO  2025-10-14T16:21:50 +1202ms service=bus type=* unsubscribing
INFO  2025-10-14T16:21:50 +0ms service=server event disconnected

Could brave-search perhaps conflict with webfetch? Tried disabling that as well but to no avail.
Thanks

Originally created by @aligg73 on GitHub (Oct 14, 2025). Originally assigned to: @thdxr on GitHub. When adding brave-search as a MCP, in opencode.json, inference halts. In other words, in a new session, the LLM (I am using GLM 4.6) is not being queried. Example config as part of opencode.json: ``` "mcp": { "brave-search": { "type": "local", "command": [ "npx", "-y", "@brave/brave-search-mcp-server", "--transport", "http" ], "enabled": true, "environment": { "BRAVE_API_KEY": "xxxxxxxx" } } ``` In the tools section, brave-search is set to true: `"brave-search": true ` Nothing in the logs I can see are out of the ordinary: ``` cat ~/.local/share/opencode/log/2025-10-14T162013.log INFO 2025-10-14T16:20:13 +72ms service=default version=0.15.2 args=[] opencode INFO 2025-10-14T16:20:13 +0ms service=project directory=/home/alex/www/prestau fromDirectory INFO 2025-10-14T16:20:13 +15ms service=config path=/home/alex/.config/opencode/config.json loading INFO 2025-10-14T16:20:13 +1ms service=config path=/home/alex/.config/opencode/opencode.json loading INFO 2025-10-14T16:20:13 +0ms service=config path=/home/alex/.config/opencode/opencode.jsonc loading INFO 2025-10-14T16:20:13 +0ms service=config path=/home/alex/www/prestau/opencode.json loading INFO 2025-10-14T16:20:13 +6ms service=bun cmd=["/home/alex/.opencode/bin/opencode","add","@opencode-ai/plugin@0.15.2","--exact"] cwd=/home/alex/.config/opencode running INFO 2025-10-14T16:20:13 +1ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin INFO 2025-10-14T16:20:13 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin INFO 2025-10-14T16:20:13 +12ms service=bus type=* subscribing INFO 2025-10-14T16:20:13 +0ms service=bus type=session.updated subscribing INFO 2025-10-14T16:20:13 +0ms service=bus type=message.updated subscribing INFO 2025-10-14T16:20:13 +0ms service=bus type=message.part.updated subscribing INFO 2025-10-14T16:20:13 +0ms service=format init INFO 2025-10-14T16:20:13 +0ms service=bus type=file.edited subscribing INFO 2025-10-14T16:20:13 +4ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers INFO 2025-10-14T16:20:13 +3ms service=models.dev file={} refreshing INFO 2025-10-14T16:20:13 +1ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca) installed @opencode-ai/plugin@0.15.2 [1.00ms] done stderr=Saved lockfile done INFO 2025-10-14T16:20:13 +4ms service=provider init INFO 2025-10-14T16:20:13 +14ms service=provider providerID=openrouter found INFO 2025-10-14T16:20:13 +0ms service=provider providerID=zai-coding-plan found INFO 2025-10-14T16:20:13 +0ms service=provider providerID=opencode found INFO 2025-10-14T16:20:13 +5ms service=default cmd=["/home/alex/.cache/opencode/tui/tui-5ne1x26y."] tui INFO 2025-10-14T16:20:13 +16ms service=server method=GET path=/path request INFO 2025-10-14T16:20:13 +1ms service=server duration=1 response INFO 2025-10-14T16:20:13 +0ms service=server method=GET path=/project/current request INFO 2025-10-14T16:20:13 +0ms service=server duration=0 response INFO 2025-10-14T16:20:13 +0ms service=server method=GET path=/agent request INFO 2025-10-14T16:20:13 +1ms service=server duration=1 response INFO 2025-10-14T16:20:13 +1ms service=server method=GET path=/config request INFO 2025-10-14T16:20:13 +0ms service=server duration=0 response INFO 2025-10-14T16:20:13 +4ms service=server method=GET path=/command request INFO 2025-10-14T16:20:13 +0ms service=server duration=0 response INFO 2025-10-14T16:20:13 +1ms service=server method=GET path=/file/status request INFO 2025-10-14T16:20:13 +2ms service=tui commands={"agent_cycle":{},"agent_cycle_reverse":{},"agent_list":{},"app_exit":{},"app_help":{},"editor_open":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_page_down":{},"messages_page_up":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_cycle_recent_reverse":{},"model_list":{},"project_init":{},"session_child_cycle":{},"session_child_cycle_reverse":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_timeline":{},"session_unshare":{},"theme_list":{},"thinking_blocks":{},"tool_details":{}} Loaded commands INFO 2025-10-14T16:20:13 +0ms service=server method=GET path=/tui/control/next request INFO 2025-10-14T16:20:13 +0ms service=server method=GET path=/event request INFO 2025-10-14T16:20:13 +0ms service=server event connected INFO 2025-10-14T16:20:13 +1ms service=bus type=* subscribing INFO 2025-10-14T16:20:13 +1ms service=server duration=2 response INFO 2025-10-14T16:20:13 +0ms service=server method=GET path=/config/providers request INFO 2025-10-14T16:20:13 +1ms service=server duration=1 response INFO 2025-10-14T16:20:13 +23ms service=server duration=28 response INFO 2025-10-14T16:20:17 +3585ms service=server method=POST path=/session request INFO 2025-10-14T16:20:17 +1ms service=session id=ses_61c7a41dcffeOj3V52tEEd2U1P version=0.15.2 projectID=571dab60f1022056cb239bc7044f6296665ab50e directory=/home/alex/www/prestau title=New session - 2025-10-14T16:20:17.059Z time={"created":1760458817059,"updated":1760458817059} created INFO 2025-10-14T16:20:17 +1ms service=bus type=session.updated publishing INFO 2025-10-14T16:20:17 +1ms service=server duration=3 response INFO 2025-10-14T16:20:17 +3ms service=server method=POST path=/session/ses_61c7a41dcffeOj3V52tEEd2U1P/message request INFO 2025-10-14T16:20:17 +3ms service=session.prompt session=ses_61c7a41dcffeOj3V52tEEd2U1P prompt INFO 2025-10-14T16:20:17 +2ms service=bus type=message.updated publishing INFO 2025-10-14T16:20:17 +1ms service=bus type=message.part.updated publishing INFO 2025-10-14T16:20:17 +1ms service=bus type=session.updated publishing INFO 2025-10-14T16:20:17 +0ms service=provider providerID=zai-coding-plan modelID=glm-4.6 getModel INFO 2025-10-14T16:20:17 +0ms service=provider status=started providerID=zai-coding-plan getSDK INFO 2025-10-14T16:20:17 +45ms service=provider status=completed duration=45 providerID=zai-coding-plan getSDK INFO 2025-10-14T16:20:17 +2ms service=provider providerID=zai-coding-plan modelID=glm-4.6 found INFO 2025-10-14T16:20:17 +0ms service=session.prompt session=ses_61c7a41dcffeOj3V52tEEd2U1P sessionID=ses_61c7a41dcffeOj3V52tEEd2U1P locking INFO 2025-10-14T16:20:17 +44ms service=mcp key=filesystem type=local found INFO 2025-10-14T16:20:19 +2186ms service=mcp key=chrome-devtools type=local found INFO 2025-10-14T16:20:22 +3528ms service=mcp key=brave-search type=local found INFO 2025-10-14T16:21:49 +86302ms service=tui offset=0 x=96 y=29 mouse INFO 2025-10-14T16:21:49 +1ms service=tui end=-1,-1 start=96,29 mouse selection INFO 2025-10-14T16:21:50 +1202ms service=bus type=* unsubscribing INFO 2025-10-14T16:21:50 +0ms service=server event disconnected ``` Could brave-search perhaps conflict with webfetch? Tried disabling that as well but to no avail. Thanks
yindo closed this issue 2026-02-16 17:34:10 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 14, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #829: MCP server failed to start (unstable MCP servers) - Reports similar hanging behavior when MCP servers fail to connect properly, with the request hanging until timeout
  • #2940: [BUG] OpenCode just hangs randomly after receiving instructions - Reports general hanging issues, though not specifically MCP-related
  • #1431: opencode hangs when trying to end it - Also MCP-related hanging issue where opencode hangs when MCPs are configured

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 14, 2025): This issue might be a duplicate of existing issues. Please check: - #829: MCP server failed to start (unstable MCP servers) - Reports similar hanging behavior when MCP servers fail to connect properly, with the request hanging until timeout - #2940: [BUG] OpenCode just hangs randomly after receiving instructions - Reports general hanging issues, though not specifically MCP-related - #1431: opencode hangs when trying to end it - Also MCP-related hanging issue where opencode hangs when MCPs are configured Feel free to ignore if none of these address your specific case.
Author
Owner

@aligg73 commented on GitHub (Oct 14, 2025):

https://github.com/sst/opencode/issues/2940

...is indeed reporting similar issues. And when removing brave-search MCP, Opencode works normally.

@aligg73 commented on GitHub (Oct 14, 2025): https://github.com/sst/opencode/issues/2940 ...is indeed reporting similar issues. And when removing brave-search MCP, Opencode works normally.
Author
Owner

@rekram1-node commented on GitHub (Oct 14, 2025):

hm some mcp servers cause hanging currently, haven't tried brave one before tho I can check it out

@rekram1-node commented on GitHub (Oct 14, 2025): hm some mcp servers cause hanging currently, haven't tried brave one before tho I can check it out
Author
Owner

@veracioux commented on GitHub (Oct 14, 2025):

@aligg73 I notice you configured "type": "local" but passed the arguments --transport http to the command. Didn't you mean --transport stdio?

@veracioux commented on GitHub (Oct 14, 2025): @aligg73 I notice you configured `"type": "local"` but passed the arguments `--transport http` to the command. Didn't you mean `--transport stdio`?
Author
Owner

@rekram1-node commented on GitHub (Oct 14, 2025):

@veracioux good catch,

also @aligg73 I can't seem to run the server even outside of opencode?

npx -y @brave/brave-search-mcp-server --transport stdio
file:///Users/aidencline/.npm/_npx/c34b0aca2a0f246a/node_modules/@brave/brave-search-mcp-server/dist/server.js:3
import pkg from '../package.json' with { type: 'json' };
                                  ^^^^

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:118:18)
    at callTranslator (node:internal/modules/esm/loader:273:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)

Node.js v20.9.0
@rekram1-node commented on GitHub (Oct 14, 2025): @veracioux good catch, also @aligg73 I can't seem to run the server even outside of opencode? ``` npx -y @brave/brave-search-mcp-server --transport stdio file:///Users/aidencline/.npm/_npx/c34b0aca2a0f246a/node_modules/@brave/brave-search-mcp-server/dist/server.js:3 import pkg from '../package.json' with { type: 'json' }; ^^^^ SyntaxError: Unexpected token 'with' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:118:18) at callTranslator (node:internal/modules/esm/loader:273:14) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30) Node.js v20.9.0 ```
Author
Owner

@aligg73 commented on GitHub (Oct 14, 2025):

@veracioux Good catch indeed, changing it to stdio did the trick, thank you.
It would be good if the app doesn't hang, but provides some sort of error.
Also, I noticed that with these mcp configurations, the responsiveness is greatly diminished. Not ideal, but not a deal-breaker either.

@rekram1-node It works for me with this command:
BRAVE_API_KEY=xxxxxx npx -y @brave/brave-search-mcp-server --transport stdio

@aligg73 commented on GitHub (Oct 14, 2025): @veracioux Good catch indeed, changing it to stdio did the trick, thank you. It would be good if the app doesn't hang, but provides some sort of error. Also, I noticed that with these mcp configurations, the responsiveness is greatly diminished. Not ideal, but not a deal-breaker either. @rekram1-node It works for me with this command: `BRAVE_API_KEY=xxxxxx npx -y @brave/brave-search-mcp-server --transport stdio`
Author
Owner

@veracioux commented on GitHub (Oct 17, 2025):

@rekram1-node I think this can be closed.

@veracioux commented on GitHub (Oct 17, 2025): @rekram1-node I think this can be closed.
Author
Owner

@BingWuJ commented on GitHub (Jan 5, 2026):

折腾了 2.5 小时,按 @veracioux 提到把 transport 改为 "stdio" 后问题解决了。现在一切正常,可以关闭这个 issue 了。谢谢大家的帮助!
这个命令对我有效:
BRAVE_API_KEY=xxxxxx npx -y @brave/brave-search-mcp-server --transport stdio

@BingWuJ commented on GitHub (Jan 5, 2026): 折腾了 2.5 小时,按 @veracioux 提到把 transport 改为 "stdio" 后问题解决了。现在一切正常,可以关闭这个 issue 了。谢谢大家的帮助! 这个命令对我有效: BRAVE_API_KEY=xxxxxx npx -y @brave/brave-search-mcp-server --transport stdio
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2105