YAML 配置
Docker 已與 Anthropic 合作,為 參考實現 的 MCP 伺服器構建了容器映象,這些映象可在 Docker Hub 上 mcp 名稱空間 下找到。
當您在終端中執行 docker ai
命令提問時,Gordon 會在您的工作目錄中查詢 gordon-mcp.yml
檔案(如果存在),以獲取在該上下文中應使用的 MCP 伺服器列表。gordon-mcp.yml
檔案是一個 Docker Compose 檔案,它將 MCP 伺服器配置為 Gordon 可訪問的 Compose 服務。
以下最小示例展示瞭如何使用 mcp-time 伺服器 為 Gordon 提供時間功能。更多資訊,您可以檢視 原始碼和文件。
在您的工作目錄中建立 gordon-mcp.yml
檔案並新增時間伺服器
services:
time:
image: mcp/time
有了這個檔案,您現在可以要求 Gordon 告訴您另一個時區的時間
$ docker ai 'what time is it now in kiribati?'
• Calling get_current_time
The current time in Kiribati (Tarawa) is 9:38 PM on January 7, 2025.
如您所見,Gordon 找到了 MCP 時間伺服器並在需要時呼叫了其工具。
高階用法
一些 MCP 伺服器需要訪問您的檔案系統或系統環境變數。Docker Compose 可以幫助解決這個問題。由於 gordon-mcp.yml
是一個 Compose 檔案,您可以使用常規的 Docker Compose 語法新增繫結掛載,從而使您的檔案系統資源對容器可用
services:
fs:
image: mcp/filesystem
command:
- /rootfs
volumes:
- .:/rootfs
gordon-mcp.yml
檔案為 Gordon 添加了檔案系統訪問功能,並且由於一切都在容器內部執行,Gordon 只能訪問您指定的目錄。
Gordon 可以處理任意數量的 MCP 伺服器。例如,如果您使用 mcp/fetch
伺服器賦予 Gordon 網際網路訪問許可權
services:
fetch:
image: mcp/fetch
fs:
image: mcp/filesystem
command:
- /rootfs
volumes:
- .:/rootfs
您現在可以詢問如下問題
$ docker ai can you fetch rumpl.dev and write the summary to a file test.txt
• Calling fetch ✔️
• Calling write_file ✔️
The summary of the website rumpl.dev has been successfully written to the file test.txt in the allowed directory. Let me know if you need further assistance!
$ cat test.txt
The website rumpl.dev features a variety of blog posts and articles authored by the site owner. Here's a summary of the content:
1. **Wasmio 2023 (March 25, 2023)**: A recap of the WasmIO 2023 conference held in Barcelona. The author shares their experience as a speaker and praises the organizers for a successful event.
2. **Writing a Window Manager in Rust - Part 2 (January 3, 2023)**: The second part of a series on creating a window manager in Rust. This installment focuses on enhancing the functionality to manage windows effectively.
3. **2022 in Review (December 29, 2022)**: A personal and professional recap of the year 2022. The author reflects on the highs and lows of the year, emphasizing professional achievements.
4. **Writing a Window Manager in Rust - Part 1 (December 28, 2022)**: The first part of the series on building a window manager in Rust. The author discusses setting up a Linux machine and the challenges of working with X11 and Rust.
5. **Add docker/docker to your dependencies (May 10, 2020)**: A guide for Go developers on how to use the Docker client library in their projects. The post includes a code snippet demonstrating the integration.
6. **First (October 11, 2019)**: The inaugural post on the blog, featuring a simple "Hello World" program in Go.
接下來是什麼?
現在您已經瞭解瞭如何將 MCP 伺服器與 Gordon 配合使用,以下是一些入門方法
- 實驗:嘗試將一個或多個已測試的 MCP 伺服器整合到您的
gordon-mcp.yml
檔案中,並探索它們的功能。 - 探索生態系統:檢視 GitHub 上的參考實現 或瀏覽 Docker Hub MCP 名稱空間,以尋找可能符合您需求的其他伺服器。
- 構建自己的伺服器:如果現有伺服器都不能滿足您的需求,或者您想更深入地瞭解它們的工作原理,請考慮開發一個自定義的 MCP 伺服器。使用 MCP 規範 作為指南。
- 分享您的反饋:如果您發現了與 Gordon 配合良好的新伺服器,或在使用現有伺服器時遇到問題,請 分享您的發現,以幫助改進生態系統。
藉助 MCP 支援,Gordon 提供了強大的可擴充套件性和靈活性,可以滿足您的特定用例,無論您是新增時間感知、檔案管理還是網際網路訪問功能。
相容的 MCP 伺服器
這些是已透過 Gordon 測試且已知可以工作的 MCP 伺服器
mcp/time
mcp/fetch
mcp/filesystem
mcp/postgres
mcp/git
mcp/sqlite
mcp/github
未測試 (應在提供適當 API 令牌的情況下工作)
這些 MCP 伺服器尚未測試,但如果提供適當的 API 令牌,應該可以工作
mcp/brave-search
mcp/gdrive
mcp/slack
mcp/google-maps
mcp/gitlab
mcp/everything
mcp/aws-kb-retrieval-server
mcp/sentry
不支援
這些是目前已知不支援的 MCP 伺服器
mcp/sequentialthinking
- (工具描述過長)mcp/puppeteer
- Puppeteer 返回影像,Gordon 不知道如何處理它們,它只能處理來自工具的文字響應mcp/everart
- Everart 返回影像,Gordon 不知道如何處理它們,它只能處理來自工具的文字響應mcp/memory
- 無法配置伺服器使用自定義路徑作為其知識庫