Skip to main content
Glama
README.md
# mcp-caddy

MCP server for [Caddy](https://caddyserver.com/) web server management. Exposes 7 tools for inspecting routes, upstream health, certificates, and reloading configuration via the Caddy admin API.

## Quick Start

**With uvx (recommended):**
```bash
CADDY_HOST=http://10.0.0.31:2019 uvx mcp-caddy
```

**With Docker:**
```bash
docker run -i \
  -e CADDY_HOST=http://10.0.0.31:2019 \
  ghcr.io/aaronckj/mcp-caddy:latest
```

**Add to Claude Code:**
```bash
claude mcp add caddy -s user -e CADDY_HOST=http://10.0.0.31:2019 -- uvx mcp-caddy
```

## Configuration

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `CADDY_HOST` | No | `http://localhost:2019` | Caddy admin API URL |
| `CADDY_TIMEOUT` | No | `30` | HTTP timeout in seconds |

## Finding Your CADDY_HOST

The Caddy admin API binds to `localhost:2019` by default. Depending on your setup:

1. **MCP server on same host as Caddy** → use the default `http://localhost:2019`
2. **Caddy in Docker, MCP server on the same Docker host** → add `ports: ["127.0.0.1:2019:2019"]` to your Caddy compose service, then use `http://localhost:2019`
3. **Remote Caddy host** → SSH tunnel: `ssh -L 2019:localhost:2019 user@caddy-host`, then use `http://localhost:2019`
4. **Caddy exposes admin via reverse proxy** → set `CADDY_HOST=https://caddy-admin.example.com`

The Caddy admin API has no authentication by default. If you expose it beyond localhost, add Caddy basic auth to that route.

## Tools

| Tool | Description |
|------|-------------|
| `server_info` | Caddy version and loaded modules |
| `get_config` | Full configuration as JSON |
| `list_routes` | All virtual hosts with upstream targets |
| `list_upstreams` | Upstream proxy health status |
| `get_certificates` | TLS automation policies and ACME issuers |
| `adapt_config` | Convert a Caddyfile snippet to JSON |
| `reload` | Reload config from a JSON string or file path |

## Development

```bash
git clone https://github.com/aaronckj/mcp-caddy
cd mcp-caddy
uv sync --extra dev
uv run pytest -v
```

TDQS

A3.8/5.0

Scored across 16 tools

Disambiguation5/5

Each tool targets a distinct operation: adding different route types, listing different resources, getting specific config nodes, etc. No overlapping purposes; descriptions clearly differentiate.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., add_reverse_proxy_route, list_servers, delete_route). Only 'reload' is a single verb but it's standard and fits the pattern.

Tool Count5/5

With 16 tools, the server is well-scoped for managing Caddy configurations. Each tool serves a clear purpose without excessive granularity or missing essential operations.

Completeness5/5

The set covers full lifecycle: create (add_*), read (list, get), update (update_config_path), delete (delete_route/delete_config_path), plus reload, config adaptation, and certificate info. No obvious gaps for typical Caddy management.

Maintenance

ActivityInactive
ResponsivenessNo issues