# Caddy MCP Server

> Caddy MCP Server is an open-source MCP server for cloud and infrastructure. Control a Caddy web server through its admin API: config, routes, TLS, PKI and metrics. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI
- **Website:** https://yaw.sh/mcp-servers/caddy-mcp/
- **Repository:** https://github.com/yawlabs/caddy-mcp
- **MCP Registry name:** io.github.YawLabs/caddy-mcp
- **Categories:** cloud and infrastructure, developer tools
- **Listing updated:** 2026-11-15

## About

Caddy's JSON config can be deeply nested, and this server lets an agent change it by describing intent, such as "Proxy api.local to localhost:3000". Eighteen tools and four resources cover every endpoint in Caddy's admin API reference (load, config paths, @id lookup, adapt, PKI CA, reverse proxy upstreams, metrics). Go runtime debug endpoints are deliberately left out.

Safety is a theme. Writes use ETags with `If-Match`, so a 412 is reported clearly. `caddy_config_set` defaults to idempotent overwrite, so repeating a call does not duplicate a route. Writing to the config root, which replaces everything, is refused without `confirm=true` and snapshots first, like `caddy_load`. `caddy_list_routes` copes with malformed config, and error messages show only the origin of the admin URL so tokens in a path do not leak. Metrics can be filtered by name with a line cap.

It runs locally via `npx -y @yawlabs/caddy-mcp@latest`. Caddy's admin API listens on localhost:2019 by default; `CADDY_ADMIN_URL`, an optional bearer token, retry and timeout settings and a snapshot directory are configurable. MIT licensed, from Yaw Labs.

## Features

- **Full admin API coverage:** Every documented endpoint is wrapped, with no placeholder tools.
- **Idempotent route writes:** Passing an id replaces a route instead of duplicating it.
- **Rollback snapshots:** Full configs are saved in memory or to a chosen directory.
- **Caddyfile conversion:** Adapts a config to JSON for review without applying it.
- **Filtered metrics:** Prometheus output can be narrowed by name and line count.
- **Credential-safe errors:** Connection failures show only the URL origin.

## Good for

- Add a reverse proxy by describing it in plain words
- Review which routes exist on a server
- Convert a Caddyfile to JSON before applying
- Ask which route is slowest from Prometheus metrics

## Install

### Claude Code (Terminal)

```sh
claude mcp add caddy-mcp -- npx -y @yawlabs/caddy-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "caddy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@yawlabs/caddy-mcp"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "caddy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@yawlabs/caddy-mcp"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "caddy-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@yawlabs/caddy-mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "caddy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@yawlabs/caddy-mcp"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "caddy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@yawlabs/caddy-mcp"
      ]
    }
  }
}
```

## Tools

- `caddy_load`: Load a full config, snapshotted first
- `caddy_config_set`: Write config at a path, idempotent overwrite by default
- `caddy_list_routes`: Summarise routes on a server
- `caddy_metrics`: Return Prometheus metrics, optionally filtered

## FAQ

### Is the admin API enabled by default?

Yes, on localhost:2019; point CADDY_ADMIN_URL elsewhere for Docker or remote hosts.

### Can it replace my whole config by accident?

A root write needs confirm=true and is snapshotted first.

### Does it need a token?

Only if you configured Caddy admin auth, via CADDY_API_TOKEN.

### What licence?

MIT.

### Is Caddy MCP Server free?

Yes. Caddy MCP Server is open source, so you can use and self-host it for free.

### How do I add Caddy MCP Server to Claude Code?

Run this command in your terminal: claude mcp add caddy-mcp -- npx -y @yawlabs/caddy-mcp

### What are the best alternatives to Caddy MCP Server?

The closest alternatives to Caddy MCP Server are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/caddy-mcp-server
