MCP Integration Guide

Advanced Guide ยท 18 min read

โœ“Based on source code analysis

What is MCP?

Model Context Protocol (MCP) is a standardized protocol for connecting Claude Code to external services, tools, and data sources.

7 Transport Types

TransportDescriptionUse Case
stdioStandard input/outputLocal MCP servers
SSEServer-Sent EventsHTTP long connection
HTTPHTTP request/responseStateless APIs
WebSocketBidirectional WebSocketReal-time communication
SDKBuilt-in SDKAnthropic native integration
claudeai-proxyClaude.ai proxyCloud MCP bridging
IDEIDE integrationVS Code / JetBrains

7 Configuration Scopes

  1. local - Project level (.claude/mcp.json)
  2. project - Repository level (via CLAUDE.md)
  3. user - User level (~/.claude/mcp.json)
  4. plugin - Plugin-carried
  5. builtin - Built-in
  6. remote - Remote pushed
  7. managed - Enterprise managed (highest priority)

Configuration Example

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "your-token"
      }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem"],
      "env": {
        "ALLOWED_PATHS": "/Users/you/projects"
      }
    }
  }
}

MCP Client Management

Claude Code's MCP client handles:

  • Auto-connect and reconnection
  • Health checks
  • Resource indexing
  • Tool discovery and registration
  • Permission bridging

Channel Notification

MCP servers can send channel notifications to KAIROS mode:

{
  "method": "notifications/claude/channel",
  "params": {
    "content": "PR #123 needs review",
    "meta": { "source": "github" }
  }
}

SleepTool detects new messages within 1 second and wakes the agent.

LSP Integration

Claude Code also supports Language Server Protocol:

  • File extension-based routing
  • Multi-server management
  • Diagnostic integration
  • Type checking, completions, references
๐Ÿ’ก Pro Tip: MCP tools appear with prefix mcp__serverName__toolName in the tool list.