---
title: "Connect Docker MCP to Claude Code: Step-by-step guide"
description: "Learn how to connect Docker MCP Toolkit to Claude Code. Follow our step-by-step guide to configure containers, verify connections, and run MCP tools safely."
---

# Connect Docker MCP to Claude Code: Step-by-step guide

Published: 2026-09-30T09:18:05.154Z

Author: [Goon Nguyen](/author/goon)

Reading time: 13 minutes

Learn how to connect Docker MCP Toolkit to Claude Code. Follow our step-by-step guide to configure containers, verify connections, and run MCP tools safely.

# How to connect Docker MCP toolkit to Claude Code: Step-by-step guide

Connecting the Docker MCP toolkit to Claude Code allows you to run containerized tools without installing local runtime dependencies. The setup is simple: Verify prerequisites, connect Docker MCP Gateway, configure a server, and test a read-only tool invocation. This guide covers each step, success criteria, and troubleshooting tips. Always check your installed CLI versions, as commands and interface labels may vary between releases.

![Image](https://cdn.agentkit.best/blog/cfai-media/5126b1bf168b5a2f383b8ec07faad869ad2ec63ae099854d588b56c747c47086-914c8f5110f85bb42392b1a7efbf6ed00150420d8206c4e84b85ad3a7b28ff18.jpg)

## How Docker MCP toolkit and Claude Code work together

Docker MCP Toolkit is a Docker Desktop interface for discovering, configuring, and connecting [MCP servers](https://agentkit.best/blog/claude-code-guides/how-to-setup-and-configure-mcp-servers-in-claude-code) to compatible applications. [MCP](https://agentkit.best/blog/claude-code-guides/claude-code-mcp-connect-servers-setup-guide-and-fix-errors), or Model Context Protocol, standardizes how clients interact with server-exposed capabilities. The Toolkit manages available integrations, while Docker MCP Gateway provides a connection layer between Claude Code and enabled servers.

The MCP architecture documentation distinguishes the **client** from the **server**. Claude Code is the MCP client. A containerized MCP server exposes tools, such as reading approved files. Those files—or an external API—are the resources accessed by the tools.

`Claude Code
    ↓
Docker MCP Gateway
    ↓
Containerized MCP server
    ↓
Approved files or API
`

![Image](https://cdn.agentkit.best/blog/cfai-media/be86abef6cdc124d9d884152541ed1f05d20f343446b6d295851b02c70e74dca-da9fb766e6de32a7d3e0b4cfb20ff6153d1cc5e121e18e1f69bb8d9bdda38f78.jpg)

Docker’s MCP Toolkit documentation describes container-based server management. Its practical advantages include:

Host paths, file sharing, and shell environments can still differ across platforms.

## Prerequisites and version checks

Check Docker Desktop, engine connectivity, the MCP CLI, and [Claude Code](https://agentkit.best/blog/claude-code-guides/what-is-claude-code-a-complete-guide-to-the-ai-coding-tool) separately. An installed command does not prove its underlying service is running. Before starting, confirm:

Run:

`docker --version
docker info
docker mcp --help
claude --version
`

`docker info` checks the engine selected by your active Docker context. It does not necessarily identify the engine you intended to use.

Record the Docker Desktop version separately from its About screen. The Docker CLI version is not the Desktop version. If the MCP component exposes an independent version command in its help, record that too.

**Recommended test environment**

Use a sample project containing a harmless `README.md` and two or three text files. Exclude credentials, production configuration, and customer data.

Record your OS, shell, versions, and Docker context before troubleshooting. For Windows, distinguish PowerShell from WSL; their paths and executable availability are not interchangeable.

Follow Docker’s installation documentation and Claude Code’s setup documentation if any prerequisite fails. A filesystem-only test should not require an external service token.

## Connect Docker MCP Toolkit to Claude Code

To connect Docker MCP to Claude Code, choose one registration method. Do not register the same gateway through both the Desktop interface and CLI.

### Step 1: Open MCP toolkit

Look for MCP Toolkit in Docker Desktop. If it is unavailable, check your release’s documentation and applicable feature settings.

Do not assume another Docker AI feature enables MCP Toolkit.

> ***Expected result:**** You can access the Toolkit’s catalog, server configuration, and client connection controls.*

### Step 2: Connect from Docker Desktop - Option A

Open the Toolkit’s **Clients** area and locate Claude Code, if your release lists it. Use the available connection action.

Pay attention to project selection and configuration scope. **Scope** determines where Claude Code makes a registered connection available.

If the interface does not make the destination clear, inspect the resulting configuration from your intended project before continuing.

> ***Expected result:**** Claude Code has a gateway registration. A “connected” label in Desktop is not evidence that a filesystem tool has executed successfully.*

### Step 3: Connect from the CLI - Option B

Skip this option if you completed Option A.

From the intended test project, inspect the installed connector:

`docker mcp client connect --help
`

Where the installed connector supports the `claude-code` identifier, use:

`docker mcp client connect claude-code
`

The command configures a client connection. Confirm its destination and scope using the installed help and resulting configuration; do not assume it applies across all projects.

> ***Expected result:**** One gateway entry appears in the intended Claude Code configuration.*

For explicit scope control, Claude Code’s MCP documentation describes direct command registration. Check `claude mcp add --help` before using this alternative:

`claude mcp add --transport stdio --scope local MCP\_DOCKER -- docker mcp gateway run
`

Here, **stdio** means communication through the launched process’s standard input and output. This registers the gateway process; it is not another required layer or a server installer.

Claude Code launches that process when connecting. You do not need to start a second foreground gateway manually for this pattern.

### Step 4: Restart Claude Code

Exit the active session. From your test project, start again:

`claude
`

> ***Expected result:**** The new session loads the applicable *[*MCP configuration*](https://agentkit.best/blog/claude-code-guides/claude-code-mcp-configuration-a-practical-setup-guide)*.*

### Step 5: Inspect the gateway

Inside Claude Code, run:

`/mcp
`

For shell-level inspection:

`claude mcp list
`

Distinguish these states:

A connected gateway may still have no usable tools because server configuration or authentication is incomplete.

![Image](https://cdn.agentkit.best/blog/cfai-media/2b388e006e3958cd369c0d6c31234919acd3525726eb7061f4af0b46151a125b-264dcc6dfc70997d9aaa9297fe60e31cf8964ef35caf9e2eb1a2248fe9b16640.jpg)

## Add and test your first MCP server

Connecting the gateway and enabling a server are separate tasks. To add an MCP server to Claude Code through Docker, enable it in the Toolkit and verify its tools through the gateway.

### Add filesystem MCP

Use a Filesystem MCP integration only after checking its catalog identity and configuration requirements:

The Model Context Protocol servers repository contains a Filesystem reference implementation. Do not assume every similarly named catalog entry uses that implementation or the same settings.

Record the exact catalog name, publisher, and image tag or digest. Use the selected entry’s documented path fields; a key such as `filesystem.paths` is not universal.

If configuration distinguishes host and container paths, mount only the test directory and authorize its corresponding container path. Ask the tool to use that visible path.

**Exclude your home directory, SSH keys, cloud credentials, customer data, and unrelated repositories.** Some servers start on demand; a separate “Start server” button is not always required.

![Image](https://cdn.agentkit.best/blog/cfai-media/6849f057634565fc70d45f21bb1fef655bcdd5ce4e0a33df0b878bebfef19ad5-82546ce97f863dc3ce9507ae2572723481188c0b3020b62e66e997f4d7803ba3.jpg)

### Run a read-only MCP test prompt

Replace the bracketed directory before submitting:

`Use the Filesystem MCP tools, not Bash or built-in file tools.
List the top-level files in \[approved directory\].
Read README.md and summarize its contents.
Do not create, modify, move, or delete anything.
If the MCP tools are unavailable, stop and report that.
`

Validation passes only when:

Claude’s claim that it used MCP is insufficient. Bash or built-in file access does not validate this connection.

Read-only wording is not access control. Filesystem servers may expose write tools. Enforce read-only access through supported permissions or mounts where available.

![Image](https://cdn.agentkit.best/blog/cfai-media/a33121413431bd5f5c160aa46d2db5d0d60ff3ad4de9d8ce6b1b7d87353ff158-95eb6f4cb1f7d33f11f1288b8bdb4b1a643ebcfe530515b791b2cd3d8caa00f1.jpg)

## Docker MCP toolkit vs. direct `claude mcp add` configuration

Toolkit management and direct registration overlap. The `claude mcp add` command registers a connection; it does not necessarily install dependencies. It can also register a Docker-backed gateway.

Which approach should you choose?

According to Claude Code’s MCP documentation, local command registration and remote HTTP connections are distinct connection patterns. Choose the pattern your server supports.

Both approaches require reviewed permissions and credential management. Avoid exposing the same tools through multiple registrations; duplicate routes complicate tool selection and troubleshooting.

## Common Docker MCP and Claude Code Errors

**Identify the failing layer before changing configuration.** Check the client registration, gateway process, server readiness, and requested operation in that order.

Use the smallest reversible fix. Do not disable approval controls or expose broad directories to make a test pass.

Claude Code sign-in does not authenticate every external service. A server’s OAuth authorization or API credentials are separate requirements.

**Diagnostic commands**

Run in your terminal:

`docker mcp --help
claude mcp list
claude mcp get \<server-name\>
`

Replace `\<server-name\>` with the actual registered entry, such as `MCP\_DOCKER` if you used that name.

Inside Claude Code:

`/mcp
`

Inspect errors before reconnecting or reinstalling. After a targeted change, repeat the same small test to determine whether the failure moved or disappeared.

Redact diagnostic output before sharing it. Configuration can contain tokens, account identifiers, private paths, and sensitive [environment variables](https://agentkit.best/blog/claude-code-guides/claude-code-environment-variables-setup-and-best-practices).

## Security and team configuration checklist

Containerization isolates runtimes; it does not establish trust or authorization. A locally running server may still send data to external services. For MCP security, apply least privilege: Grant only the access required for the task.

[**Prompt injection**](https://agentkit.best/blog/claude-code-guides/claude-code-prompt-injection-risks-and-security-best-practices) occurs when external content contains instructions intended to redirect the assistant away from your authorized task.

OAuth does not automatically provide least privilege. Review requested permissions, and verify where each integration stores credentials.

### Choose configuration scope deliberately

Claude Code’s MCP documentation distinguishes these scopes:

MCP project scope supports configuration sharing, not secret sharing. Local scope is not a secure secret vault. Project configuration may also require user approval before activation.

### Standardize the minimum useful configuration

Document prerequisites, image identifiers, path conventions, and credential setup in the repository README. Shared client configuration alone does not reproduce Docker-side server settings.

## Frequently asked questions

### What is the Docker MCP Toolkit?

The Docker MCP Toolkit simplifies integrating containerized Model Context Protocol (MCP) servers with AI agents like Claude Code. It includes a discovery catalog and a gateway to connect servers, while packaging dependencies in containers to eliminate manual runtime management.

### How does Docker MCP Toolkit differ from running MCP servers directly?

Running MCP servers through Docker isolates their runtime dependencies and environment variables within containers. This prevents conflicts on your host system, ensures consistent behavior across different developer machines, and provides a unified interface, whereas direct execution requires maintaining independent environments for every tool.

### Is Docker Desktop required to use the MCP Toolkit?

While the Docker MCP Toolkit is most easily managed via the Docker Desktop interface, you can also manage connections using the Docker CLI. The CLI approach allows you to connect Claude Code to the Docker MCP Gateway manually if you prefer a terminal-based workflow or need to automate setups.

### Can I run Claude Code inside a secure Docker sandbox?

Yes, running Claude Code in an isolated container or microVM adds a system-level boundary. How much it protects depends on what you mount and expose — avoid home-directory mounts, forwarded credentials, and privileged containers.

### What should I do if Claude Code fails to connect to the MCP gateway?

First, verify that your Docker engine is running with `docker info`. Then, use `claude mcp list` to check if the gateway is correctly registered. Ensure that your project-specific or user-level configuration files are not conflicting and that you have restarted the Claude Code session after applying any changes.

### Does the MCP Toolkit automatically secure my credentials?

Not automatically. Credential handling is integration-dependent — verify where each server stores secrets, use supported OAuth or protected secret storage, and keep secrets out of .mcp.json and version control.

**Read more**:

## Conclusion

A reliable Docker MCP setup for Claude Code begins with verifying your CLI, engine, MCP component, and client prerequisites separately. Register Docker MCP Gateway once, restrict a test server to a safe directory, restart Claude Code, and run a read-only test prompt to validate actual tool invocation—not just gateway connectivity. 

Choose Docker for isolated dependencies and consistency, or direct configuration for simpler local scripts or remote endpoints; both still require strict permission and credential management. Documenting these checks in your repository README ensures a standardized, secure workflow for your entire team.
