Skip to main content
Glama

traefik-hub-mcp

MCP server for managing a local Traefik reverse proxy from Claude Code. Inspect routers, services, and middlewares; manage Docker containers; health-check domains; and configure CORS and middleware -- all without leaving your editor.

Installation

# Run directly (recommended for Claude Code)
npx traefik-hub-mcp

# Or install globally
npm install -g traefik-hub-mcp

Related MCP server: docker-compose-mcp

Prerequisites

  • Node.js >= 18

  • Docker running (Docker Desktop or daemon)

  • A Traefik stack managed via docker-compose.yml (see traefik-hub for a ready-made setup)

Environment Variables

Variable

Required

Default

Description

TRAEFIK_CONFIG_DIR

Yes

--

Path to Traefik config directory (contains traefik.yml and dynamic/)

TRAEFIK_HUB_DIR

Yes

--

Path to the Traefik Hub repo root (contains docker-compose.yml)

TRAEFIK_API_URL

No

http://localhost:8080

Traefik API base URL

TRAEFIK_DOMAIN_ALIASES

No

--

Comma-separated domain suffixes for multi-domain routing (e.g., local.domlee.dev)

Configuration

Claude Code

claude mcp add traefik -e TRAEFIK_HUB_DIR=/path/to/traefik-hub -e TRAEFIK_CONFIG_DIR=/path/to/traefik-hub/traefik -e TRAEFIK_API_URL=http://localhost:8080 -- npx -y traefik-hub-mcp

Or add manually to ~/.claude.json or project .mcp.json:

{
  "mcpServers": {
    "traefik": {
      "command": "npx",
      "args": ["-y", "traefik-hub-mcp"],
      "env": {
        "TRAEFIK_HUB_DIR": "/path/to/traefik-hub",
        "TRAEFIK_CONFIG_DIR": "/path/to/traefik-hub/traefik",
        "TRAEFIK_API_URL": "http://localhost:8080"
      }
    }
  }
}

Cursor

Add to Cursor Settings > MCP Servers:

{
  "mcpServers": {
    "traefik": {
      "command": "npx",
      "args": ["-y", "traefik-hub-mcp"],
      "env": {
        "TRAEFIK_HUB_DIR": "/path/to/traefik-hub",
        "TRAEFIK_CONFIG_DIR": "/path/to/traefik-hub/traefik",
        "TRAEFIK_API_URL": "http://localhost:8080"
      }
    }
  }
}

VS Code (Copilot)

Add to your VS Code settings.json:

{
  "mcp": {
    "servers": {
      "traefik": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "traefik-hub-mcp"],
        "env": {
          "TRAEFIK_HUB_DIR": "/path/to/traefik-hub",
          "TRAEFIK_CONFIG_DIR": "/path/to/traefik-hub/traefik",
          "TRAEFIK_API_URL": "http://localhost:8080"
        }
      }
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "traefik": {
      "command": "npx",
      "args": ["-y", "traefik-hub-mcp"],
      "env": {
        "TRAEFIK_HUB_DIR": "/path/to/traefik-hub",
        "TRAEFIK_CONFIG_DIR": "/path/to/traefik-hub/traefik",
        "TRAEFIK_API_URL": "http://localhost:8080"
      }
    }
  }
}

Cline

Add to Cline MCP settings:

{
  "mcpServers": {
    "traefik": {
      "command": "npx",
      "args": ["-y", "traefik-hub-mcp"],
      "env": {
        "TRAEFIK_HUB_DIR": "/path/to/traefik-hub",
        "TRAEFIK_CONFIG_DIR": "/path/to/traefik-hub/traefik",
        "TRAEFIK_API_URL": "http://localhost:8080"
      },
      "disabled": false
    }
  }
}

Tools

Traefik API

Tool

Description

traefik_status

Traefik version and component counts

list_routers

List HTTP routers (optionally filter by provider)

list_services

List HTTP services (optionally filter by provider)

list_middlewares

List all HTTP middlewares

get_router

Get details of a specific router

Docker

Tool

Description

list_containers

List containers on the traefik-public network

container_logs

Get logs from a container

restart_container

Restart a container

rebuild_service

Rebuild and recreate a Docker Compose service (docker compose up -d --build)

Health & Diagnostics

Tool

Description

check_health

Check if a domain is responding

doctor

Comprehensive stack health check (Docker, network, container, API, ports, config)

check_update

Check for newer Traefik versions and whether it's safe to update

check_setup

Verify MCP env vars and paths are correctly set

Stack Management

Tool

Description

start_traefik

Start the Traefik stack (docker compose up -d)

stop_traefik

Stop the Traefik stack (docker compose down)

create_network

Create the traefik-public Docker network

init_stack

Initialize from scratch (create network + start containers)

Configuration

Tool

Description

generate_labels

Generate docker-compose Traefik labels for a new project

add_middleware

Add a middleware to middlewares.yml (Traefik hot-reloads)

list_middleware_types

Show available middleware types with example configs

get_cors

Show current CORS configuration

update_cors

Add or remove origins from the cors-dev middleware

Multi-Domain Routing

Tool

Description

add_domain_route

Add multi-domain route for a service (LAN/Tailscale access)

remove_domain_route

Remove a multi-domain route

list_domain_routes

List all multi-domain routes

Development

git clone https://github.com/dominic-righthere/traefik-hub-mcp.git
cd traefik-hub-mcp
npm install
npm run build
npm test

License

MIT

Available Tools

25 tools
add_domain_routeC

Add multi-domain route for a service (makes it accessible via LAN/Tailscale)

Inputs: name (required), domain (required), service (required).

add_middlewareB

Add a new middleware to traefik/dynamic/middlewares.yml (Traefik hot-reloads automatically)

Inputs: name (required), type (required), config (required).

check_healthC

Check if a domain is responding

Inputs: domain (required).

check_setupB

Verify MCP configuration - checks that env vars and paths are correctly set

Inputs: no named parameters.

check_updateA

Check if a newer Traefik version is available and whether it's safe to update

Inputs: no named parameters.

container_logsC

Get logs from a Docker container

Inputs: name (required), tail.

create_networkA

Create the traefik-public Docker network. Requires Docker running.

Inputs: no named parameters.

doctorB

Comprehensive health check of the Traefik stack - checks Docker, network, container, API, ports, and config

Inputs: no named parameters.

generate_labelsC

Generate docker-compose traefik labels for a new project

Inputs: name (required), port (required), domain (required), middlewares.

get_corsA

Show current CORS configuration (allowed origins from cors-dev middleware)

Inputs: no named parameters.

get_routerC

Get details of a specific router

Inputs: name (required).

init_stackA

Initialize Traefik stack from scratch - creates network and starts containers. Requires Docker running.

Inputs: no named parameters.

list_containersA

List Docker containers on traefik-public network

Inputs: no named parameters.

list_domain_routesB

List all multi-domain routes (LAN/Tailscale access)

Inputs: no named parameters.

list_middlewaresC

List all HTTP middlewares

Inputs: no named parameters.

list_middleware_typesB

Show available middleware types with example configurations

Inputs: no named parameters.

list_routersB

List all HTTP routers with their rules and status

Inputs: provider.

list_servicesB

List all HTTP services registered in Traefik

Inputs: provider.

rebuild_serviceA

Rebuild and recreate a Docker Compose service (runs docker compose up -d --build <service>)

Inputs: name (required).

remove_domain_routeC

Remove a multi-domain route

Inputs: name (required).

restart_containerB

Restart a Docker container

Inputs: name (required).

start_traefikA

Start the Traefik stack (docker compose up -d). Requires Docker running.

Inputs: no named parameters.

stop_traefikA

Stop the Traefik stack (docker compose down). Requires Docker running.

Inputs: no named parameters.

traefik_statusB

Get Traefik overview - version and component counts

Inputs: no named parameters.

update_corsC

Add or remove origins from the cors-dev middleware

Inputs: add, remove.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 25 tools

    Disambiguation3/5

    Most tools target distinct resources, but several clusters overlap: traefik_status, doctor, check_health, and check_setup are four different flavors of 'check' that an agent could easily misselect, and init_stack is essentially a superset of create_network plus start_traefik. list_middlewares vs list_middleware_types is also a subtle distinction (configured vs available) that names alone don't clarify.

    Naming Consistency4/5

    The dominant pattern is snake_case verb_noun (list_routers, get_router, add_middleware, remove_domain_route), which is applied consistently across most tools. Deviations are minor: noun-first names like traefik_status, container_logs, and the bare doctor break the pattern but remain readable.

    Tool Count3/5

    At 25 tools this sits at the heavy end of the scale, spanning Traefik API inspection, Docker container ops, stack lifecycle, domain routing, CORS, and middleware config. Each area is legitimate, but the surface is broad enough that some tools (init_stack, check_setup, doctor) feel like conveniences layered on top of already-covered operations.

    Completeness4/5

    The server covers inspection and lifecycle well: routers/services/middlewares are readable, stack start/stop/init/create_network exist, containers can be listed/logged/restarted/rebuilt, and CORS/domain routes have full add/remove/get coverage. Gaps remain on the mutation side for middlewares (add but no update/remove single middleware) and no get_service or router create/update, though generate_labels partly compensates.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers