The Role and Configuration of the MCP Protocol in a Three-Layer Agent Framework
TopicsMCPAgentOpenClawClaude Code
The Role of MCP in the Three Layers
| Layer | MCP Role | Description |
|---|---|---|
| Hermes Agent | ❌ Not involved | Communications and background layer, no need to directly operate on files or tools |
| OpenClaw | ✅ MCP Client | Orchestration layer: manages CC's MCP servers and bridges them for CC |
| Claude Code | ✅ MCP execution layer | Multiple 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 Instance | Allowed Directories | Allowed 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.