Home Explore Blog Models CI



docker

1st chunk of `content/manuals/ai/gordon/mcp/yaml.md`
d67fcf92fa562f64e1b24cb8c6c4c36363693f94604fade30000000100000cfe
---
title: YAML configuration
description: Learn how to use MCP servers with Gordon
keywords: ai, mcp, gordon
aliases: 
 - /desktop/features/gordon/mcp/yaml/
---

Docker has partnered with Anthropic to build container images for the [reference
implementations](https://github.com/modelcontextprotocol/servers/) of MCP
servers available on Docker Hub under [the mcp
namespace](https://hub.docker.com/u/mcp).

When you run the `docker ai` command in your terminal to ask a question, Gordon
looks in the `gordon-mcp.yml` file in your working directory (if present) for a
list of MCP servers that should be used when in that context. The
`gordon-mcp.yml` file is a Docker Compose file that configures MCP servers as
Compose services for Gordon to access.

The following minimal example shows how you can use the [mcp-time
server](https://hub.docker.com/r/mcp/time) to provide temporal capabilities to
Gordon. For more information, you can check out the [source code and
documentation](https://github.com/modelcontextprotocol/servers/tree/main/src/time).

Create the `gordon-mcp.yml` file in your working directory and add the time
   server:

```yaml
services:
  time:
    image: mcp/time
```

With this file present, you can now ask Gordon to tell you the time in
   another timezone:

  ```bash
  $ 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.
  
  ```

As you can see, Gordon found the MCP time server and called its tool when
needed.

## Advanced usage

Some MCP servers need access to your filesystem or system environment variables.
Docker Compose can help with this. Since `gordon-mcp.yml` is a Compose file you
can add bind mounts using the regular Docker Compose syntax, which makes your
filesystem resources available to the container:

```yaml
services:
  fs:
    image: mcp/filesystem
    command:
      - /rootfs
    volumes:
      - .:/rootfs
```

The `gordon-mcp.yml` file adds filesystem access capabilities to Gordon and
since everything runs inside a container Gordon only has access to the
directories you specify.

Gordon can handle any number of MCP servers. For example, if you give Gordon
access to the internet with the `mcp/fetch` server:

```yaml
services:
  fetch:
    image: mcp/fetch
  fs:
    image: mcp/filesystem
    command:
      - /rootfs
    volumes:
      - .:/rootfs
```

You can now ask things like:

```bash
$ 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.

Title: Configuring MCP Servers with YAML for Docker AI
Summary
Docker AI uses MCP (Model Context Protocol) servers to enhance its capabilities. These servers are configured via a `gordon-mcp.yml` file, which is a Docker Compose file that defines MCP servers as services. This file allows users to specify which MCP servers Gordon should use in a given context, enabling features like time zone conversion or filesystem access. Advanced usage includes bind mounts for filesystem access and the ability to integrate multiple MCP servers for complex tasks.