skills/c0ntr0lledcha0s/building-mcp-servers/SKILL.md
Expert at integrating Model Context Protocol (MCP) servers into Claude Code plugins. Auto-invokes when the user wants to add external tool integrations, configure MCP servers, set up stdio/SSE/HTTP/WebSocket connections, or needs help with MCP authentication and security. Also auto-invokes proactively when Claude is about to write MCP configuration files (.mcp.json) or add mcpServers to plugin manifests.
npx skillsauth add aiskillstore/marketplace building-mcp-serversInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert at integrating Model Context Protocol (MCP) servers into Claude Code plugins. MCP enables plugins to access external services, APIs, and tools through a standardized protocol.
Use MCP servers when:
Use other components instead when:
Best for: Local processes, custom servers, CLI tools
{
"mcpServers": {
"my-local-server": {
"type": "stdio",
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/servers/my-server.js"],
"env": {
"API_KEY": "${MY_API_KEY}"
}
}
}
}
Use cases:
Best for: Cloud services with OAuth, hosted MCP endpoints
{
"mcpServers": {
"cloud-service": {
"type": "sse",
"url": "https://api.example.com/mcp/sse",
"headers": {
"Authorization": "Bearer ${CLOUD_API_TOKEN}"
}
}
}
}
Use cases:
Best for: REST APIs, stateless services
{
"mcpServers": {
"rest-api": {
"type": "http",
"url": "https://api.example.com/mcp",
"headers": {
"X-API-Key": "${REST_API_KEY}"
}
}
}
}
Use cases:
Best for: Real-time bidirectional communication
{
"mcpServers": {
"realtime-service": {
"type": "websocket",
"url": "wss://api.example.com/mcp/ws",
"headers": {
"Authorization": "Bearer ${WS_TOKEN}"
}
}
}
}
Use cases:
For plugins with multiple MCP servers:
plugin-name/
├── .mcp.json # MCP server configurations
├── .claude-plugin/
│ └── plugin.json
└── ...
.mcp.json format:
{
"mcpServers": {
"server-one": { ... },
"server-two": { ... }
}
}
For single-server simplicity:
{
"name": "my-plugin",
"version": "1.0.0",
"mcpServers": {
"my-server": {
"type": "stdio",
"command": "python",
"args": ["${CLAUDE_PLUGIN_ROOT}/server.py"]
}
}
}
MCP tools are automatically prefixed with the server name:
mcp__<plugin-name>_<server-name>__<tool-name>
Example:
database-toolspostgresquerymcp__database-tools_postgres__query// ❌ BAD - hardcoded secret
{
"headers": {
"Authorization": "Bearer sk-12345..."
}
}
// ✅ GOOD - environment variable
{
"headers": {
"Authorization": "Bearer ${MY_API_KEY}"
}
}
// ❌ BAD - insecure
{ "url": "http://api.example.com/mcp" }
// ✅ GOOD - secure
{ "url": "https://api.example.com/mcp" }
In your plugin's README:
## Required Environment Variables
| Variable | Description |
|----------|-------------|
| `MY_API_KEY` | API key for the service |
| `DATABASE_URL` | Connection string |
In plugin.json, specify which MCP tools should be auto-allowed:
{
"mcpServers": {
"my-server": {
"type": "stdio",
"command": "...",
"allowedTools": ["query", "list"] // Only these tools auto-allowed
}
}
}
Always use the portable path variable:
{
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/servers/main.js"]
}
Ask:
Choose the appropriate configuration method (.mcp.json or inline).
List all required secrets and how to obtain them.
Update plugin.json to reference the MCP configuration:
{
"name": "my-plugin",
"mcp": "./.mcp.json"
}
# Debug MCP connections
claude --debug
# Verify server starts
claude mcp list
This skill includes a validation script:
Usage:
python3 {baseDir}/scripts/validate-mcp.py <mcp-config-file>
What It Checks:
{
"mcpServers": {
"database": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}
{
"mcpServers": {
"cloud-api": {
"type": "http",
"url": "https://api.service.com/v1/mcp",
"headers": {
"Authorization": "Bearer ${SERVICE_API_KEY}",
"Content-Type": "application/json"
}
}
}
}
{
"mcpServers": {
"dev-server": {
"type": "stdio",
"command": "python",
"args": ["${CLAUDE_PLUGIN_ROOT}/servers/dev_server.py"],
"env": {
"DEBUG": "true"
}
}
}
}
# Enable debug mode
claude --debug
# Check MCP server status
claude mcp status
# View server logs
claude mcp logs <server-name>
| Issue | Cause | Solution | |-------|-------|----------| | Server not starting | Missing dependencies | Check command/args paths | | Auth failures | Wrong env variable | Verify ${VAR} is set | | Connection timeout | Network/firewall | Check URL accessibility | | Tool not found | Wrong naming | Check tool name matches |
{baseDir}/templates/mcp-stdio-template.json - Stdio server template{baseDir}/templates/mcp-http-template.json - HTTP server template{baseDir}/templates/mcp-config-template.json - Full .mcp.json template{baseDir}/references/mcp-security-guide.md - Security best practices{baseDir}/references/mcp-server-types.md - Detailed server type documentationWhen the user asks to add MCP integration:
Be proactive in:
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.