Caddy Module

The Caddy module lets you run mcp-anything as a native Caddy directive — no standalone proxy binary, no separate sidecar. Caddy handles TLS, routing, and access logging; mcp-anything handles MCP tool generation.

Build a Caddy binary with the module

Use xcaddy to compile a custom Caddy binary that includes the mcp-anything handler:

xcaddy build \
  --with github.com/gaarutyunov/mcp-anything/caddy

Or use the pre-built Docker image that ships with the module already embedded:

docker pull ghcr.io/gaarutyunov/mcp-anything-caddy:latest

Caddyfile configuration

:443 {
  tls /etc/tls/cert.pem /etc/tls/key.pem

  route /mcp* {
    mcp_anything {
      config /etc/mcp-anything/config.yaml
    }
  }

  # All other routes handled by Caddy as normal
  reverse_proxy /api/* backend:8080
}

JSON config (Caddy API)

If you manage Caddy via its admin API, the handler can be configured in JSON:

{
  "handler": "mcp_anything",
  "config": "/etc/mcp-anything/config.yaml"
}

Hot-reload

The mcp-anything config inside Caddy supports the same fsnotify-based hot-reload as the standalone binary. A caddy reload also triggers a full config reload.

TLS

Caddy manages TLS automatically (ACME/Let's Encrypt). The mcp-anything module does not need separate TLS configuration — it inherits Caddy's listener. The Gateway Transport TLS settings still apply to outbound connections from the proxy to upstream APIs.

Differences from the standalone binary

FeatureStandalone binaryCaddy module
TLS terminationManual or via a reverse proxyAutomatic (ACME)
Multiple MCP endpointsgroups[].endpointroute blocks in Caddyfile
Access logslog/slog structured JSONCaddy access log format
Process managementsystemd / DockerCaddy's own process

See also

  • Gateway Transport — outbound TLS and connection pooling
  • Hot-Reload — config reloading inside the module
  • Go SDK — embedding the proxy in other Go HTTP servers