mcp-integration
MCP Integration for Claude Code Plugins
Model Context Protocol (MCP) enables Claude Code plugins to expose external service capabilities as tools. Use this skill when adding MCP server configuration to a plugin, choosing transport types, or debugging MCP tool discovery.
MCP Skill Routing
flowchart TD
Start(["MCP-related task"]) --> Q1{What do you need?}
Q1 -->|"Build a new FastMCP server<br>from scratch in Python"| FastMCP["Use /fastmcp-creator"]
Q1 -->|"Write a CLI client that<br>talks to an MCP server"| ClientCLI["Use /fastmcp-client-cli"]
Q1 -->|"Run, inspect, or debug<br>an MCP server from terminal"| MCPCLI["Use /mcp-cli"]
Q1 -->|"Write pytest tests for<br>FastMCP server tools"| Tests["Use /fastmcp-python-tests"]
Q1 -->|"General Python development<br>for MCP server code"| PyDev["Use /python3-development"]
Q1 -->|"Configure an MCP server<br>inside a Claude Code plugin"| ThisSkill["Continue with this skill"]
For building FastMCP servers from scratch, use /fastmcp-creator. For writing CLI clients that communicate with MCP servers, use /fastmcp-client-cli. For terminal-based MCP server inspection and debugging, use /mcp-cli. For writing pytest test suites for FastMCP tools, use /fastmcp-python-tests. For general Python development of MCP server code, use /python3-development.
Configuration Methods
Plugins bundle MCP servers via one of two methods.
flowchart TD
Q{"How many MCP servers<br>does the plugin need?"}
Q -->|"One server, simple setup"| Inline["Inline in plugin.json<br>Add mcpServers field"]
Q -->|"Multiple servers or<br>complex configuration"| Dedicated["Dedicated .mcp.json<br>at plugin root"]
Dedicated --> Benefit1["Separation of concerns<br>Easier maintenance<br>Clear ownership"]
Inline --> Benefit2["Single config file<br>Good for minimal plugins"]
Dedicated .mcp.json (Recommended)
Create .mcp.json at the plugin root directory. Each top-level key is a server name.
{
"database-tools": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
"env": {
"DB_URL": "${DB_URL}"
}
}
}
Inline in plugin.json
Add an mcpServers field to the existing plugin.json.
{
"name": "my-plugin",
"version": "1.0.0",
"mcpServers": {
"plugin-api": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/api-server",
"args": ["--port", "8080"]
}
}
}
Server Types
flowchart TD
Q{"Where does the<br>MCP server run?"}
Q -->|"Local process<br>you control"| STDIO["stdio — spawns child process<br>Communicates via stdin/stdout<br>Claude Code manages lifecycle"]
Q -->|"Hosted cloud service<br>with OAuth"| SSE["SSE — Server-Sent Events<br>OAuth handled automatically<br>No local install needed"]
Q -->|"REST API backend<br>with token auth"| HTTP["HTTP — RESTful endpoint<br>Token-based authentication<br>Stateless interactions"]
Q -->|"Real-time bidirectional<br>streaming needed"| WS["WebSocket — persistent connection<br>Low-latency push notifications<br>ws or wss protocol"]
For detailed configuration examples, type-specific fields, and advanced options for each server type, read Server Types Reference.
Environment Variable Expansion
All MCP configurations support variable substitution.
${CLAUDE_PLUGIN_ROOT} resolves to the plugin's installed directory. Always use this for paths to bundled scripts and configs — never hardcode absolute paths.
{
"command": "${CLAUDE_PLUGIN_ROOT}/servers/my-server",
"env": {
"API_KEY": "${MY_API_KEY}",
"DATABASE_URL": "${DB_URL}"
}
}
User environment variables (from the user's shell) are available in the env block. Document all required environment variables in the plugin README.
Tool Naming Convention
MCP tools are automatically prefixed when registered.
Format: mcp__plugin_<plugin-name>_<server-name>__<tool-name>
Example with plugin asana, server asana, tool create_task:
mcp__plugin_asana_asana__asana_create_task
Pre-allow specific MCP tools in skill or command frontmatter:
allowed-tools: mcp__plugin_asana_asana__asana_create_task, mcp__plugin_asana_asana__asana_search_tasks
Avoid wildcard patterns (mcp__plugin_asana_asana__*) — pre-allow specific tools for security.
Authentication Patterns
flowchart TD
Q{"Authentication<br>method?"}
Q -->|"Cloud service<br>user authorizes in browser"| OAuth["OAuth — automatic<br>SSE or HTTP type<br>No config needed beyond URL<br>User prompted on first use"]
Q -->|"API key or<br>bearer token"| Token["Token-based — headers block<br>Use env vars, never hardcode<br>Document required vars in README"]
Q -->|"Local process<br>no external auth"| EnvVar["Environment variables<br>Pass config via env block<br>Credentials stay in user shell"]
OAuth example (SSE):
{
"type": "sse",
"url": "https://mcp.example.com/sse"
}
Token example (HTTP):
{
"type": "http",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${API_TOKEN}"
}
}
Lifecycle and Testing
MCP servers start when the plugin loads. Connection is established before first tool use.
Lifecycle sequence: plugin loads, MCP configuration parsed, server process started (stdio) or connection established (SSE/HTTP/WS), tools discovered and registered, tools available as mcp__plugin_....
Testing Workflow
- Configure MCP server in
.mcp.json - Install plugin locally or use
claude --plugin-dir ./my-plugin - Run
/mcpto verify the server appears - Test tool calls from skills or commands
- Use
claude --debugto inspect connection attempts, tool discovery, and errors
Debugging Common Issues
Server not connecting — verify URL, confirm server process is running (stdio), check network connectivity, review auth config.
Tools not available — verify server connected via /mcp, check tool names match exactly (including prefix), restart Claude Code after config changes.
Authentication failing — clear cached OAuth tokens and re-authenticate, verify environment variables are set, check token scopes and permissions.
Security Checklist
- Use HTTPS/WSS for all remote connections — never HTTP/WS
- Store tokens in environment variables — never hardcode in config
- Pre-allow specific MCP tools — avoid wildcard
__*patterns - Document all required environment variables in the plugin README
- Test authentication flows during development, not after publishing
Additional Resources
For complete server type configurations (stdio, SSE, HTTP, WebSocket) with full examples, integration patterns (tool wrappers, autonomous agents, multi-server plugins), and performance considerations, read Server Types and Patterns Reference.
SOURCE: Adapted from Anthropic plugin-dev mcp-integration skill (../claude-plugins-official/plugins/plugin-dev/skills/mcp-integration/SKILL.md). Tool naming format and environment variable expansion per Claude Code plugin documentation.
More from jamie-bitflight/claude_skills
perl-lint
This skill should be used when the user asks to lint Perl code, run perlcritic, check Perl style, format Perl code, run perltidy, or mentions Perl Critic policies, code formatting, or style checking.
24brainstorming-skill
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or when users request help with ideation, marketing, and strategic planning. Explores user intent, requirements, and design before implementation using 30+ research-validated prompt patterns.
11design-anti-patterns
Enforce anti-AI UI design rules based on the Uncodixfy methodology. Use when generating HTML, CSS, React, Vue, Svelte, or any frontend UI code. Prevents "Codex UI" — the generic AI aesthetic of soft gradients, floating panels, oversized rounded corners, glassmorphism, hero sections in dashboards, and decorative copy. Applies constraints from Linear/Raycast/Stripe/GitHub design philosophy: functional, honest, human-designed interfaces. Triggers on: UI generation, dashboard building, frontend component creation, CSS styling, landing page design, or any task producing visual interface code.
7python3-review
Comprehensive Python code review checking patterns, types, security, and performance. Use when reviewing Python code for quality issues, when auditing code before merge, or when assessing technical debt in a Python codebase.
7hooks-guide
Cross-platform hooks reference for AI coding assistants — Claude Code, GitHub Copilot, Cursor, Windsurf, Amp. Covers hook authoring in Node.js CJS and Python, per-platform event schemas, inline-agent hooks and MCP in agent frontmatter, common JSON I/O, exit codes, best practices, and a fetch script to refresh docs from official sources. Use when writing, reviewing, or debugging hooks for any AI assistant.
7agent-creator
Create high-quality Claude Code agents from scratch or by adapting existing agents as templates. Use when the user wants to create a new agent, modify agent configurations, build specialized subagents, or design agent architectures. Guides through requirements gathering, template selection, and agent file generation following Anthropic best practices (v2.1.63+).
6