Guides5 min read

MCP Servers for AI Chatbots

Set up Model Context Protocol (MCP) servers for your AI bot. Extend OpenClaw and OpenClaw with powerful integrations.

Published: 27/01/2025

What is MCP?

Model Context Protocol (MCP) is a standard way to give AI models access to external tools and data. Instead of building custom integrations, you can connect MCP servers to instantly add capabilities.

Think of MCP servers as "plugins" for your AI bot.

How It Works

Your Message
    ↓
[OpenClaw/OpenClaw]
    ↓
[AI decides to use tool]
    ↓
[MCP Server executes]
    ↓
[Result returned to AI]
    ↓
Response to you

Why MCP?

| Traditional Integration | MCP Server | |------------------------|------------| | Custom code per service | Standard protocol | | Maintain yourself | Community maintained | | One-off implementation | Reusable across projects | | Limited documentation | Standardized interface |

Popular MCP Servers

Database Access

# SQLite MCP
MCP_SQLITE_ENABLED=true
MCP_SQLITE_PATH=/opt/openclaw/data/bot.db

You: "Show me all users who signed up this month" Bot: Queries SQLite directly, returns formatted results.

File System

# Filesystem MCP
MCP_FILESYSTEM_ENABLED=true
MCP_FILESYSTEM_PATHS=/opt/openclaw/documents,/opt/openclaw/notes

You: "Find all markdown files about projects" Bot: Searches directories, reads relevant files.

Web Search

# Brave Search MCP
MCP_BRAVE_SEARCH_ENABLED=true
BRAVE_API_KEY=your-key

You: "Search for the latest Node.js security vulnerabilities" Bot: Performs web search, summarizes results.

GitHub

# GitHub MCP
MCP_GITHUB_ENABLED=true
GITHUB_TOKEN=your-token

You: "Show me open issues in the openclaw repo" Bot: Fetches and lists GitHub issues.

Google Drive

# Google Drive MCP
MCP_GDRIVE_ENABLED=true
GOOGLE_CREDENTIALS=/opt/openclaw/google-creds.json

You: "Find my presentation about Q4 sales" Bot: Searches Google Drive, returns file links.

Setup Guide

Step 1: Install MCP Support

cd /opt/openclaw
npm install @modelcontextprotocol/sdk

Step 2: Configure MCP Servers

Create /opt/openclaw/mcp-config.json:

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/opt/openclaw/documents"]
    },
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sqlite", "/opt/openclaw/data/bot.db"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "your-key"
      }
    }
  }
}

Step 3: Enable in Bot

MCP_ENABLED=true
MCP_CONFIG_PATH=/opt/openclaw/mcp-config.json

Step 4: Restart and Test

pm2 restart openclaw

# Test
"Search the web for MCP server examples"

Available MCP Servers

Official Servers

| Server | Function | |--------|----------| | server-filesystem | Read/write local files | | server-sqlite | Query SQLite databases | | server-postgres | PostgreSQL access | | server-brave-search | Web search | | server-github | GitHub integration | | server-gitlab | GitLab integration | | server-slack | Slack messages | | server-google-drive | Google Drive files | | server-memory | Persistent memory |

Community Servers

The MCP community creates servers for:

  • Notion
  • Linear
  • Jira
  • Confluence
  • Calendar services
  • Email providers
  • And many more

Find community servers: MCP Server Registry

Creating Custom MCP Servers

Build your own for proprietary systems:

// my-custom-mcp/index.js
const { Server } = require('@modelcontextprotocol/sdk/server');

const server = new Server({
  name: 'my-custom-server',
  version: '1.0.0'
});

server.addTool({
  name: 'get_customer',
  description: 'Fetch customer details from CRM',
  parameters: {
    type: 'object',
    properties: {
      customerId: { type: 'string' }
    }
  },
  handler: async ({ customerId }) => {
    const customer = await crm.getCustomer(customerId);
    return JSON.stringify(customer);
  }
});

server.start();

Add to config:

{
  "servers": {
    "my-crm": {
      "command": "node",
      "args": ["/opt/openclaw/mcp-servers/my-custom-mcp/index.js"]
    }
  }
}

Use Case Examples

Research Assistant

With web search + filesystem MCP:

You: "Research the best practices for API rate limiting and save a summary"

Bot does:

  1. Searches web for rate limiting best practices
  2. Reads multiple articles
  3. Synthesizes information
  4. Saves summary to /documents/rate-limiting-research.md

Code Assistant

With GitHub + filesystem MCP:

You: "Check if there are any security issues reported in our dependencies"

Bot does:

  1. Reads package.json
  2. Checks GitHub for security advisories
  3. Reports any found vulnerabilities

Business Intelligence

With database + Google Sheets MCP:

You: "Create a report of this month's sales by region"

Bot does:

  1. Queries sales database
  2. Aggregates by region
  3. Creates formatted report
  4. Optionally exports to Google Sheets

Security Considerations

Limit Access

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/opt/openclaw/safe-directory"  // Only this directory
      ]
    }
  }
}

Read-Only When Possible

MCP_FILESYSTEM_READONLY=true
MCP_DATABASE_READONLY=true

Credential Management

Never put credentials in config files:

{
  "servers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"  // From environment
      }
    }
  }
}

Audit Logging

MCP_AUDIT_LOG=true
MCP_LOG_PATH=/var/log/mcp-activity.log

Troubleshooting

Server not starting

# Test server manually
npx -y @modelcontextprotocol/server-filesystem /path/to/test

Tool not available

Check server is listed:

You: "What tools do you have?"
Bot: Lists available MCP tools

Slow responses

  • MCP servers add latency
  • Consider caching
  • Use local servers when possible

Permission errors

Verify paths and credentials:

# Check file permissions
ls -la /opt/openclaw/documents/

# Test database connection
sqlite3 /opt/openclaw/data/bot.db ".tables"

Best Practices

Start Small

Begin with 1-2 servers, add more as needed.

Monitor Usage

Track which MCP tools are used:

MCP_USAGE_TRACKING=true

Keep Servers Updated

# Update MCP servers monthly
npm update @modelcontextprotocol/server-*

Document Your Setup

Keep notes on which servers do what:

# MCP Server Configuration

## Active Servers
- filesystem: Access to /documents
- sqlite: Bot database queries
- brave-search: Web research

## Credentials Location
- GitHub token: .env file
- Google creds: /opt/openclaw/creds/

Related Guides

Need Help?

MCP configuration can be complex. Our setup service includes MCP server installation and custom server development.

Need a VPS for Your Bot?

We recommend Hostinger KVM 2 VPS - reliable, fast, and perfect for AI chatbots. Get started with our recommended setup.

Get Hostinger VPS

Need Help With Setup?

Got your VPS? Let us handle the technical work. Professional setup and maintenance for OpenClaw (formerly Clawd.bot).