Skip to content

feat(desktop): add MCP server setup and connection testing - #43719

Open
sentryshub wants to merge 5 commits into
anomalyco:devfrom
sentryshub:feat/desktop-mcp-settings
Open

feat(desktop): add MCP server setup and connection testing#43719
sentryshub wants to merge 5 commits into
anomalyco:devfrom
sentryshub:feat/desktop-mcp-settings

Conversation

@sentryshub

@sentryshub sentryshub commented Aug 20, 2026

Copy link
Copy Markdown

Implements #40335

Issue for this PR

Closes #40335

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 failed status = not
    reachable; needs_auth/needs_client_registration still count as reachable),
    auth status reuses the same token/expiry check as getAuthStatus, and tools
    come from the normal catalog discovery.
  • save/remove persist to the global config via a new
    Config.updateGlobalMcp, which uses jsonc-parser modify on mcp.<name>
    the same write path as opencode mcp add, so the CLI and Desktop stay
    consistent and comments/formatting are preserved. Both also update the running
    instance so status reflects immediately.
  • New endpoints on the instance HTTP API: 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_auth
get 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 typecheck and bun run --cwd packages/app typecheck both pass.
  • Added HTTP API tests for the new endpoints in test/server/httpapi-mcp.test.ts
    (test-without-persist, save+remove, not-found on remove); full file passes 8/8.
  • Regenerated the SDK with bun run --cwd packages/sdk/js build (runs bun dev generate) and confirmed the app still typechecks against it.

Screenshots / recordings

Screenshot 2026-08-20 at 1 38 48 PM

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@sentryshub

Copy link
Copy Markdown
Author

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.

no - these PRs are not related

@sentryshub

Copy link
Copy Markdown
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add MCP server setup and connection testing to Desktop

1 participant