Skip to content

feat: ability to toggle MCP Servers in TUI#4509

Merged
rekram1-node merged 15 commits into
anomalyco:devfrom
dbpolito:mcp_tui
Dec 8, 2025
Merged

feat: ability to toggle MCP Servers in TUI#4509
rekram1-node merged 15 commits into
anomalyco:devfrom
dbpolito:mcp_tui

Conversation

@dbpolito

Copy link
Copy Markdown
Contributor

Related to #514

This introduces a new command /mcp which you can manage MCPs on session level, makes it possible to have MCPs disabled by default and only enabling it when you want, for example my default i have github disabled and playwright enabled

image image image image image image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an MCP (Model Context Protocol) management UI accessible via the /mcp command, allowing users to enable/disable MCP servers on a session level rather than having all configured MCPs enabled by default.

  • Adds new API endpoints for connecting and disconnecting MCP servers dynamically
  • Implements a new TUI dialog component for managing MCP server states
  • Updates the MCP status logic to distinguish between disabled, connected, and failed states

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
packages/sdk/js/src/gen/types.gen.ts Adds TypeScript type definitions for new MCP connect/disconnect API endpoints
packages/sdk/js/src/gen/sdk.gen.ts Adds SDK client methods for MCP connect and disconnect operations
packages/opencode/src/server/server.ts Implements POST endpoints for /mcp/:name/connect and /mcp/:name/disconnect
packages/opencode/src/mcp/index.ts Adds connect/disconnect functions and updates status/tools logic to handle disabled MCPs
packages/opencode/src/cli/cmd/tui/routes/home.tsx Updates MCP server count display to only show connected servers
packages/opencode/src/cli/cmd/tui/context/local.tsx Adds MCP toggle functionality and model list helper to local context
packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx Separates /mcp command from /status command aliases
packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx New dialog component for managing MCP server connections with toggle functionality
packages/opencode/src/cli/cmd/tui/app.tsx Registers the new MCP dialog command handler

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/src/mcp/index.ts Outdated
Comment thread packages/opencode/src/mcp/index.ts Outdated
Comment thread packages/opencode/src/mcp/index.ts
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx Outdated
@itse4elhaam

Copy link
Copy Markdown

This is beautiful, really needed.

Another thing, sometimes the agent is not familiar with the mcp servers it has available, I created a list-mcp tool for it to get rid of this issue, maybe something that should be there by default,

@Raviguntakala

Copy link
Copy Markdown
Contributor

This is awesome! I was actually planning to request this feature too. It will really help to manage MCPs from the UI for each session. Nice to see someone already raised a PR for it. I’m interested in this feature and hope it gets merged soon.

@rekram1-node is this feature going to be added in the next release?

@rekram1-node

Copy link
Copy Markdown
Collaborator

Yeah this one looked pretty good, can we resolve the conflicts please?

@dbpolito

Copy link
Copy Markdown
Contributor Author

@rekram1-node fixed 👍

@modelnova-ai

Copy link
Copy Markdown

@rekram1-node fixed 👍

Looks like there are conflicts again. Can you please resolve them when you get a chance?

@dbpolito

Copy link
Copy Markdown
Contributor Author

conflicts fixed

@modelnova-ai

Copy link
Copy Markdown

conflicts fixed

Thanks, One question the toggle works on Space right now. Would it be better to use Enter to enable or disable an MCP instead of Space?

@itse4elhaam

Copy link
Copy Markdown

conflicts fixed

Thanks, One question the toggle works on Space right now. Would it be better to use Enter to enable or disable an MCP instead of Space?

Space is mostly considered as an operation to "toggle" things.

IMO, space is better.

@modelnova-ai

Copy link
Copy Markdown

@rekram1-node Would really appreciate getting this merged! Managing multiple MCPs gets messy, and this toggle feature would be super helpful for reducing context bloat and improve startup time. Would be great to have this in the next release. Thanks! 🙏

@rekram1-node

Copy link
Copy Markdown
Collaborator

yeah we will merge dw

@ocombe

ocombe commented Dec 4, 2025

Copy link
Copy Markdown

That's awesome, I was just looking for this.
I have MCPs that I only use for some tasks (ex: notion MCP that I want to enable when I'm working on docs), but I don't want them to bloat the context all the time. This feature would fix that problem.

@rekram1-node

Copy link
Copy Markdown
Collaborator

Alright @dbpolito can you resolve the conflicts and then ill merge?

@rekram1-node

Copy link
Copy Markdown
Collaborator

I can't believe I commented two weeks ago, I thought I did that just a few days ago oof

- Merged upstream/dev into mcp_tui branch
- Resolved conflicts in:
  - packages/opencode/src/cli/cmd/tui/app.tsx: Combined useConnected import with DialogMcp
  - packages/opencode/src/server/server.ts: Kept both MCP connect/disconnect endpoints and new OAuth auth endpoints
  - packages/sdk/js/src/gen/sdk.gen.ts: Added all MCP SDK methods (connect, disconnect, and OAuth auth)
  - packages/sdk/js/src/gen/types.gen.ts: Added all MCP TypeScript type definitions
- All merge conflicts resolved successfully
@dbpolito

dbpolito commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

@rekram1-node hey, updated the PR... it seems format and sdk actions are conflicting with each other... i ran their scripts locally but or one or another fails...

@rekram1-node

Copy link
Copy Markdown
Collaborator

Don't worry about them they suck, Dax will fix it

@rekram1-node

Copy link
Copy Markdown
Collaborator

/review

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

lgtm

@rekram1-node

Copy link
Copy Markdown
Collaborator

Wow this is good work

@rekram1-node rekram1-node changed the title MCP Servers TUI feat: ability to toggle MCP Servers in TUI Dec 8, 2025
@rekram1-node
rekram1-node merged commit 203f331 into anomalyco:dev Dec 8, 2025
3 of 4 checks passed
github-actions Bot pushed a commit to yuguorui/opencode that referenced this pull request Jan 18, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request Jun 14, 2026
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.

7 participants