Add MCP server configuration support for agent tools#2
Merged
Conversation
added 2 commits
April 5, 2026 12:17
Allow LLM agents to access MCP (Model Context Protocol) servers configured either per-repo (.mcp.json, discovered natively by Claude) or via sucoder's config.yaml (mcp_servers key at global or per-mirror level). Config-level servers are written to .sucoder-mcp.json in the mirror and passed via --mcp-config flag. - Add McpServerConfig dataclass and mcp_servers field to MirrorSettings/Config - Add mcp_config flag template to AgentFlagTemplates and Claude profile - Add _resolve_mcp_config() to generate .sucoder-mcp.json with git exclude - Add _parse_mcp_servers() for YAML config parsing with validation - Add comprehensive tests for config parsing and mirror integration https://claude.ai/code/session_01A6XWH93fYXRoUycoR5EvpU
Ship a .mcp.json so CLI-launched agents get GitHub access, web fetch, and persistent memory — capabilities the web UI provides automatically but the CLI does not. The file is marked for git-crypt encryption (.gitattributes) since it will contain a GITHUB_TOKEN. - Add .mcp.json with three MCP servers (github, fetch, memory) - Add .gitattributes marking .mcp.json for git-crypt - Update README.org: add MCP section with setup instructions, add mcp_config row to flag template table, add git-crypt and node/npx to requirements https://claude.ai/code/session_01A6XWH93fYXRoUycoR5EvpU
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
This PR adds support for configuring Model Context Protocol (MCP) servers in sucoder, enabling agents to access external tools and services like GitHub, web fetching, and databases. MCP servers can be defined globally or per-mirror in the configuration and are passed to the agent via a generated
.sucoder-mcp.jsonfile.Key Changes
McpServerConfigdataclass inconfig.pyto represent individual MCP server definitions with command, args, and environment variablesmcp_serversat both global and per-mirror levels, with per-mirror settings overriding global defaults (matching the pattern used for skills)mcp_config) added toAgentFlagTemplateswith Claude profile defaulting to--mcp-config {path}mirror.pyvia_resolve_mcp_config()method that:.sucoder-mcp.jsonin the mirror with proper MCP server format--mcp-configflag when MCP servers are configuredmcp_configin the three-level merge (per-mirror > global > profile).mcp.jsonwith three default servers (github, fetch, memory) encrypted with git-crypt for token securityImplementation Details
.sucoder-mcp.jsonomits emptyenvobjects to keep the file clean_resolve_mcp_config()is called multiple times.mcp.jsonfile is encrypted with git-crypt to protect sensitive tokens likeGITHUB_TOKENhttps://claude.ai/code/session_01A6XWH93fYXRoUycoR5EvpU