Agentic Research

The Role and Configuration of the MCP Protocol in a Three-Layer Agent Framework

2026/05/107 min readBryan Chan閱讀中文原文
TopicsMCPAgentOpenClawClaude Code

The Role of MCP in the Three Layers

LayerMCP RoleDescription
Hermes Agent❌ Not involvedCommunications and background layer, no need to directly operate on files or tools
OpenClaw✅ MCP ClientOrchestration layer: manages CC's MCP servers and bridges them for CC
Claude Code✅ MCP execution layerMultiple instances each with independent MCP server configuration

MCP Client in OpenClaw

As the orchestration hub, OpenClaw decides which MCP servers are assigned to which Claude Code instance.

Configuration

// ~/.openclaw/openclaw.json
{
  "mcp": {
    "servers": {
      "filesystem": {
        "command": "npx",
        "args": ["@anthropic-ai/mcp-server-filesystem", "~/projects"]
      },
      "github": {
        "command": "npx",
        "args": ["@anthropic-ai/mcp-server-github"],
        "env": {"GITHUB_TOKEN": "ghp_xxx"}
      },
      "brave-search": {
        "command": "npx",
        "args": ["@anthropic-ai/mcp-server-brave-search"],
        "env": {"BRAVE_API_KEY": "BSA-xxx"}
      }
    },
    "routing": {
      "cc-pro": ["filesystem", "github"],
      "cc-qwen": ["filesystem"],
      "cc-local": ["filesystem"]
    }
  }
}

Orchestration Logic

OpenClaw receives a task
  → Determines the task type
  → Selects a suitable CC instance
  → Assigns the corresponding MCP Server

MCP Configuration for Each Claude Code Instance

CC Pro (DeepSeek V4 Pro)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-filesystem", "~/projects"]
    },
    "github": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-github"]
    }
  }
}

CC Local (oMLX local)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-filesystem", "~/private-projects"]
    }
  }
}

Security Isolation

CC InstanceAllowed DirectoriesAllowed MCP Servers
CC Pro~/projects/filesystem, github
CC Qwen~/projects/filesystem
CC Local~/private-projects/filesystem only

The local instance has the strictest restrictions, ensuring that private code is not leaked.


Related Articles