How to Use OpenClaw with MCP Servers — Tool Integration
Extend OpenClaw with Model Context Protocol (MCP) servers. Add custom tools, connect to external APIs, and build specialized capabilities for your agent.
MCP (Model Context Protocol) is how OpenClaw's tool ecosystem works under the hood. Understanding it lets you extend your agent with virtually any capability. Here's the practical guide.
What MCP Does
MCP servers expose tools and resources to your agent. Think of them as plugins — each server adds a set of things your agent can do. The agent automatically discovers what tools are available and uses them when relevant.
Connecting an MCP Server
openclaw mcp add github --path node
# Or for a remote server:
openclaw mcp add custom-api --url https://your-mcp-server.comCommon MCP Servers
File system access:
openclaw mcp add filesystem --path node --args "--root /path/to/allow"Web search:
openclaw mcp add brave-search --env BRAVE_API_KEY=YOUR_KEYDatabase access:
openclaw mcp add sqlite --args "/path/to/database.db"Building a Custom MCP Server
If you have an internal API, write a simple MCP server:
// my-custom-mcp.js
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
const server = new Server({ name: 'my-api', version: '1.0.0' });
server.setRequestHandler('tools/list', async () => ({
tools: [{
name: 'get_customer',
description: 'Get customer data from internal CRM',
inputSchema: {
type: 'object',
properties: { email: { type: 'string' } },
required: ['email']
}
}]
}));
server.setRequestHandler('tools/call', async (request) => {
if (request.params.name === 'get_customer') {
const customer = await yourCRM.getCustomer(request.params.arguments.email);
return { content: [{ type: 'text', text: JSON.stringify(customer) }] };
}
});openclaw mcp add my-api --path node --args "my-custom-mcp.js"Listing Active MCP Servers
openclaw mcp list
# Shows: server name | status | tools availableDebugging MCP Issues
openclaw mcp logs github --last 20
# Common issue: server crashes on startup
# Check: correct path, dependencies installed, env vars setThe OpenClaw Playbook has an advanced MCP chapter covering tool design patterns, how to build MCP servers that work well with LLM agents, and a library of community MCP servers worth installing.
Frequently Asked Questions
What is MCP and why does it matter for OpenClaw?
MCP (Model Context Protocol) is Anthropic's standard for connecting AI agents to external tools and data sources. It lets you extend OpenClaw with custom capabilities without modifying the core agent.
Can I write my own MCP server for OpenClaw?
Yes. MCP servers are standard Node.js or Python programs. If you have a custom API or internal tool, you can wrap it in an MCP server and your OpenClaw agent gains access to it as a native tool.
Are there pre-built MCP servers I can use?
Yes. The MCP ecosystem has servers for GitHub, Slack, Notion, databases, web search, and many more. Check the official MCP registry and the community repositories on GitHub.
Does MCP affect OpenClaw's performance?
MCP tools add a small overhead per tool call (usually 10-50ms). For most use cases this is negligible. Very high-frequency tool calls might benefit from native OpenClaw integrations instead.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.