Docker Labs: GenAI No. 17
Docker, Inc
Docker helps developers bring their ideas to life by conquering the complexity of app development.
Dynamic Model Context Protocol (MCP) Tools
We recently followed up our introduction to Docker and MCP with a post on how to package MCP servers using Docker. In these posts, we focused on servers that implement the Model Context Protocol (MCP) directly.
While developing these servers, we noticed that many implementations turned out to be relatively simple MCP wrappers over existing tools. For example, tools like sqlite, curl, ffmpeg, and qrencode, can add capabilities such as database querying, API calls, converting audio/video formats, and generating QR codes.?
But do each of these tools need to be wrapped in their own MCP server??
We see this as an opportunity to explore whether there's an easier way for developers to build an MCP-powered toolbox. What we will present today is a single MCP tool server that can dynamically add new Tool container Images.?Here's an updated picture.
The MCP client will still be able to access the same tools, prompts, and resources over the MCP interface. However, each additional tool will not need its own MCP protocol handler and will not necessarily require long-lived runtimes.
Tool Runtimes
So let's build a tool server for dynamically adding new tools.?But why Docker?
One of the big advantages of hosting an MCP server in a Docker runtime is that we can so easily pull and run other tool images. It's hard to appreciate this without an example, so let's look at a tool called qrencode, which can generate QR codes. Instead of building a separate MCP server, we'll define the runtime requirements for qrencode using a definition with the properties name, description, parameters, and container. Here's the definition.
tools:
- name: qrencode
description: run a qrencode command
parameters:
type: object
properties:
args:
type: array
description: the arguments to pass to qrencode
items:
type: string
container:
image: vonwig/qrencode:latest
command:
- "{{args|into}}"
Think of this as a description for how to run qrencode if something else were to know what arguments to pass. And, of course, that's where the AI model comes in. This makes a lot of sense since our current foundation models have been trained on data that includes many examples of how to use common tools.
领英推荐
The second part of our definition is a prompt.?Here's an example that we're using to drive the QR code generation capability.
Generate a QR code for the content '{{content}}' and write the output to the file /thread/qrcode.png.
If the command fails, read the man page and try again.
If successful, output the path to the generated image in markdown syntax.
We've also added two conventions to make this data easier to integrate into an MCP workflow.
And that's it. So how much can we do with tool container definitions like these? Will that be sufficient for the docker/mcp server to create useful MCP interfaces? To help learn more here, we've created a catalog of examples and an MCP server that you can try out today.
Tool Discovery
Our initial catalog of example tools is a simple Docker Desktop extension. Install this extension to add the catalog to your local Docker Desktop.?Each tile links to the definition of the tool in GitHub, and has a button for you to activate that tool in any mcp/docker MCP server that you run locally.
Although you can use this with any MCP client, we suggest that you start with Anthropic's Claude Desktop. You can also click on the Claude icon in the catalog to automatically add this MCP server to your local claude_desktop_config. See our quickstart guide for more information.
Adding Tools
As we continue to explore this topic, we'll be adding new examples and we'll also keep the catalog open to contributions. If you have a tool container that you think you would like to turn into an MCP server, raise a PR to update our catalog definition or install our mcp/docker server and ask Claude Desktop to "submit a new mcp/docker catalog entry" to have an agent walk you through the submission.
Building new catalog entries is about creating prompt/tool definitions like this one (our hello-world definition), and checking them into a public GitHub repository.?We've also put together some documentation on authoring new tool definitions, including an extension for testing the definitions directly from VSCode.
AI code assistants are already good at generating the scaffolding for MCP servers, and for some tools, that will remain the right approach for creating new MCP-enabled capabilities. However, these assistants are also very effective at creating new prompt definitions like this one, which will come with simple git lifecycles and developer tooling that we think will enable very rapid iteration towards MCP enablement.
Summary
We are exploring MCP tool definitions that are both application-centric, combining what we know about efficiently distributing applications using Docker, and prompt-centric, being essentially just markdown files describing how to embed tools into conversations.?Along with an mcp/docker server to host these definitions, we have used a catalog to demonstrate how we can easily distribute new capabilities to our MCP clients.
Beautiful!
??Cloud & Virtualization Engineer | Building Flexible, Scalable IT Worlds??
1 个月Is there an official tutorial by Docker to build a prophet-meta model in arm64 Architecture ( raspi5 and etc..)?
Principal Data Scientist @ UKG
1 个月Thank you for publishing these great tutorials on MCP and Docker. Who is the author behind this great series? They deserve some kudos!
Software Engineer at Pathatiya technology ltd.
1 个月Very helpful!