Add proxy-host lifecycle verbs: delete/enable/disable (#4)

* feat(proxy-hosts): add delete, enable, and disable verbs (#1)

Add delete_proxy_host (DELETE /nginx/proxy-hosts/{id}), enable_proxy_host
(POST .../enable) and disable_proxy_host (POST .../disable) MCP verbs plus
client methods, following existing NpmClient auth + tool patterns. README
documents the new tools with placeholder-only examples.

* docs(proxy-hosts): correct enable/disable idempotency wording (#2)

NPM's POST /enable and /disable return HTTP 400 when the host is already in
the target state; update enable/disable docstrings (server.py + client.py)
and README to describe this instead of claiming a no-op success.
This commit is contained in:
Bryan Rebhahn
2026-06-14 13:53:55 -05:00
committed by GitHub
parent 4a95ccd1b5
commit 690408d6c7
3 changed files with 212 additions and 5 deletions
+30
View File
@@ -134,8 +134,38 @@ Add to your `claude_desktop_config.json`:
| `list_access_lists` | List access lists for authentication/IP restrictions |
| `create_proxy_host` | Create a new proxy host |
| `update_proxy_host` | Update an existing proxy host (v0.0.3+) |
| `delete_proxy_host` | Delete a proxy host permanently |
| `enable_proxy_host` | Enable (bring online) a disabled proxy host |
| `disable_proxy_host` | Disable (take offline) a proxy host without deleting it |
| `create_certificate` | Provision a new Let's Encrypt SSL certificate (v0.0.3+) |
## Managing Proxy Host Lifecycle
Beyond creating and updating hosts, the server can delete a host outright or
toggle a host on and off without losing its configuration. Find the host ID
with `list_proxy_hosts` first.
```text
# Take a host offline temporarily (config is preserved)
disable_proxy_host(42)
# Bring it back online
enable_proxy_host(42)
# Permanently remove a host (cannot be undone)
delete_proxy_host(42)
```
Notes:
- `enable_proxy_host` / `disable_proxy_host` map to NPM's
`POST /nginx/proxy-hosts/{id}/enable` and `/disable` endpoints. If the host
is already in the requested state, NPM returns an HTTP 400 error
(e.g. `Host is already enabled`), which the tool surfaces as an API error.
- `delete_proxy_host` maps to `DELETE /nginx/proxy-hosts/{id}` and is
destructive — the reverse proxy stops serving the host's domains
immediately. Recreate it with `create_proxy_host` if you need it back.
## Log Access Setup
The `get_proxy_host_logs` tool reads nginx log files directly from disk. Since NPM has no API for log retrieval, you need to mount NPM's log directory into the MCP container.