feat(desktop): add MCP server setup and connection testing - #43719
feat(desktop): add MCP server setup and connection testing#43719sentryshub wants to merge 5 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR (excluding the current PR #43719 itself): Related PR:
The other MCP-related PRs found (#40125 on trust configuration, #42429 on WSL mode, and others) appear to address different aspects of MCP functionality rather than duplicate efforts on setup and connection testing. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
no - these PRs are not related |
|
@Brendonovich this is something we need for our mcp as well. our current instructions to setup our MCP for opencode vs other tools is unnecessarily complex. let me know if this PR makes sense |
Implements #40335
Issue for this PR
Closes #40335
Type of change
What does this PR do?
Adds an MCP settings page to the Desktop app so servers can be managed without
hand-editing the config or dropping to the CLI.
Backend (
packages/opencode):MCP.Service.test(name, config)reuses the existing connect path (create)but closes the client instead of storing it, so it never mounts the server.
It returns
{ status, reachable, authStatus, tools, instructions?, error? }.Reachability is derived from the connect result (a
failedstatus = notreachable;
needs_auth/needs_client_registrationstill count as reachable),auth status reuses the same token/expiry check as
getAuthStatus, and toolscome from the normal catalog discovery.
save/removepersist to the global config via a newConfig.updateGlobalMcp, which uses jsonc-parsermodifyonmcp.<name>—the same write path as
opencode mcp add, so the CLI and Desktop stayconsistent and comments/formatting are preserved. Both also update the running
instance so status reflects immediately.
POST /mcp/test,PUT /mcp/:name,DELETE /mcp/:name.UI (
packages/app): a new MCP tab in settings that lists configured servers,toggles enable/disable, edits/removes them, and an add/edit dialog with a Test
Connection button that shows the result inline. Servers reporting
needs_authget an Authenticate button wired to the existing OAuth flow. The v2 SDK was
regenerated from the server to expose the new endpoints.
How did you verify your code works?
bun run --cwd packages/opencode typecheckandbun run --cwd packages/app typecheckboth pass.test/server/httpapi-mcp.test.ts(test-without-persist, save+remove, not-found on remove); full file passes 8/8.
bun run --cwd packages/sdk/js build(runsbun dev generate) and confirmed the app still typechecks against it.Screenshots / recordings
Checklist