feat: add MCP server start/stop controls#428
Open
fardeenxyz wants to merge 2 commits intowinfunc:mainfrom
Open
feat: add MCP server start/stop controls#428fardeenxyz wants to merge 2 commits intowinfunc:mainfrom
fardeenxyz wants to merge 2 commits intowinfunc:mainfrom
Conversation
Add ability to start and stop Claude Code as an MCP server from the GUI. Backend changes: - Add mcp_serve() command to spawn 'claude mcp serve' process - Add mcp_stop() command to terminate running MCP serve process - Add ProcessType::McpServe to process registry with singleton pattern - Add register_mcp_serve_process() and get_running_mcp_serve() methods - Update mcp_get_server_status() to check registry for running process Frontend changes: - Add Start/Stop MCP Server buttons to MCPImportExport component - Add status polling (2s interval) to show running state - Wire onSuccess callback in MCPManager for status refresh - Fix duplicate toast notification bug The MCP server allows external tools to communicate with Claude Code via the Model Context Protocol over stdio transport.
There was a problem hiding this comment.
Pull request overview
This PR adds MCP (Model Context Protocol) server start/stop controls to Claude Code, enabling it to run as a server that other applications can connect to via stdio transport. The implementation includes backend process management with singleton enforcement, frontend UI controls with real-time status polling, and fixes for duplicate toast notifications.
Changes:
- Added
mcp_serve()andmcp_stop()backend commands with singleton pattern enforcement - Implemented
ProcessType::McpServein the process registry with PID-based tracking - Added Start/Stop MCP Server buttons with 2-second status polling in the UI
- Fixed duplicate toast notification bug in import functionality
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src-tauri/src/commands/mcp.rs | Added mcp_serve() and mcp_stop() commands, updated mcp_get_server_status() to check registry |
| src-tauri/src/process/registry.rs | Added McpServe process type, register_mcp_serve_process() and get_running_mcp_serve() methods |
| src-tauri/src/main.rs | Registered mcp_stop command handler |
| src/lib/api.ts | Added mcpStop() API method |
| src/components/MCPImportExport.tsx | Added status polling, start/stop buttons, fixed duplicate toast notifications |
| src/components/MCPManager.tsx | Wired onSuccess callback for status refresh |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Make singleton enforcement atomic by checking for existing MCP server inside the register_mcp_serve_process() lock. This prevents two concurrent start commands from both passing the check and spawning duplicate processes. Additional improvements: - Use std::mem::forget() to document intentional process detachment - Kill spawned process if registration fails (cleanup on race loss) - Move singleton check comment from caller to enforcement point
marlon-costa-dc
pushed a commit
to marlon-costa-dc/opcode
that referenced
this pull request
Jan 25, 2026
Resolves conflicts by combining: - Filesystem agent source detection from PR winfunc#397 - MCP server start/stop controls from PR winfunc#428 - i18n translations from PR winfunc#424
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backend Changes
mcp_serve()command to spawnclaude mcp serveprocessmcp_stop()command to terminate running MCP serve processProcessType::McpServeto process registry with singleton enforcementregister_mcp_serve_process()andget_running_mcp_serve()methodsmcp_get_server_status()to check registry for running processFrontend Changes
onSuccesscallback in MCPManager for status refreshWhy
The MCP server allows external tools to communicate with Claude Code via the Model Context Protocol over stdio transport. This enables integrations with other AI tools and IDEs.
Testing