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
- 无法配置服务器使用自定义路径作为其知识库