MCP — Model Context Protocol

Connect external tools and data sources via the Model Context Protocol. Clew Code supports stdio, SSE, and DirectConnect transports.

Overview

MCP (Model Context Protocol) is an open standard for connecting AI agents with external tools and data sources. Clew Code implements the full MCP specification as both a client and server.

Transport Types

TransportDescription
stdioLocal subprocess — spawns an MCP server as a child process and communicates via stdin/stdout
SSERemote servers with optional OAuth authentication via Server-Sent Events
DirectConnectIn-process plugin servers — runs MCP servers as plugins within the same process

Configuration

MCP servers are configured in .mcp.json at the project root:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "ghp_..."
      }
    },
    "remote-api": {
      "url": "https://my-mcp-server.example.com/sse",
      "auth": {
        "type": "oauth2"
      }
    }
  }
}

MCP Commands

❯ /mcp list         # list connected MCP servers and their tools
❯ /mcp add          # add a new MCP server configuration
❯ /mcp remove <id>  # remove an MCP server

CLI MCP Tools

The built-in MCP tools allow the AI to interact with connected servers:

ToolDescription
ListMcpResourcesToolList available resources from connected MCP servers
ReadMcpResourceToolRead a specific resource from an MCP server

Example MCP Servers

Browse the official MCP server repository for more.