Model Context Protocol(MCP)是賦予 AI Agent 新功能的標準方式。目前超過 65% 的活躍 OpenClaw 技能模組都是基於 MCP Server 封裝而成。以下是設定方法。
什麼是 MCP?
MCP(Model Context Protocol)是由 Anthropic 創建的開放標準。它定義了 AI 模型如何連接外部工具和資料來源。不需要每個 AI 工具各自建立自訂整合,MCP 提供了一個通用介面。
把它想像成 AI 的 USB——任何相容 MCP 的工具都能與任何相容 MCP 的 AI Agent 搭配使用。
OpenClaw 如何使用 MCP
OpenClaw 的技能模組系統是建立在 MCP 之上的。當你安裝像 openclaw-google-calendar 這樣的技能模組時,它實際上是一個 MCP Server,會:
- 公開工具(建立事件、列出事件、刪除事件)
- 提供資源(行事曆資料、事件詳情)
- 處理認證(OAuth Token、API 金鑰)
OpenClaw 連接到這些 Server,並在對話過程中使用它們的工具。
設定 MCP Server
方法 1:透過技能模組安裝(推薦)
最簡單的方式——大多數熱門的 MCP Server 都已經打包成 OpenClaw 技能模組:
openclaw plugins install @anthropic/mcp-filesystem
openclaw plugins install @anthropic/mcp-github
openclaw plugins install @anthropic/mcp-postgres
方法 2:直接設定 MCP
對於自訂或第三方的 MCP Server,可以直接進行設定:
openclaw config set mcpServers.myserver.command "npx"
openclaw config set mcpServers.myserver.args '["@my-org/my-mcp-server"]'
openclaw config set mcpServers.myserver.env.API_KEY "your-key"
方法 3:基於 Docker 的 MCP Server
對於需要隔離環境的 MCP Server:
openclaw config set mcpServers.browser.command "docker"
openclaw config set mcpServers.browser.args '["run", "--rm", "mcp/browser-automation"]'
熱門的 OpenClaw MCP Server
生產力工具
- Google Calendar ——建立、讀取、更新行事曆事件
- Gmail ——讀取、草擬和發送電子郵件
- Notion ——讀取和寫入 Notion 頁面與資料庫
- Todoist ——管理任務和專案
開發工具
- GitHub ——Issue、Pull Request、Repo、程式碼搜尋
- PostgreSQL ——查詢和管理資料庫
- Filesystem ——讀取和寫入本機檔案
- Docker ——管理容器和映像檔
資料與研究
- Web Search ——搜尋網路
- Browser Automation ——瀏覽和操作網站
- RSS Feeds ——監控新聞和部落格動態
- Stock Data ——即時市場數據
通訊工具
- Slack ——讀取和發送 Slack 訊息
- Discord ——管理 Discord 頻道和訊息
- Email (IMAP) ——連接任何電子郵件服務供應商
設定小技巧
環境變數
敏感資料務必設為環境變數,不要寫在技能模組設定裡:
openclaw config set mcpServers.github.env.GITHUB_TOKEN "ghp_your_token"
逾時設定
某些 MCP Server 進行複雜操作時需要較長的逾時時間:
openclaw config set mcpServers.browser.timeout 60000
多個實例
使用不同設定執行同一個 MCP Server 的多個實例:
openclaw config set mcpServers.work-calendar.command "npx"
openclaw config set mcpServers.work-calendar.args '["@google/calendar-mcp", "--calendar=work"]'
openclaw config set mcpServers.personal-calendar.command "npx"
openclaw config set mcpServers.personal-calendar.args '["@google/calendar-mcp", "--calendar=personal"]'
ClawTank 上的 MCP
ClawTank 容器已預先安裝 MCP 執行環境。熱門的 MCP Server 可以透過儀表板一鍵安裝技能模組。不需要 Docker 設定或套件管理。
疑難排解
Server 無法連線
檢查 MCP Server 是否已安裝且可存取:
openclaw plugins list
權限錯誤
確認環境變數設定正確。大多數 MCP Server 需要 API Token 或 OAuth 憑證。
回應緩慢
某些 MCP Server(瀏覽器自動化、網路搜尋)本身就比較慢。考慮增加逾時時間。
開始使用
在 ClawTank 上部署,MCP Server 已預先設定好。將你喜愛的工具連接到 OpenClaw,透過自然語言自動化你的工作流程。
