Claude Code Plugins

Community-maintained marketplace

Feedback
0
0

This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name MCP Integration
description This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
version 0.1.0

MCP Integration for Claude Code Plugins

Overview

Model Context Protocol (MCP) enables Claude Code plugins to integrate with external services and APIs by providing structured tool access. Use MCP integration to expose external service capabilities as tools within Claude Code.

Key capabilities:

  • Connect to external services (databases, APIs, file systems)
  • Provide 10+ related tools from a single service
  • Handle OAuth and complex authentication flows
  • Bundle MCP servers with plugins for automatic setup

MCP Server Configuration Methods

Plugins can bundle MCP servers in two ways:

Method 1: Dedicated .mcp.json (Recommended)

Create .mcp.json at plugin root:

{
  "database-tools": {
    "command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
    "args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
    "env": {
      "DB_URL": "${DB_URL}"
    }
  }
}

Benefits:

  • Clear separation of concerns
  • Easier to maintain
  • Better for multiple servers

Method 2: Inline in plugin.json

Add mcpServers field to plugin.json:

{
  "name": "my-plugin",
  "version": "1.0.0",
  "mcpServers": {
    "plugin-api": {
      "command": "${CLAUDE_PLUGIN_ROOT}/servers/api-server",
      "args": ["--port", "8080"]
    }
  }
}

Benefits:

  • Single configuration file
  • Good for simple single-server plugins

MCP Server Types

stdio (Local Process)

Execute local MCP servers as child processes. Best for local tools and custom servers.

Configuration:

{
  "filesystem": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-filesystem", "/allowed/path"],
    "env": {
      "LOG_LEVEL": "debug"
    }
  }
}

Use cases:

  • File system access
  • Local database connections
  • Custom MCP servers
  • NPM-packaged MCP servers

SSE (Server-Sent Events)

Connect to hosted MCP servers with OAuth support. Best for cloud services.

Configuration:

{
  "asana": {
    "type": "sse",
    "url": "https://mcp.asana.com/sse"
  }
}

Use cases:

  • Official hosted MCP servers (Asana, GitHub, etc.)
  • Cloud services with MCP endpoints
  • OAuth-based authentication

HTTP (REST API)

Connect to RESTful MCP servers with token authentication.

Configuration:

{
  "api-service": {
    "type": "http",
    "url": "https://api.example.com/mcp",
    "headers": {
      "Authorization": "Bearer ${API_TOKEN}",
      "X-Custom-Header": "value"
    }
  }
}

WebSocket (Real-time)

Connect to WebSocket MCP servers for real-time bidirectional communication.

Configuration:

{
  "realtime-service": {
    "type": "ws",
    "url": "wss://mcp.example.com/ws",
    "headers": {
      "Authorization": "Bearer ${TOKEN}"
    }
  }
}

Environment Variable Expansion

All MCP configurations support environment variable substitution:

${CLAUDE_PLUGIN_ROOT} - Plugin directory (always use for portability):

{
  "command": "${CLAUDE_PLUGIN_ROOT}/servers/my-server"
}

User environment variables - From user's shell:

{
  "env": {
    "API_KEY": "${MY_API_KEY}",
    "DATABASE_URL": "${DB_URL}"
  }
}

MCP Tool Naming

When MCP servers provide tools, they're automatically prefixed:

Format: mcp__plugin_<plugin-name>_<server-name>__<tool-name>

Example:

  • Plugin: asana
  • Server: asana
  • Tool: create_task
  • Full name: mcp__plugin_asana_asana__asana_create_task

Using MCP Tools in Commands

Pre-allow specific MCP tools in command frontmatter:

---
allowed-tools: [
  "mcp__plugin_asana_asana__asana_create_task",
  "mcp__plugin_asana_asana__asana_search_tasks"
]
---

Security Best Practices

Use HTTPS/WSS

Always use secure connections:

"url": "https://mcp.example.com/sse"
"url": "wss://mcp.example.com/ws"

Token Management

DO:

  • Use environment variables for tokens
  • Document required env vars in README
  • Let OAuth flow handle authentication

DON'T:

  • Hardcode tokens in configuration
  • Commit tokens to git
  • Share tokens in documentation

Permission Scoping

Pre-allow only necessary MCP tools:

allowed-tools: [
  "mcp__plugin_api_server__read_data",
  "mcp__plugin_api_server__create_item"
]

Quick Reference

MCP Server Types

Type Transport Best For Auth
stdio Process Local tools, custom servers Env vars
SSE HTTP Hosted services, cloud APIs OAuth
HTTP REST API backends, token auth Tokens
ws WebSocket Real-time, streaming Tokens

Configuration Checklist

  • Server type specified (stdio/SSE/HTTP/ws)
  • Type-specific fields complete (command or url)
  • Authentication configured
  • Environment variables documented
  • HTTPS/WSS used (not HTTP/WS)
  • ${CLAUDE_PLUGIN_ROOT} used for paths

Best Practices

DO:

  • Use ${CLAUDE_PLUGIN_ROOT} for portable paths
  • Document required environment variables
  • Use secure connections (HTTPS/WSS)
  • Pre-allow specific MCP tools in commands
  • Test MCP integration before publishing
  • Handle connection and tool errors gracefully

DON'T:

  • Hardcode absolute paths
  • Commit credentials to git
  • Use HTTP instead of HTTPS
  • Pre-allow all tools with wildcards
  • Skip error handling
  • Forget to document setup

Implementation Workflow

To add MCP integration to a plugin:

  1. Choose MCP server type (stdio, SSE, HTTP, ws)
  2. Create .mcp.json at plugin root with configuration
  3. Use ${CLAUDE_PLUGIN_ROOT} for all file references
  4. Document required environment variables in README
  5. Test locally with /mcp command
  6. Pre-allow MCP tools in relevant commands
  7. Handle authentication (OAuth or tokens)
  8. Test error cases (connection failures, auth errors)
  9. Document MCP integration in plugin README

Focus on stdio for custom/local servers, SSE for hosted services with OAuth.