Added `mcp` CLI command
Summary
- Add comprehensive MCP (Model Context Protocol) server management CLI commands
- Implement mcp add-json command with intelligent transport type inference
- Support both stdio and SSE transport configurations with automatic validation
Changes
New CLI Commands
- mcp add - Add MCP servers with stdio/SSE transport options
- mcp remove - Remove configured MCP servers
- mcp list - List all configured MCP servers
- mcp get - Get details about a specific MCP server
- mcp add-json - Add MCP servers using JSON configuration with automatic type inference
Key Features
- Smart Type Inference: add-json command automatically determines local/remote type based on JSON structure
- Transport Format Transformation: Converts flexible JSON formats to match internal schema requirements
- Dual Scope Support: Configure servers at user or project level
- Transport Validation: Enforces stdio/SSE constraints and validates inputs
- Environment & Headers: Support for environment variables (stdio) and HTTP headers (SSE)
Technical Implementation
- JSON schema validation with Zod
- Automatic command/args merging for stdio transport
- Environment variable mapping (env → environment)
- Type field removal and inference from transport properties
- Comprehensive error handling and user feedback
Test Coverage
- Full test suite covering all commands and edge cases
- Validation testing for transport constraints
- Both user and project scope configuration testing
- Error handling verification
🤖 Generated with https://claude.ai/code
Co-Authored-By: Claude
wow i was gonna work on this - i'll take a look ty!
Thank you. 🙏🏻
I didn't implement the full list of sub-commands like in claude mcp because I didn't know how far you want to make it the same.
Commands I didn't implement:
-
serve -
add-from-claude-desktop -
reset-project-choices
Also Claude has "local" scope for mcp.
This sounds awesome, thanks a lot @ndraiman!
- Updated to include support for
enable/disablecommands - Fixed
mcp.testfile to use a mock local config instead of overriding the existingopencode.jsonin project root.
Hey, nice work! Do you plan to integrate /mcp commands (to TUI) next? I would love to help
Looking at the code architecture now, I see that I should have:
- Extracted logic to functions
- Exposed logic as server endpoints
- TUI will be able to control MCP configs via Client sdk
Hopefully I'll be able to this later today.
Yes. I'd love to learn how the model, view, and the functional logic are clearly seperated in the solution.
@ndraiman i don't think we need to support this in the tui, probably dont want to have to maintain all that; cli only is fine!
Any /mcp slash command in the tui would be a big welcome to figure out the state of the configured mcp servers
Hello, what current status of this feature ?