Content
# pdns-mcp-server
MCP server for managing DNS records with PowerDNS through the PowerDNS-Admin API.
## Architecture
```
src/pdns_mcp_server/
config.py — PdnsConfig: reads configuration from environment variables
client.py — PdnsClient: async HTTP client for PowerDNS-Admin API
tools.py — create_app(): registers MCP tools
main.py — entry point, starts streamable-http server
tests/
test_config.py — configuration tests
test_client.py — API client tests (respx mocks)
test_tools.py — MCP tool tests
test_main.py — entry point tests
```
## Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
| `PDNS_ADMIN_URL` | Yes | — | PowerDNS-Admin URL (e.g., `http://pda.example.com:9191`) |
| `PDNS_API_KEY` | Yes | — | API key for X-API-Key authentication |
| `PDNS_SERVER_ID` | No | `localhost` | PowerDNS server ID |
| `PDNS_PORT` | No | `8000` | MCP server port |
## MCP Tools
| Tool | Description |
|---|---|
| `list_zones` | List all DNS zones |
| `get_zone` | Zone details with records |
| `create_record` | Create/replace RRset in zone |
| `update_record` | Update record content |
| `delete_record` | Delete RRset |
Detailed parameters and examples are in [docs/usage.md](docs/usage.md).
## Running
```bash
export PDNS_ADMIN_URL=http://pda.example.com:9191
export PDNS_API_KEY=your-api-key-here
uv run pdns-mcp-server
```
The server will be available at `http://0.0.0.0:8000` (streamable-http transport).
### Docker
```bash
export PDNS_ADMIN_URL=http://pda.example.com:9191
export PDNS_API_KEY=your-api-key-here
docker compose up
```
## Testing
```bash
uv run pytest -v
```
All tests use `respx` for mocking HTTP requests — no real PowerDNS required.