OpenClaw + MCP:让 AI 助手连接任何工具

4 阅读1分钟

什么是 MCP?

MCP(Model Context Protocol)是 Anthropic 推出的开放协议,让 AI 助手能连接外部工具和数据源。

OpenClaw 原生支持 MCP,这意味着你的 AI 助手可以:

  • 📁 访问本地文件
  • 🗄️ 连接数据库
  • 🌐 调用 API
  • 🔧 执行命令

实战案例

1. 连接 GitHub

{
  "mcpServers": {
    "github": {
      "command": "mcp-github",
      "args": ["--token", "YOUR_TOKEN"]
    }
  }
}

2. 连接数据库

{
  "mcpServers": {
    "postgres": {
      "command": "mcp-postgres",
      "args": ["postgresql://localhost/mydb"]
    }
  }
}

3. 连接搜索引擎

{
  "mcpServers": {
    "brave": {
      "command": "mcp-brave",
      "args": ["--api-key", "YOUR_KEY"]
    }
  }
}

为什么这很重要?

传统 AI 只能聊天。MCP 让 AI 能做事

  • 自动查询数据库
  • 自动提交代码
  • 自动搜索资料
  • 自动处理文件

安装教程

# 安装 OpenClaw
npm install -g openclaw

# 配置 MCP
openclaw mcp add github
openclaw mcp add postgres

# 重启
openclaw restart

收费服务

不想自己配置?找我帮你:

  • 基础 MCP 配置:¥99
  • 企业级 MCP 集成:¥999

OpenClaw 认证服务商