OpenClaw MCP Servers Guide: Model Context Protocol Integration
Learn about MCP (Model Context Protocol) servers in OpenClaw. What is MCP, how to connect servers, available servers, and building custom MCP servers.
Quick Answer
MCP (Model Context Protocol) servers give OpenClaw access to external tools and APIs. Connect servers for GitHub, databases, Notion, Slack, and more to extend what your assistant can do.
OpenClaw’s power comes from its ability to connect to external tools and services. While skills extend OpenClaw’s capabilities, MCP (Model Context Protocol) servers provide a standardized way to connect to external APIs, databases, and services. This guide covers everything about MCP servers in OpenClaw.
What Is MCP?
MCP (Model Context Protocol) is a protocol that allows AI assistants to securely connect to external tools and data sources. Think of MCP servers as bridges between OpenClaw and external services.
Without MCP:
- OpenClaw can only use built-in capabilities
- External integrations require custom code
- Each integration is unique and complex
With MCP:
- Standardized way to connect external tools
- Reusable servers for common services
- Easy to add new capabilities
- Secure and well-defined interface
Why MCP Matters
MCP servers enable OpenClaw to:
- Access external APIs (GitHub, Notion, Slack, etc.)
- Query databases (PostgreSQL, MySQL, MongoDB)
- Interact with services (email, calendar, cloud storage)
- Extend capabilities without modifying core code
- Share integrations across the community
Instead of building custom integrations for each service, you can use (or create) MCP servers that follow a standard protocol.
How MCP Works
Architecture
MCP follows a client-server model:
- OpenClaw = MCP Client (requests actions)
- MCP Server = Service connector (executes actions)
- Protocol = Standardized communication
When you ask OpenClaw to do something that requires an external service, OpenClaw:
- Identifies which MCP server can handle the request
- Sends a request to that server
- Server executes the action (API call, database query, etc.)
- Server returns results to OpenClaw
- OpenClaw presents results to you
Connection Types
MCP servers can connect via:
- stdio: Standard input/output (local servers)
- HTTP: REST API endpoints
- WebSocket: Real-time connections
- SSH: Remote server connections
Most MCP servers use stdio for local connections, which is simple and secure.
Available MCP Servers
The MCP ecosystem includes servers for many popular services:
Development Tools
GitHub MCP Server
- Access repositories
- Create issues and pull requests
- Manage code
- Review changes
GitLab MCP Server
- Similar to GitHub
- GitLab-specific features
- CI/CD integration
Jira MCP Server
- Manage tickets
- Track projects
- Update issues
Productivity Tools
Notion MCP Server
- Read and write pages
- Query databases
- Manage content
- Sync data
Slack MCP Server
- Send messages
- Read channels
- Manage workspace
- Handle notifications
Google Workspace MCP Server
- Gmail access
- Calendar management
- Drive integration
- Docs and Sheets
Data Sources
PostgreSQL MCP Server
- Query databases
- Execute SQL
- Manage schemas
- Data analysis
MySQL MCP Server
- Database queries
- Table management
- Data operations
MongoDB MCP Server
- Document queries
- Collection management
- Aggregation pipelines
Cloud Services
AWS MCP Server
- EC2 management
- S3 operations
- Lambda functions
- CloudWatch metrics
Google Cloud MCP Server
- Compute Engine
- Cloud Storage
- BigQuery
- Cloud Functions
Installing MCP Servers
Method 1: Built-in Servers
Some MCP servers come with OpenClaw or are easily installable:
openclaw mcp install github
openclaw mcp install notion
openclaw mcp install postgres
Method 2: Manual Installation
- Install the MCP server (usually via npm or package manager)
- Configure OpenClaw to use it
- Add credentials (API keys, tokens, etc.)
- Test connection
Example configuration in ~/.openclaw/config.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "your-token-here"
}
},
"notion": {
"command": "node",
"args": ["/path/to/notion-mcp-server"],
"env": {
"NOTION_API_KEY": "your-key-here"
}
}
}
}
Method 3: Community Servers
Browse the MCP server directory for community-maintained servers:
- GitHub:
github.com/modelcontextprotocol/servers - Community contributions
- Custom servers
Using MCP Servers
Once installed, MCP servers are available automatically. OpenClaw knows what capabilities each server provides and uses them when appropriate.
Example: GitHub Integration
You: "Create a new issue in my openclaw project titled 'Add feature X'"
OpenClaw: [Uses GitHub MCP server to create issue]
OpenClaw:
- Identifies GitHub MCP server can handle this
- Connects to GitHub API via MCP server
- Creates the issue
- Confirms creation
Example: Database Query
You: "Query my PostgreSQL database and show me all users created this month"
OpenClaw: [Uses PostgreSQL MCP server to query database]
OpenClaw:
- Uses PostgreSQL MCP server
- Executes SQL query
- Formats results
- Presents data
Example: Notion Integration
You: "Add a new page to my Notion workspace with today's meeting notes"
OpenClaw: [Uses Notion MCP server to create page]
Building Custom MCP Servers
You can build custom MCP servers for services that don’t have one yet.
MCP Server Structure
An MCP server is a program that:
- Listens for MCP protocol messages
- Executes actions (API calls, queries, etc.)
- Returns results in MCP format
- Handles errors gracefully
Simple MCP Server Example
Here’s a minimal MCP server in Node.js:
#!/usr/bin/env node
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new Server({
name: 'my-custom-server',
version: '1.0.0',
}, {
capabilities: {
tools: {},
},
});
// Define a tool
server.setRequestHandler('tools/list', async () => ({
tools: [{
name: 'custom_action',
description: 'Performs a custom action',
inputSchema: {
type: 'object',
properties: {
param: {
type: 'string',
description: 'A parameter',
},
},
},
}],
}));
// Handle tool execution
server.setRequestHandler('tools/call', async (request) => {
const { name, arguments: args } = request.params;
if (name === 'custom_action') {
// Perform your custom action here
const result = await performCustomAction(args.param);
return {
content: [{
type: 'text',
text: JSON.stringify(result),
}],
};
}
throw new Error(`Unknown tool: ${name}`);
});
// Start server
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
console.error('MCP server running');
}
main().catch(console.error);
MCP Server Best Practices
- Follow the protocol: Implement MCP specification correctly
- Handle errors: Return clear error messages
- Validate input: Check parameters before execution
- Document tools: Provide clear descriptions
- Secure credentials: Store API keys securely
- Test thoroughly: Ensure reliability
MCP vs Skills
You might wonder: when to use MCP servers vs skills?
Use MCP Servers when:
- Connecting to external APIs/services
- Need standardized protocol
- Want reusable integrations
- Building for community use
Use Skills when:
- Creating custom workflows
- Combining multiple capabilities
- Need OpenClaw-specific logic
- Building user-facing features
Often, skills use MCP servers under the hood. For example, an email skill might use a Gmail MCP server to access email.
Security Considerations
Credential Management
MCP servers need credentials (API keys, tokens, etc.):
- Store securely in environment variables
- Never commit to version control
- Use OpenClaw’s credential management
- Rotate credentials regularly
Access Control
Control what MCP servers can do:
- Review server capabilities
- Limit permissions when possible
- Monitor server usage
- Audit server actions
Network Security
For remote MCP servers:
- Use HTTPS/WSS connections
- Verify server certificates
- Use authentication
- Monitor network traffic
Troubleshooting
Server Not Connecting
- Check server is installed:
openclaw mcp list - Verify configuration in
~/.openclaw/config.json - Check credentials are correct
- Review logs:
openclaw logs
Server Errors
- Check server logs for errors
- Verify API credentials are valid
- Test server independently
- Check MCP protocol version compatibility
Performance Issues
- Monitor server response times
- Check for rate limiting
- Optimize queries/requests
- Consider caching
Popular Use Cases
Development Workflow
Connect GitHub MCP server to:
- Create issues from chat
- Review pull requests
- Manage repositories
- Track projects
Data Analysis
Connect database MCP servers to:
- Query data naturally
- Generate reports
- Analyze trends
- Export data
Productivity
Connect Notion/Slack MCP servers to:
- Manage workspace from chat
- Sync information
- Automate workflows
- Coordinate teams
Next Steps
Now that you understand MCP servers:
- Browse available servers: Find servers for services you use
- Install a server: Try GitHub or Notion MCP server
- Use in conversations: Ask OpenClaw to use MCP capabilities
- Build custom server: Create one for a service you need
- Share with community: Contribute your servers
For more information:
- OpenClaw Skills Guide - How skills use MCP servers
- OpenClaw Browser Control - Alternative to MCP for web automation
- Installation Guide - Setting up OpenClaw
- Integrations - Available integrations
- FAQ - Common questions
MCP servers extend OpenClaw’s capabilities in powerful ways. Start connecting external tools today and unlock new possibilities for your AI assistant.
Need help?
Join the OpenClaw community on Discord for support, tips, and shared skills.
Join Discord →