How to Connect n8n with Docker MCP Toolkit: A Simple HTTP Bridge Solution

Solving the n8n community's #1 integration challenge with a practical HTTP bridge solution

How to Connect n8n with Docker MCP Toolkit: A Simple HTTP Bridge Solution
Architecture of Docker MCP Toolkit + n8 + HTTP Bridge

Let's start with the problem statement...

The n8n community has been asking: "How can n8n interact with Docker MCP Toolkit?"

๐Ÿ’ก
"I'm using n8n v1.93.0 self-hosted with Docker. Docker can expose MCP servers via the MCP Toolkit. I was wondering if it was possible to make n8n MCP tool node or the MCP client community node interact with the Docker's MCP server. I tried multiple ways without success: Command line stdio, HTTP Streamable."

The core issue: Docker MCP Toolkit runs at the host level with docker mcp commands, while n8n runs in containers that can't directly access these CLI commands.

Understanding Docker MCP Toolkit

Before diving into the solution, let's understand what we're connecting to.

Docker MCP Catalog

Docker MCP Catalog is a trusted hub for discovering and accessing verified MCP servers, seamlessly integrated into Docker Hub with over 100 verified tools at launch.

  • 119+ verified MCP servers from Google, GitHub, Slack, Atlassian, Notion, GitLab, Shopify, Grafana, Pulumi
  • Publisher verification and versioned releases
  • Trusted distribution through Docker Hub's proven infrastructure

Docker MCP Toolkit Features

Docker MCP Toolkit is a suite of tools and services that make MCP servers secure, seamless, and instantly usable on your local machine or anywhere Docker runs.

  • One-click server launches from Docker Desktop
  • Built-in OAuth credential management
  • Universal client support (Claude Desktop, VS Code, Cursor, Continue.dev, Gordon)
  • Enterprise-grade security through containerization

The docker mcp CLI

The docker mcp CLI is a powerful command-line tool that serves as the interface for managing the Docker Model Context Protocol (MCP) environment. It enables developers to connect AI assistants to external tools securely, without having to manually configure each connection. As part of the Docker MCP Toolkit, this CLI brings the legendary Docker simplicity to the world of AI agent tooling.

docker mcp --help
Usage: docker mcp [OPTIONS]

Available Commands:
  catalog     Manage the catalog
  client      Connect/disconnect MCP clients  
  secret      Manage secrets securely
  server      Manage MCP servers
  tools       List/count/call MCP tools

Key CLI Operations:

# Enable GitHub MCP server
docker mcp server enable github-official

# List available tools
docker mcp tools list
# Output: create_repository, search_repositories, create_or_update_file...

# Execute tools directly
docker mcp tools call create_repository name="test-repo" description="Created via CLI"

# Manage secrets securely
docker mcp secret set GITHUB.PERSONAL_ACCESS_TOKEN=github_pat_xxx

The Bridge Solution

MCP Gateway doesn't have HTTP/REST API flags. It's designed for MCP protocol connections (like Claude Desktop), not HTTP endpoints.

One solution is an HTTP bridge that translates n8n's HTTP requests into docker mcp CLI commands:

[n8n Workflow] โ†’ HTTP Request โ†’ [Bridge:3001] โ†’ docker mcp command โ†’ [MCP Server]
      โ†“                                                                    โ†“
[Process Response] โ† JSON Response โ† [Bridge] โ† JSON Output โ† [External API]

Why This Works:

  • โœ… n8n speaks HTTP - native workflow integration
  • โœ… Bridge translates to CLI - leverages full Docker MCP power
  • โœ… Secure execution - controlled command execution
  • โœ… JSON responses - structured data for workflows

Implementation

The HTTP Bridge (mcp-http-bridge.js)

const express = require('express');
const { exec } = require('child_process');
const cors = require('cors');

const app = express();
const port = 3001;

app.use(express.json());
app.use(cors());

// Health check endpoint
app.get('/health', (req, res) => {
    res.json({ 
        status: 'Bridge running', 
        timestamp: new Date().toISOString(),
        endpoints: [
            'GET /health',
            'GET /test', 
            'POST /tools/{toolName}',
            'POST /tools/create_or_update_file'
        ]
    });
});

// Test endpoint with Docker MCP integration
app.get('/test', (req, res) => {
    exec('docker mcp tools call get_me', (error, stdout, stderr) => {
        if (error) {
            return res.status(500).json({ 
                bridge_status: 'running',
                mcp_connection: 'failed',
                error: error.message 
            });
        }
        
        try {
            const userData = JSON.parse(stdout);
            res.json({
                bridge_status: 'running',
                mcp_connection: 'success',
                sample_data: {
                    user: userData.login,
                    name: userData.name
                }
            });
        } catch (parseError) {
            res.json({ 
                bridge_status: 'running',
                mcp_connection: 'success',
                raw_response: stdout 
            });
        }
    });
});

// Generic MCP tool call endpoint
app.post('/tools/:toolName', async (req, res) => {
    const { toolName } = req.params;
    const { arguments: toolArgs } = req.body;
    
    try {
        const argsString = toolArgs ? JSON.stringify(toolArgs) : '{}';
        // This is the key: HTTP โ†’ docker mcp CLI translation
        const command = `docker mcp tools call ${toolName} '${argsString}'`;
        
        console.log(`Executing: ${command}`);
        
        exec(command, (error, stdout, stderr) => {
            if (error) {
                console.error(`Error: ${error}`);
                return res.status(500).json({ 
                    success: false,
                    error: error.message,
                    stderr: stderr 
                });
            }
            
            try {
                const result = JSON.parse(stdout);
                res.json({ 
                    success: true, 
                    tool: toolName,
                    data: result 
                });
            } catch (parseError) {
                res.json({ 
                    success: true,
                    tool: toolName, 
                    data: stdout,
                    raw: true 
                });
            }
        });
        
    } catch (error) {
        res.status(500).json({ 
            success: false,
            error: 'Bridge execution failed',
            details: error.message 
        });
    }
});

// Specialized GitHub file operations endpoint
app.post('/tools/create_or_update_file', async (req, res) => {
    const { arguments: fileArgs } = req.body;
    
    const command = `docker mcp tools call create_or_update_file '${JSON.stringify(fileArgs)}'`;
    
    exec(command, (error, stdout, stderr) => {
        if (error) {
            return res.status(500).json({ 
                success: false,
                error: error.message 
            });
        }
        
        try {
            const result = JSON.parse(stdout);
            res.json({ 
                success: true, 
                tool: 'create_or_update_file',
                data: result 
            });
        } catch (parseError) {
            res.json({ 
                success: true, 
                tool: 'create_or_update_file',
                data: stdout, 
                raw: true 
            });
        }
    });
});

app.listen(port, () => {
    console.log(`๐ŸŒ‰ MCP HTTP Bridge running on http://localhost:${port}`);
    console.log(`๐Ÿ”— Bridging n8n workflows to Docker MCP Toolkit`);
    console.log(`๐Ÿ“‹ Test: curl http://localhost:${port}/health`);
});

module.exports = app;

Package Dependencies (package.json)

{
  "name": "n8n-docker-mcp-bridge",
  "version": "1.0.0",
  "description": "HTTP bridge connecting n8n workflows to Docker MCP Toolkit",
  "main": "mcp-http-bridge.js",
  "scripts": {
    "start": "node mcp-http-bridge.js",
    "dev": "nodemon mcp-http-bridge.js",
    "test": "curl http://localhost:3001/health"
  },
  "dependencies": {
    "express": "^4.18.2",
    "cors": "^2.8.5"
  },
  "devDependencies": {
    "nodemon": "^3.0.1"
  },
  "keywords": [
    "n8n", "docker", "mcp", "bridge", "automation", "ai"
  ],
  "license": "MIT"
}

๐Ÿงช Testing the Bridge

Prerequisites

  1. Docker Desktop 4.42.0+ with MCP Toolkit enabled
  2. GitHub MCP Server configured in Docker
  3. n8n running on port 5678
  4. Node.js 18+ for the bridge

Setup Commands

# 1. Clone the repository
git clone https://github.com/ajeetraina/n8n-docker-mcptoolkit
cd n8n-docker-mcptoolkit

# 2. Start n8n (in background)
docker compose up -d

# 3. Install bridge dependencies
npm install

# 4. Run an MCP HTTP Bridge
node mcp-http-bridge.js

Keep the above script running. Open a new terminal and test the following

Expected Output:


๐ŸŒ‰ MCP HTTP Bridge running on http://localhost:3001
Endpoints:
  POST /tools/create_or_update_file
  POST /tools/{toolName}
  GET  /test
  GET  /health

Bridge Tests

Test 1: Bridge health

curl http://localhost:3001/health
{"status":"MCP HTTP Bridge Ready","port":3001}%                        

Test 2: Docker MCP Toolkit Integration Test

curl http://localhost:3001/test
{"success":true,"data":"Tool call took: 509.164084ms\n{\"login\":\"ajeetraina\",\"id\":313480,\"node_id\":\"MDQ6VXNlcjMxMzQ4MA==\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/313480?v=4\",\"html_url\":\"https://github.com/ajeetraina\",\"gravatar_id\":\"\",\"name\":\"Ajeet Singh Raina, Docker Captain, ARM Innovator,\",\"company\":\"Docker Inc\",\"blog\":\"http://www.collabnix.com\",\"location\":\"Bengaluru\",\"email\":\"ajeetraina@gmail.com\",\"hireable\":true,\"bio\":\"Docker Captain, ARM Innovator, Work for Docker Inc, Docker Community Leader, Tip of the Captain's Hat Award Winner, Docker Community Winner @ Dockercon\",\"twitter_username\":\"ajeetsraina\",\"public_repos\":616,\"public_gists\":186,\"followers\":906,\"following\":10,\"created_at\":\"2010-06-24T09:10:23Z\",\"updated_at\":\"2025-06-26T01:55:05Z\",\"type\":\"User\",\"site_admin\":false,\"url\":\"https://api.github.com/users/ajeetraina\",\"events_url\":\"https://api.github.com/users/ajeetraina/events{/privacy}\",\"following_url\":\"https://api.github.com/users/ajeetraina/following{/other_user}\",\"followers_url\":\"https://api.github.com/users/ajeetraina/followers\",\"gists_url\":\"https://api.github.com/users/ajeetraina/gists{/gist_id}\",\"organizations_url\":\"https://api.github.com/users/ajeetraina/orgs\",\"received_events_url\":\"https://api.github.com/users/ajeetraina/received_events\",\"repos_url\":\"https://api.github.com/users/ajeetraina/repos\",\"starred_url\":\"https://api.github.com/users/ajeetraina/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/ajeetraina/subscriptions\"}\n","stderr":""}%                   


# Test 3: Generic GitHub tool call
curl -X POST http://localhost:3001/tools/get_me \
  -H "Content-Type: application/json" \
  -d '{"arguments": {}}'

# Test 4: Create a GitHub repository
curl -X POST http://localhost:3001/tools/create_repository \
  -H "Content-Type: application/json" \
  -d '{
    "arguments": {
      "name": "bridge-test-repo",
      "description": "Created via n8n โ†’ Bridge โ†’ Docker MCP"
    }
  }'

๐Ÿ”„ n8n Integration Examples

Basic GitHub Integration Workflow

{
  "name": "GitHub via Docker MCP",
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:3001/tools/get_me",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "body": {
          "arguments": {}
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "position": [820, 300],
      "name": "Get GitHub User"
    },
    {
      "parameters": {
        "method": "POST", 
        "url": "http://localhost:3001/tools/create_repository",
        "body": {
          "arguments": {
            "name": "n8n-created-repo",
            "description": "Repository created via n8n workflow"
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "position": [1040, 300],
      "name": "Create Repository"
    }
  ],
  "connections": {
    "Get GitHub User": {
      "main": [
        [
          {
            "node": "Create Repository",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Dynamic Tool Discovery Workflow

{
  "name": "Docker MCP Tool Discovery",
  "nodes": [
    {
      "parameters": {
        "method": "GET",
        "url": "http://localhost:3001/health"
      },
      "type": "n8n-nodes-base.httpRequest",
      "name": "Check Bridge Status"
    },
    {
      "parameters": {
        "jsCode": "// Process available tools and create dynamic workflows\nconst bridgeStatus = $input.first().json;\nif (bridgeStatus.bridge_status === 'running') {\n  return [{\n    json: {\n      message: 'Bridge ready for Docker MCP operations',\n      available_endpoints: bridgeStatus.endpoints\n    }\n  }];\n}\nthrow new Error('Bridge not ready');"
      },
      "type": "n8n-nodes-base.code",
      "name": "Process Bridge Response"
    }
  ]
}

Docker Compose Setup


services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=password
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres

  postgres:
    image: postgres:15-alpine
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=n8n
    volumes:
      - postgres_data:/var/lib/postgresql/data

  mcp-bridge:
    build: ./bridge
    ports:
      - "3001:3001"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - NODE_ENV=production

volumes:
  n8n_data:
  postgres_data:

Bridge Dockerfile

FROM node:18-alpine

WORKDIR /app

# Install Docker CLI for host communication
RUN apk add --no-cache docker-cli

COPY package*.json ./
RUN npm ci --only=production

COPY . .

USER node

EXPOSE 3001

CMD ["npm", "start"]

Multi-Server Operations

# Enable multiple MCP servers
docker mcp server enable github-official
docker mcp server enable slack
docker mcp server enable notion
docker mcp server enable kubernetes

# n8n can now orchestrate across all enabled servers

Workflow Examples

  1. GitHub โ†’ Slack Notifications
    • Monitor GitHub via MCP โ†’ Process changes โ†’ Send Slack messages via MCP
  2. Kubernetes Deployment Pipeline
    • Create GitHub repository โ†’ Deploy to Kubernetes cluster โ†’ Update Notion docs
  3. Multi-Platform Content Sync
    • Update in Notion โ†’ Sync to GitHub docs โ†’ Notify team in Slack

Conclusion

This HTTP bridge solution transforms the n8n + Docker MCP integration challenge into a simple, production-ready connection. By leveraging Docker's trusted MCP ecosystem and n8n's powerful workflow engine, teams can now build sophisticated AI-powered automations with enterprise security and reliability.

The bridge approach proves that sometimes the simplest solutions are the most effective: translate HTTP to CLI, let Docker handle the complexity, and focus on building amazing workflows.

Further Readings

Start building powerful AI workflows today! ๐ŸŽฏ

Visual Studio Code Developers: How Docker MCP Toolkit Unlocks GitHub Copilotโ€™s Full Potential
VS Code developers using GitHub Copilot are already experiencing the power of AI-assisted development. But what if your AI assistant could do more than just write code?
How to Set Up Docker MCP Toolkit with Claude Desktop!
Look, Iโ€™ve been working with AI tools for a while now, and this Docker MCP setup is honestly one of the most impressive things Iโ€™ve seen.
How to Build AI-Powered Discord Communities: Claude + Docker MCP Toolkit Guide
No coding required: Connect Claude AI to Discord using Docker MCP Toolkit for smarter community management