100 lines
3.8 KiB
Markdown
100 lines
3.8 KiB
Markdown
# STRATO DNS MCP
|
|
|
|
**English** | [Deutsch](README.de.md)
|
|
|
|
An MCP server that manages the CNAME and TXT records of **one** DNS zone hosted
|
|
at the German provider STRATO. STRATO offers no DNS API for regular hosting
|
|
packages, so the server uses the customer portal the same way the public
|
|
[`certbot-dns-strato`](https://github.com/FlixMa/certbot-dns-strato) plugin does.
|
|
|
|
## Features
|
|
|
|
- List CNAME/TXT records, check whether a name already resolves as expected
|
|
- Create, update and delete CNAME and TXT records (e.g. `_acme-challenge`, `_dmarc`)
|
|
- Every change is two-step: preview with a single-use ticket, then apply with
|
|
`confirm=true`; refused if the zone changed in between
|
|
- All other records **and all other form fields** of the STRATO form are sent
|
|
back unchanged, writes run under a lock and are verified by reading again
|
|
- Session reuse (up to 10 minutes), 2FA/TOTP support, write gate
|
|
|
|
## Requirements
|
|
|
|
- Python 3.13 and [uv](https://docs.astral.sh/uv/) (or pip)
|
|
- A STRATO customer login with access to the domain; TOTP secret if 2FA is enabled
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
git clone <repository-url> Strato-MCP
|
|
cd Strato-MCP
|
|
sh scripts/elevator-install.sh # creates .venv from the hash-pinned requirements.lock
|
|
```
|
|
|
|
Register it in your MCP client as a stdio server, e.g.:
|
|
|
|
```json
|
|
{
|
|
"mcpServers": {
|
|
"strato": {
|
|
"command": "/path/to/Strato-MCP/.venv/bin/python",
|
|
"args": ["-u", "/path/to/Strato-MCP/strato_mcp.py"],
|
|
"env": { "MCP_TRANSPORT": "stdio", "STRATO_DOMAIN": "example.de", "...": "..." }
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
`MCP_TRANSPORT=streamable-http` serves HTTP on `MCP_HOST` (default `127.0.0.1`)
|
|
and `PORT` (default `8000`). The script also works as the post-clone step of
|
|
[MCPelevator](https://github.com/pacnpal/mcpelevator).
|
|
|
|
## Configuration
|
|
|
|
| Variable | Required | Meaning |
|
|
|---|---|---|
|
|
| `STRATO_USERNAME`, `STRATO_PASSWORD` | yes | STRATO customer login |
|
|
| `STRATO_DOMAIN` | yes | the one DNS zone to manage, e.g. `example.de` |
|
|
| `STRATO_PACKAGE_ID` | no | package `cID`; skips the package lookup |
|
|
| `STRATO_TOTP_SECRET`, `STRATO_TOTP_DEVICE` | with 2FA | TOTP secret (base32) and device name as shown by STRATO |
|
|
| `STRATO_WRITE_ENABLED` | no | `true` allows changes; previews always work |
|
|
| `STRATO_TIMEOUT_SECONDS` | no | HTTP timeout, default `20` |
|
|
|
|
Template: [`strato.env.example`](strato.env.example). Keep real values out of Git.
|
|
|
|
## Usage
|
|
|
|
| Tool | Effect |
|
|
|---|---|
|
|
| `strato_connection_status` | log in and check that the zone is readable |
|
|
| `strato_list_records` | list CNAME and/or TXT records, optional filter |
|
|
| `strato_list_cnames` | CNAME records only |
|
|
| `strato_preview_change` | compute a create/update/delete without writing, issue a 10-minute ticket |
|
|
| `strato_apply_change` | apply exactly that preview with the ticket and `confirm=true` |
|
|
| `strato_check_dns` | resolve a name and compare it with the STRATO record |
|
|
|
|
TXT records at the zone apex (e.g. SPF) are only listed; manage them in the
|
|
STRATO web interface. With several TXT records of the same name, `old_value`
|
|
selects the one meant. CNAME targets are always written fully qualified
|
|
(trailing dot).
|
|
|
|
## Security
|
|
|
|
The server holds your STRATO login. Run it only where the environment is
|
|
protected, keep `STRATO_WRITE_ENABLED` off unless needed, and let an AI agent
|
|
apply changes only after a human approved the preview. Credentials, TOTP values,
|
|
cookies and session IDs are never logged or returned.
|
|
|
|
## Development
|
|
|
|
```sh
|
|
uv run --no-project --python 3.13 --with "mcp==1.29.0" \
|
|
python -m unittest -v tests/test_strato_readonly.py tests/test_strato_changes.py
|
|
```
|
|
|
|
The tests are offline and never contact STRATO. Update dependencies with
|
|
`uv pip compile requirements.in --python-version 3.13 --python-platform x86_64-unknown-linux-gnu --generate-hashes -o requirements.lock`.
|
|
|
|
## License
|
|
|
|
MIT, see [LICENSE](LICENSE). Not affiliated with STRATO AG.
|