Skip to main content
Glama
Traefik MCP Server
by gaelhc

Traefik MCP Server

A Model Context Protocol (MCP) server for Traefik reverse proxy instances.

Forked from theupriser/treafik-mcp

Overview

This MCP server enables AI assistants to query and inject Traefik configurations in LLM context window.

Related MCP server: Traefik MCP Server

Features

  • 🔍 Query Traefik entrypoints, routers, services, and middlewares

  • 📊 Get comprehensive configuration and statistics in markdown format

  • ⚙️ View summary lists or detailed configuration for individual components

  • ⚙️ Support stdio or http/sse transport

  • 🚀 Run locally or in Docker container

Work in progress

  • 🔒 Support for both API key and basic authentication for containerized deployment

Installation

Prerequisites

  • Python 3.13 or higher

  • uv package manager

  • A running Traefik instance with Dashboard enabled

Local Development Setup

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-traefik
  2. Create virtual environment and install dependencies:

    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    uv pip install -e ".[dev]"
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your own configuration
  4. Run locally:

    python -m traefik_mcp.server

Docker container

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-traefik
  2. Adapt docker-compose.yml environment and run:

    docker compose up -d

Docker container setup only support http/ssetransport

Configuration

Set the following environment variables:

Required

  • TRAEFIK_API_URL: URL of your Traefik Dashboard endpoint (e.g., http://localhost:8080)

Transport

  • MCP_TRANSPORT: Type of transport, must be 'stdio' or 'http'

  • MCP_HOST: Host IP adres, default '0.0.0.0' (for 'http' transport only)

  • MCP_PORT: Host port, default '8080' (for 'http' transport only)

Authentication (choose one)

  • TRAEFIK_API_KEY: API key for Bearer token authentication

  • TRAEFIK_BASIC_AUTH_USERNAME: Username for basic authentication

  • TRAEFIK_BASIC_AUTH_PASSWORD: Password for basic authentication

Optional

  • MCP_LOG_LEVEL: Logging level (default: INFO)

Note: API key authentication takes precedence over basic authentication if both are configured.

Integration with AI Clients

VSCode integration

Add to your VSCode configuration file (e.g. .vscode/mcp.json):

Local

{
  "servers": {
    "traefik": {
      "command": "/path/to/traefik-mcp/.venv/bin/traefik-mcp",
      "args": [],
      "env": {
        "TRAEFIK_API_URL": "http://localhost:8080",
        "TRAEFIK_BASIC_AUTH_USERNAME": "admin",
        "TRAEFIK_BASIC_AUTH_PASSWORD": "admin"
      }
    }
  }
}

Distant deployment in Docker container

{
  "servers": {
    "traefik": {
      "url": "http://localhost:8080/mcp/sse"
      }
    }
  }
}

Local alternative using uv

{
  "mcpServers": {
    "traefik": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/traefik-mcp",
        "run",
        "traefik-mcp"
      ],
      "env": {
        "TRAEFIK_API_URL": "http://localhost:8080"
      }
    }
  }
}

Available Tools

The MCP server provides the following tools:

  • get_traefik_overview: Get comprehensive overview of all Traefik components

  • get_version: Get version of Traefik instance

  • get_entrypoint: Get a summarized list of entrypoints, or a detailled report of a given entrypoint

  • get_router: Get a summarized list of routers, or a detailled report of a given router, for http, tcp, and udp protocols

  • get_service: Get a summarized list of services, or a detailled report of a given service, for http, tcp, and udp protocols

  • get_middleware: Get a summarized list of middlewares, or a detailled report of a given middleware, for http, tcp, and udp protocols

Example Usage

Once configured, you can ask questions like:

  • "Show me all routers in my Traefik setup"

  • "What services are running behind the traefik.test router?"

  • "List all middlewares configured for Docker provider"

  • "Give me an overview of my Traefik instance"

  • "Is my Traefik configuration secured ?"

See QUALIFICATION.md for an integration test in french ;).

Development

Running Tests

pytest

Code Formatting

black src/ tests/
ruff check src/ tests/

Type Checking

mypy src/

Troubleshooting

Common Issues

Server shows 0 routers/services

  • Ensure your Traefik API is accessible at the configured URL

  • Verify authentication credentials are correct

  • Check that Traefik API is enabled in your configuration

Authentication failures

  • Verify basic auth credentials match your Traefik configuration

  • If using API key, ensure it's correctly formatted

  • API key takes precedence over basic auth if both are set

Connection errors

  • Check that TRAEFIK_API_URL is reachable from the MCP server

  • Verify Traefik is running and API is enabled

  • Check network/firewall settings

Testing the Server

You can test the MCP server manually:

# Set environment variables and run
export TRAEFIK_API_URL="http://localhost:8080"
export TRAEFIK_BASIC_AUTH_USERNAME="admin"
export TRAEFIK_BASIC_AUTH_PASSWORD="admin"
uv run traefik-mcp

Contributing

Contributions are welcome! Do not hesitate to propose pull request. Just make sure to conform with Code architecture, formats and tests.

Consult .windsurf/rules/project-rules.md.

License

This depot is a fork from https://github.com/theupriser/treafik-mcp. Please visit this original depot for more informations about original commits.

MIT License - See LICENSE file for details

Resources

Available Tools

6 tools
get_entrypointC

Get informations about entrypoints

Inputs: name.

get_middlewareC

Get information about middlewares

Inputs: protocol (required), name.

get_overviewC

Get an overview of the Traefik instance configuration

Inputs: no named parameters.

get_routerC

Get information about routers

Inputs: protocol (required), name.

get_serviceC

Get information about services

Inputs: protocol (required), name.

get_versionA

Get the Traefik API version

Inputs: no named parameters.

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 6 tools

    Disambiguation4/5

    Each tool targets a distinct Traefik resource (entrypoints, middlewares, services, routers), so boundaries are mostly clear. get_overview and get_version could be confused since overview might include version info, but the descriptions imply different scopes.

    Naming Consistency5/5

    All six tools follow a strict get_<noun> pattern with snake_case. The only nit is singular vs. plural resource nouns (get_entrypoint returning a list), but the convention itself is fully uniform.

    Tool Count4/5

    Six tools is a reasonable, well-scoped surface for a Traefik API read interface. It is slightly thin because the server exposes only one verb across the whole domain.

    Completeness3/5

    Core Traefik resources (routers, services, middlewares, entrypoints) are covered, which fits a read-only API. However, obvious gaps remain: no TLS/certificate inspection, no health/ping, and no way to fetch a single resource by name for targeted lookups.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to query and manage Traefik reverse proxy configurations, including routers, services, and middlewares, through natural language. It supports monitoring service health, viewing statistics, and performing administrative tasks across various providers like Docker.
      6
      6
      -
    • A
      license
      A
      quality
      B
      maintenance
      Connects a personal KodeKloud learning account to AI assistants such as Claude Desktop, Claude Code, Cursor, and ChatGPT, letting users review course progress and syllabi, inspect running hands-on labs, check certification exam readiness for CKA/CKAD/CKS/Terraform, track KodeKloud Engineer tasks, and generate weekly study plans through natural language. It runs read-only by default over stdio or remote SSE/streamable-HTTP transport, with session credentials auto-detected from a browser cookie or bearer token and redacted from all logs.
      9
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI assistants to inspect and operate a Jenkins instance — discovering jobs, views, nodes, and plugins; reviewing build chains, parameters, last-build status, console output, test reports, and artifacts; and triggering builds, stopping runs, or answering pipeline inputs. It connects over stdio, SSE, or streamable HTTP with optional credentials, read-only mode, and a credential-free health endpoint.
      31
      1
      MIT