MCP Servers Explained: Connecting OpenClaw to Everything
The Model Context Protocol (MCP) is how OpenClaw connects to external services. It's API middleware designed for LLMs. Here's how I use it to integrate Gmail, GitHub, Slack, and more.
What is MCP?
MCP is a standardized protocol that lets AI agents interact with external services through servers. Instead of every tool needing custom integration code, MCP provides a common interface.
Think of it this way: REST APIs let humans (via apps) talk to services. MCP lets agents talk to services in a way optimized for AI reasoning.
Why MCP Matters
Before MCP, integrating a new service meant writing custom tool definitions, handling auth, parsing responses, and more. With MCP:
- Services expose standardized tool schemas
- Auth is handled by the MCP server
- Agents get structured responses they can reason about
- One integration works across multiple agents
MCP Architecture
[OpenClaw Agent] <-> [MCP Client] <-> [MCP Server] <-> [External Service]OpenClaw acts as the MCP client. MCP servers handle the protocol and service-specific logic. The agent doesn't need to know Gmail API specifics—it just calls tools exposed by the server.
MCP Servers I Use Daily
1. gog (Google Workspace)
The gog CLI provides Gmail, Calendar, Drive, Contacts, Sheets, and Docs access. It's not technically MCP (it predates the protocol), but it functions similarly—OpenClaw calls gog commands, gog handles OAuth and API calls.
Setup:
# Install gog
brew install steipete/tap/gogcli
# Configure credentials
gog auth credentials /path/to/client_secret.json
# Add account with required scopes
gog auth add you@gmail.com --services gmail,calendar,drive,contacts,docs,sheets
# Test
gog gmail search 'newer_than:1d' --max 5What I use it for:
- Email triage and automation
- Calendar event creation and updates
- Google Sheets as a database
- Document export and processing
2. GitHub (via gh CLI)
The gh CLI is my gateway to GitHub. PRs, issues, CI runs, releases—all accessible from the agent.
Setup:
# Install gh
brew install gh
# Authenticate
gh auth login
# Test
gh repo listKey workflows:
- PR reviews:
gh pr checks 130 --repo owner/repo - CI monitoring:
gh run list --limit 10 - Issue triage:
gh issue list --label bug
3. Slack (via Slack API)
OpenClaw's Slack integration uses the Slack Web API. Configure a bot token in openclaw.json:
{
"channels": {
"slack": {
"enabled": true,
"botToken": "xoxb-your-token"
}
}
}Common actions:
- Send messages:
slack sendMessage --to "channel:C123" --content "Deploy complete" - React:
slack react --channelId C123 --messageId 1234.5678 --emoji "✅" - Pin:
slack pinMessage --channelId C123 --messageId 1234.5678
Building Custom MCP Servers
When a service doesn't have an MCP server, you can build one. The MCP spec defines:
- Tools: Functions the agent can call
- Resources: Data the agent can read
- Prompts: Templates the agent can use
Example: Simple MCP Server Structure
{
"tools": [
{
"name": "send_email",
"description": "Send an email",
"inputSchema": {
"type": "object",
"properties": {
"to": { "type": "string" },
"subject": { "type": "string" },
"body": { "type": "string" }
},
"required": ["to", "subject", "body"]
}
}
]
}I use the mcporter skill when building MCP servers. It provides debugging tools and server management that save hours.
MCP vs Direct Tool Integration
When to use MCP:
- Service has complex auth (OAuth, API keys)
- Multiple agents need the same integration
- Service has rate limits or state management needs
- You want standardized tool schemas
When to skip MCP:
- Simple CLI tool with no auth (e.g., ffmpeg)
- One-off integration for a specific task
- Tool already has perfect CLI UX
Debugging MCP Integrations
Common issues and fixes:
1. Auth Failures
Problem: "401 Unauthorized" or "invalid token"
Fix: Re-run auth flow. For gog: gog auth add --force. For gh: gh auth refresh.
2. Tool Not Found
Problem: Agent says "I don't have a tool for that"
Fix: Check skill is loaded. Run skills list to verify.
3. Rate Limiting
Problem: "429 Too Many Requests"
Fix: Implement backoff in MCP server or use caching.
Real-World Example: Email Automation
Here's a complete workflow I run daily:
# Search for unread emails from specific sender
gog gmail messages search "is:unread from:ryanair.com" --max 20
# Extract booking reference from email body
# (Agent uses regex or LLM extraction)
# Create calendar event
gog calendar create primary \
--summary "Flight to Berlin" \
--from "2026-03-15T08:00:00Z" \
--to "2026-03-15T10:30:00Z" \
--event-color 7
# Mark email as read
gog gmail modify <messageId> --remove-label UNREADAll of this happens automatically. The agent reads the email, extracts flight details, creates the calendar event with the right color code, and marks the email as processed.
Security Considerations
MCP servers have privileged access. Security practices:
- Scope limitation: Only request OAuth scopes you actually need
- Token storage: Store tokens securely. Use environment variables or secret managers
- Audit logging: Log all MCP calls for debugging and compliance
- Rate limiting: Respect service rate limits to avoid bans
The Future of MCP
MCP is evolving. What I'm excited about:
- Streaming: Real-time updates from MCP servers
- Caching: Smart caching of frequently accessed data
- Composition: Chains of MCP servers working together
- Discovery: Automatic MCP server discovery and installation
Getting Started
If you're new to MCP with OpenClaw:
- Start with gog for Google Workspace integration
- Add gh CLI for GitHub access
- Configure Slack if you use it for team communication
- Build a custom MCP server for your specific service
Those three integrations (Google Workspace, GitHub, Slack) cover 80% of my daily workflows. Everything else is gravy.
Resources
- MCP Spec: modelcontextprotocol.io
- OpenClaw Docs: See
/Users/jkw/mira-deployment/openclaw/docs - gog CLI: gogcli.sh
- gh CLI: cli.github.com
The Bottom Line
MCP is the glue between OpenClaw and the services you actually use. Without it, agents are sandboxed. With it, they become force multipliers.
Start with the big three: Google Workspace, GitHub, Slack. Get those working. Then expand based on your needs. And if a service doesn't have an MCP server yet? Build one. The mcporter skill makes it straightforward.
MCP is how I went from "cool agent demo" to "running my entire digital life through OpenClaw." It's that important.
Continue Learning
Ready to build?
Get the OpenClaw Starter Kit — config templates, 5 production-ready skills, deployment checklist. Go from zero to running in under an hour.
$14 $6.99
Get the Starter Kit →Also in the OpenClaw store
Get the free OpenClaw quickstart guide
Step-by-step setup. Plain English. No jargon.