OpenClaw ships with a solid set of built-in tools. But at some point, you will want it to connect to your GitHub repos, query your database, send messages to Slack, or read files from your NAS. That is where MCP servers come in.
What is MCP?
The Model Context Protocol is an open standard created by Anthropic. It gives AI agents a consistent way to discover and call external tools. Instead of writing custom integrations for every service, developers can build MCP servers that expose their tools in a standardized format.
Think of MCP servers like USB ports for your AI agent. You do not need a different cable for every device. One protocol, many possibilities.
Installing MCP Servers
The most common way to add an MCP server is through npm. For example, to connect to GitHub:
npm install -g @modelcontextprotocol/server-githubFor Python-based servers, use pip instead:
pip install mcp-server-githubSome services offer ClawHub skills that wrap the MCP setup. These are usually the easiest to install since the skill handles configuration for you:
npx clawhub@latest install dbalve/fast-ioConfiguring OpenClaw
After installing an MCP server, you need to tell OpenClaw where to find it. Open your `openclaw.json` file (typically in `~/.openclaw/`) and add an `mcpServers` block:
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
}
}
}Restart your gateway with `openclaw gateway restart` to load the new configuration.
Authentication Best Practices
Never hardcode tokens or API keys in your configuration. Instead, use environment variables:
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": {
"fromEnv": "GITHUB_TOKEN"
}
}Set the environment variable before starting OpenClaw, or add it to your shell profile. This keeps your secrets out of configuration files that might get committed to version control.
Using MCP Tools in Conversations
Once configured, you interact with MCP tools using natural language. Instead of remembering specific commands, you just tell OpenClaw what you need:
- "Create a new issue on the backend repo titled Deployment Checklist"
- "Search our database for customers who signed up this week"
- "Send a message to the #deployments channel about the new release"
OpenClaw handles the translation to MCP calls and returns the results in plain language.
OpenClaw as an MCP Server
You can also flip the relationship. OpenClaw can act as an MCP server that exposes your configured channels and tools to other MCP clients. This is useful when you want Claude Code or other MCP-compatible tools to interact with your OpenClaw workflows.
Run `openclaw mcp serve` to start OpenClaw in server mode. The command outputs connection details that you can use in your MCP client configuration.
FAQ
What is the Model Context Protocol (MCP)?
MCP is an open standard developed by Anthropic that lets AI agents connect to external tools and data sources through a unified interface. It uses JSON-RPC 2.0 to communicate, making it easy to extend your agent's capabilities.
How do I install an MCP server for OpenClaw?
Most MCP servers can be installed via npm: `npm install -g @modelcontextprotocol/server-github`. For some services like Fast.io, you can use ClawHub skills: `npx clawhub@latest install dbalve/fast-io`. After installing, configure the server in your `openclaw.json` file.
What MCP servers work with OpenClaw?
OpenClaw supports any MCP server that follows the standard specification. Popular options include GitHub, PostgreSQL, Slack, Notion, filesystem access, and custom servers. The ecosystem is growing rapidly with new integrations released regularly.
Do I need authentication for MCP servers?
Yes, most MCP servers require authentication. For GitHub, you need a Personal Access Token with appropriate scopes. For cloud services, you typically need API keys or OAuth tokens. Store these securely in your `openclaw.json` environment variables, never in plain text.
Can OpenClaw act as an MCP server itself?
Yes! OpenClaw can serve as an MCP server for external clients. Use `openclaw mcp serve` to expose your OpenClaw-backed channel conversations to MCP clients like Claude Code, allowing them to interact directly with your configured channels.
Popular MCP Server Options
The MCP ecosystem is growing quickly. Some well-maintained options include:
- GitHub - Issues, PRs, repository management, code search
- PostgreSQL - Direct SQL queries from natural language
- Filesystem - Read, write, and manage files on your server
- Slack - Send messages and search archives
- Google Workspace - Docs, Sheets, Calendar integration
- Notion - Read and write database entries and pages
Need help from people who already use this stuff?
Building something cool with MCP servers?
Share your setup in the community and help others get connected.