MCP Integrations
Relevant source files
The following files were used as context for generating this wiki page:
- cli-tool/components/mcps/
- cli-tool/components/agents/development-tools/mcp-expert.md
- cli-tool/components/skills/development/mcp-integration/SKILL.md
- cli-tool/components/skills/development/mcp-builder/SKILL.md
- cli-tool/components/skills/development/mcp-integration/references/tool-usage.md
- cli-tool/components/agents/mcp-dev-team/mcp-developer.md
Introduction
Model Context Protocol (MCP) integrations enable Claude Code to connect with external services, databases, and APIs through a standardized protocol. Within this project, MCP serves as the bridge that allows AI agents to interact with real-world data and tools, extending the capabilities of the CLI beyond static text processing. These integrations allow for the exposure of specific service capabilities as executable tools that Claude can invoke autonomously or under user direction.
The system supports multiple transport mechanisms including local child processes (stdio) and remote connections (SSE, HTTP, and WebSocket). By using specialized agents like the mcp-expert and mcp-developer, the project provides a structured framework for building, configuring, and deploying these servers to enhance developer productivity.
Sources: cli-tool/components/skills/development/mcp-integration/SKILL.md, cli-tool/components/agents/development-tools/mcp-expert.md
Architecture and Transport Types
The MCP integration architecture is designed to be transport-agnostic, supporting four primary communication methods to accommodate different service environments.
Transport Mechanisms
| Type | Transport | Description | Best For |
|---|---|---|---|
| stdio | Local Process | Executes local MCP servers as child processes communicating via stdin/stdout. | Local tools, file system access, and custom servers. |
| SSE | HTTP | Server-Sent Events for connected hosted MCP servers with OAuth support. | Cloud services (e.g., GitHub, Asana) and official hosted servers. |
| HTTP | REST API | Connects to RESTful MCP servers using token-based authentication. | Stateless interactions and custom API backends. |
| ws | WebSocket | Real-time bidirectional communication for persistent connections. | Low-latency requirements and real-time data streaming. |
Sources: cli-tool/components/skills/development/mcp-integration/SKILL.md:43-118
Lifecycle Management
MCP servers follow a managed lifecycle where the connection is established before the first tool use. Servers started via stdio are spawned by Claude Code and terminated automatically upon exit.
The diagram shows the sequence from plugin loading to tool registration.
Sources: cli-tool/components/skills/development/mcp-integration/SKILL.md:144-159
Configuration and Integration
MCP servers are integrated into the CLI tool through JSON configuration files. These configurations define how the CLI should initiate the server, including the command, arguments, and required environment variables.
Configuration Methods
- Dedicated .mcp.json (Recommended): Located at the plugin root for clear separation of concerns.
- Inline plugin.json: Using the
mcpServersfield for simple, single-server plugins.
Standard Configuration Format
{
"mcpServers": {
"ServiceName MCP": {
"command": "npx",
"args": ["-y", "package-name@latest", "additional-args"],
"env": {
"API_KEY": "required-env-var"
}
}
}
}
Sources: cli-tool/components/agents/development-tools/mcp-expert.md:20-33, cli-tool/components/skills/development/mcp-integration/SKILL.md:21-41
Tool Usage and Naming Conventions
Once a server is connected, its tools are automatically registered using a specific namespacing convention to prevent collisions across different plugins and servers.
Naming Format
The full name of a tool follows this pattern:
mcp__plugin_<plugin-name>_<server-name>__<tool-name>
For example, a task creation tool in an Asana plugin would be named:
mcp__plugin_asana_asana__asana_create_task
Permission Scoping
To maintain security, commands must explicitly "pre-allow" the MCP tools they intend to use within their Markdown frontmatter.
---
allowed-tools: [
"mcp__plugin_asana_asana__asana_create_task"
]
---
Sources: cli-tool/components/skills/development/mcp-integration/SKILL.md:126-142, cli-tool/components/skills/development/mcp-integration/references/tool-usage.md:1-20
Development Workflow
Creating a high-quality MCP integration involves a four-phase process managed by the mcp-builder skill and mcp-developer agent.
MCP Creation Process
- Requirements Analysis: Identifying the target API, authentication (OAuth vs. Token), and rate limits.
- Implementation: Building the server logic using the Python (FastMCP) or TypeScript SDK.
- Review and Refinement: Ensuring "Actionable Error Messages" that guide the LLM toward correct usage.
- Evaluations: Creating at least 10 realistic, read-only questions in XML format to verify the server's effectiveness.
The sequence diagram illustrates the interaction between the developer, the protocol SDK, and the final tool execution.
Sources: cli-tool/components/skills/development/mcp-builder/SKILL.md:15-180, cli-tool/components/agents/mcp-dev-team/mcp-developer.md:100-140
Security and Best Practices
Security is a critical component of MCP integrations, particularly when handling external API keys and data access.
- Environment Variables: Always use
${VARIABLE}substitution for sensitive data like tokens and API keys. Never hardcode credentials in the JSON configuration. - Path Portability: Use
${CLAUDE_PLUGIN_ROOT}for local server paths to ensure the plugin works across different user environments. - Input Validation: Use Zod (TypeScript) or Pydantic (Python) to strictly validate tool arguments before processing.
- Principle of Least Privilege: Pre-allow only the specific tools a command needs rather than using wildcards (
*).
Sources: cli-tool/components/skills/development/mcp-integration/SKILL.md:200-220, cli-tool/components/agents/development-tools/mcp-expert.md:58-64
Conclusion
MCP Integrations provide a robust mechanism for extending Claude Code's reach into external ecosystems. By leveraging structured transport types and a strict naming convention, the system ensures that AI-driven tool usage is both predictable and secure. The combination of automated lifecycle management and specialized development agents allows for the rapid creation of complex integrations that remain maintainable and scalable.