Skip to content

Commit 26b3cac

Browse files
committed
mcp: gateway dynamic mcp tools
Signed-off-by: David Karlsson <[email protected]>
1 parent 384ae60 commit 26b3cac

File tree

3 files changed

+164
-2
lines changed

3 files changed

+164
-2
lines changed

content/manuals/ai/mcp-catalog-and-toolkit/_index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ grid:
2323
description: Learn about the MCP Toolkit to manage MCP servers and clients
2424
icon: /icons/toolkit.svg
2525
link: /ai/mcp-catalog-and-toolkit/toolkit/
26+
- title: Dynamic MCP
27+
description: Discover and add MCP servers on-demand using natural language
28+
icon: search
29+
link: /ai/mcp-catalog-and-toolkit/dynamic-mcp/
2630
- title: MCP Gateway
2731
description: Learn about the underlying technology that powers the MCP Toolkit
2832
icon: developer_board
29-
link: /ai/mcp-catalog-and-toolkit/toolkit/
33+
link: /ai/mcp-catalog-and-toolkit/mcp-gateway/
3034
- title: Docker Hub MCP server
3135
description: Explore about the Docker Hub server for searching images, managing repositories, and more
3236
icon: device_hub
33-
link: /ai/mcp-catalog-and-toolkit/toolkit/
37+
link: /ai/mcp-catalog-and-toolkit/hub-mcp/
3438
---
3539

3640
{{< summary-bar feature_name="Docker MCP Catalog and Toolkit" >}}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
title: Dynamic MCP
3+
linkTitle: Dynamic MCP
4+
description: Discover and add MCP servers on-demand using natural language with Dynamic MCP servers
5+
keywords: dynamic mcps, mcp discovery, mcp-find, mcp-add, code-mode, ai agents, model context protocol
6+
weight: 35
7+
params:
8+
sidebar:
9+
badge:
10+
color: green
11+
text: New
12+
---
13+
14+
Dynamic MCP enables AI agents to discover and add MCP servers on-demand during
15+
a conversation, without manual configuration. Instead of pre-configuring every
16+
MCP server before starting your agent session, clients can search the
17+
[MCP Catalog](/manuals/ai/mcp-catalog-and-toolkit/catalog.md) and add servers
18+
as needed.
19+
20+
This capability is enabled automatically when you connect an MCP client to the
21+
[MCP Toolkit](/manuals/ai/mcp-catalog-and-toolkit/toolkit.md). The gateway
22+
provides a set of primordial tools that agents use to discover and manage
23+
servers during runtime.
24+
25+
{{% experimental %}}
26+
27+
Dynamic MCP is an experimental feature in early development. While you're
28+
welcome to try it out and explore its capabilities, you may encounter
29+
unexpected behavior or limitations.
30+
31+
{{% /experimental %}}
32+
33+
## How it works
34+
35+
When you connect a client to the MCP Gateway, the gateway exposes a small set
36+
of management tools alongside any MCP servers you've already enabled. These
37+
management tools let agents interact with the gateway's configuration:
38+
39+
| Tool | Description |
40+
| ---------------- | ------------------------------------------------------------------------ |
41+
| `mcp-find` | Search for MCP servers in the catalog by name or description |
42+
| `mcp-add` | Add a new MCP server to the current session |
43+
| `mcp-config-set` | Configure settings for an MCP server |
44+
| `mcp-remove` | Remove an MCP server from the session |
45+
| `mcp-exec` | Execute a tool by name that exists in the current session |
46+
| `code-mode` | Create a JavaScript-enabled tool that combines multiple MCP server tools |
47+
48+
With these tools available, an agent can search the catalog, add servers,
49+
handle authentication, and use newly added tools directly without requiring a
50+
restart or manual configuration.
51+
52+
Dynamically added servers and tools are associated with your _current session
53+
only_. When you start a new session, previously added servers are not
54+
automatically included.
55+
56+
## Prerequisites
57+
58+
To use Dynamic MCP, you need:
59+
60+
- Docker Desktop version 4.50 or later, with [MCP Toolkit](/manuals/ai/mcp-catalog-and-toolkit/toolkit.md) enabled
61+
- An LLM application that supports MCP (such as Claude Desktop, Visual Studio Code, or Claude Code)
62+
- Your client configured to connect to the MCP Gateway
63+
64+
See [Get started with Docker MCP Toolkit](/manuals/ai/mcp-catalog-and-toolkit/get-started.md)
65+
for setup instructions.
66+
67+
## Usage
68+
69+
Dynamic MCP is enabled automatically when you use the MCP Toolkit. Your
70+
connected clients can now use `mcp-find`, `mcp-add`, and other management tools
71+
during conversations.
72+
73+
To see Dynamic MCP in action, connect your AI client to the Docker MCP Toolkit
74+
and try this prompt:
75+
76+
```plaintext
77+
What MCP servers can I use for working with SQL databases?
78+
```
79+
80+
Given this prompt, your agent will use the `mcp-find` tool provided by MCP
81+
Toolkit to search for SQL-related servers in the [MCP Catalog](./catalog.md).
82+
83+
And to add a server to a session, simply write a prompt and the MCP Toolkit
84+
takes care of installing and running the server:
85+
86+
```plaintext
87+
Add the postgres mcp server
88+
```
89+
90+
## Tool composition with code mode
91+
92+
The `code-mode` tool is available as an experimental capability for creating
93+
custom JavaScript functions that combine multiple MCP server tools. The
94+
intended use case is to enable workflows that coordinate multiple services
95+
in a single operation.
96+
97+
> **Note**
98+
>
99+
> Code mode is in early development and is not yet reliable for general use.
100+
> The documentation intentionally omits usage examples at this time.
101+
>
102+
> The core Dynamic MCP capabilities (`mcp-find`, `mcp-add`, `mcp-config-set`,
103+
> `mcp-remove`) work as documented and are the recommended focus for current
104+
> use.
105+
106+
The architecture works as follows:
107+
108+
1. The agent calls `code-mode` with a list of server names and a tool name
109+
2. The gateway creates a sandbox with access to those servers' tools
110+
3. A new tool is registered in the current session with the specified name
111+
4. The agent calls the newly created tool
112+
5. The code executes in the sandbox with access to the specified tools
113+
6. Results are returned to the agent
114+
115+
The sandbox can only interact with the outside world through MCP tools,
116+
which are already running in isolated containers with restricted privileges.
117+
118+
## Security considerations
119+
120+
Dynamic MCP maintains the same security model as static MCP server
121+
configuration in MCP Toolkit:
122+
123+
- All servers in the MCP Catalog are built, signed, and maintained by Docker
124+
- Servers run in isolated containers with restricted resources
125+
- Code mode runs agent-written JavaScript in an isolated sandbox that can only
126+
interact through MCP tools
127+
- Credentials are managed by the gateway and injected securely into containers
128+
129+
The key difference with dynamic capabilities is that agents can add new tools
130+
during runtime.
131+
132+
## Disabling Dynamic MCP
133+
134+
Dynamic MCP is enabled by default in the MCP Toolkit. If you prefer to use only
135+
statically configured MCP servers, you can disable the dynamic tools feature:
136+
137+
```console
138+
$ docker mcp feature disable dynamic-tools
139+
```
140+
141+
To re-enable the feature later:
142+
143+
```console
144+
$ docker mcp feature enable dynamic-tools
145+
```
146+
147+
After changing this setting, you may need to restart any connected MCP clients.
148+
149+
## Further reading
150+
151+
Check out the [Dynamic MCP servers with Docker](https://docker.com/blog) blog
152+
post for more examples and inspiration on how you can use dynamic tools.

content/manuals/ai/mcp-catalog-and-toolkit/toolkit.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ It is the fastest way from MCP tool discovery to local execution.
2424
- Zero manual setup: No dependency management, runtime configuration, or setup required.
2525
- Functions as both an MCP server aggregator and a gateway for clients to access installed MCP servers.
2626

27+
> [!TIP]
28+
> The MCP Toolkit includes [Dynamic MCP](/manuals/ai/mcp-catalog-and-toolkit/dynamic-mcp.md),
29+
> which enables AI agents to discover, add, and compose MCP servers on-demand during
30+
> conversations, without manual configuration. Your agent can search the catalog and
31+
> add tools as needed when you connect to the gateway.
32+
2733
## How the MCP Toolkit works
2834

2935
MCP introduces two core concepts: MCP clients and MCP servers.

0 commit comments

Comments
 (0)