Docker Swarm

v1.0.0Cloud Servicesstable

MCP server for Docker Swarm orchestration using FastAPI and Docker SDK

devopsdockerdocker-swarmfastapihttp
Share:
8
Stars
0
Downloads
0
Weekly
0/5

What is Docker Swarm?

Docker Swarm is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server for docker swarm orchestration using fastapi and docker sdk

MCP server for Docker Swarm orchestration using FastAPI and Docker SDK

This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • MCP server for Docker Swarm orchestration using FastAPI and

Use Cases

Docker Swarm orchestration
Container cluster management
LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 7, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx docker-swarm

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Docker Swarm

The Docker Swarm MCP Server exposes Docker Swarm orchestration capabilities as MCP tools via an HTTP/JSON-RPC interface built with FastAPI and the Docker Python SDK. It supports service management, stack deployment, overlay networking, secrets handling, and node inspection — all secured with bearer token authentication and designed for production Swarm clusters.

Prerequisites

  • Docker Engine in Swarm mode (`docker swarm init` on the manager node)
  • Python 3.10 or later with pip, or Docker for container-based deployment
  • Access to the Docker socket (unix:///var/run/docker.sock) on the Swarm manager
  • A secure bearer token string for MCP_ACCESS_TOKEN
  • Claude Desktop or Claude Code with HTTP MCP transport support
1

Initialize Docker Swarm (if not already done)

Initialize Docker Swarm on your manager node. Skip this step if Swarm is already active.

docker swarm init
2

Deploy the MCP server as a Docker Stack

Deploy the server using the provided docker-swarm-mcp.yml compose file. Set MCP_ACCESS_TOKEN to a strong random string.

export MCP_ACCESS_TOKEN="your-secure-random-token"
docker stack deploy -c docker-swarm-mcp.yml mcp-server
3

Verify the server is running

Check the service logs to confirm the FastAPI server started successfully and is listening on port 8000.

docker service logs mcp-server_docker-mcp
4

Test authentication with curl

Send a test request to the MCP endpoint to verify bearer token authentication works.

curl -X POST http://localhost:8000/mcp/ \
  -H "Authorization: Bearer your-secure-random-token" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":"1","method":"tools/list","params":{}}'  
5

Add to Claude Desktop or Claude Code

Configure your MCP client to connect to the running HTTP server using the bearer token. For Claude Code, use the claude mcp add command.

claude mcp add --transport http docker-swarm-mcp \
  --header "X-Access-Token: your-secure-random-token" \
  http://localhost:8000/mcp/

Docker Swarm Examples

Client configuration

Claude Desktop config for the Docker Swarm MCP server using HTTP transport with bearer auth.

{
  "mcpServers": {
    "docker-swarm-mcp": {
      "transport": {
        "type": "http",
        "url": "http://localhost:8000/mcp/",
        "headers": {
          "Authorization": "Bearer your-secure-random-token"
        }
      }
    }
  }
}

Prompts to try

Swarm management tasks you can perform through natural language.

- "List all running Docker Swarm services and their replica counts."
- "Scale the web service to 5 replicas."
- "Deploy my application stack from the compose file at /stacks/myapp.yml."
- "Show all Swarm nodes and identify which ones are managers."
- "Create an overlay network called app-net with encryption enabled."

Troubleshooting Docker Swarm

401 Unauthorized when calling MCP endpoints

Ensure the Authorization header value matches the MCP_ACCESS_TOKEN environment variable exactly, including case. The header format must be 'Bearer <token>' with a space after Bearer.

Docker socket permission denied inside the container

The container needs access to /var/run/docker.sock. In your stack YAML, mount the socket as a volume: `- /var/run/docker.sock:/var/run/docker.sock`. Ensure the container user has permission to read the socket.

Service deploys but port 8000 is not reachable

Check that the Swarm service publishes port 8000. In the docker-swarm-mcp.yml file, confirm the ports section includes `- published: 8000, target: 8000, mode: host`. Also check host firewall rules.

Frequently Asked Questions about Docker Swarm

What is Docker Swarm?

Docker Swarm is a Model Context Protocol (MCP) server that mcp server for docker swarm orchestration using fastapi and docker sdk It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Docker Swarm?

Follow the installation instructions on the Docker Swarm GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Docker Swarm?

Docker Swarm works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Docker Swarm free to use?

Yes, Docker Swarm is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Cloud Services MCP Servers

Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "docker-swarm": { "command": "npx", "args": ["-y", "docker-swarm"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Docker Swarm?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides