
MCP server for Nginx Proxy Manager - manage reverse proxy through AI assistants
概览
MCP server for Nginx Proxy Manager - manage your reverse proxy through AI assistants. The easiest way to run the NPM MCP server - no cloning required! Configure default values for proxy host creation: Manage multiple NPM servers from a single MCP instance by setting NPM_INSTANCES: Each instance object supports: api_url (required), identity (required), secret (required), log_dir (optional), proxy_defaults (optional). When NPM_INSTANCES is set, single-instance settings (NPM_API_URL, NPM_IDENTITY, NPM_SECRET) are ignored. Every tool gains an optional instance parameter - omit it to target the explicit NPM_DEFAULT_INSTANCE (or the first configured instance in NPM_INSTANCES if unset). Use the list_instances tool to see all available instances. 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.
README
以下为原文 README 节选,完整内容请查看原文。
NPM MCP Server
MCP server for Nginx Proxy Manager - manage your reverse proxy through AI assistants.
Quick Start (Docker)
The easiest way to run the NPM MCP server - no cloning required!
# Download the compose file
curl -O https://raw.githubusercontent.com/b3nw/nginx-proxy-manager-mcp/main/compose.yaml
# Edit the environment variables, then start
docker compose up -d
Or run directly:
docker run -d \
--name npm-mcp \
-p 8000:8000 \
-e NPM_API_URL=http://your-npm:81/api \
-e [email protected] \
-e NPM_SECRET=yourpassword \
-e NPM_MCP_TRANSPORT=http \
ghcr.io/b3nw/nginx-proxy-manager-mcp:latest
Installation (Local)
# Using uv (recommended)
uv pip install -e .
# Or with pip
pip install -e .
Configuration
Copy env.example to .env and configure:
NPM_API_URL=http://your-npm-instance:81/api
[email protected]
NPM_SECRET=yourpassword
# Optional: Server settings
NPM_MCP_PORT=8000
NPM_MCP_TRANSPORT=stdio # or "http"
# Optional: Default values for create_proxy_host (JSON)
NPM_PROXY_DEFAULTS='{"certificate_id": 24, "ssl_forced": true}'
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
NPM_API_URL |
Yes | http://localhost:81/api |
NPM API endpoint |
NPM_IDENTITY |
Yes | - | NPM user email |
NPM_SECRET |
Yes | - | NPM user password |
NPM_MCP_HOST |
No | 0.0.0.0 |
MCP server bind address |
NPM_MCP_PORT |
No | 8000 |
MCP server port |
NPM_MCP_TRANSPORT |
No | stdio |
Transport mode (stdio or http) |
NPM_MCP_ENABLE_DESTRUCTIVE_TOOLS |
No | false |
Enable write/destructive tools (create, update, delete, enable, disable) |
NPM_MCP_AUTH_TOKEN |
No | - | Bearer token required for HTTP transport clients |
NPM_LOG_DIR |
No | - | Path to mounted NPM log directory (enables get_proxy_host_logs) |
NPM_PROXY_DEFAULTS |
No | {} |
JSON defaults for create_proxy_host |
NPM_INSTANCES |
No | - | JSON map of named NPM instances for multi-instance mode (see below) |
NPM_DEFAULT_INSTANCE |
No | - | Name of the default instance for unnamed tool calls (defaults to the first instance in NPM_INSTANCES) |
NPM_PROXY_DEFAULTS Keys
Configure default values for proxy host creation:
NPM_PROXY_DEFAULTS='{"certificate_id": 24, "ssl_forced": true, "block_exploits": true}'
| Key | Type | Default | Description |
|---|---|---|---|
forward_scheme |
string | "http" |
Backend protocol (http or https) |
certificate_id |
int | 0 |
SSL certificate ID (use list_certificates to find) |
ssl_forced |
bool | true |
Force HTTPS redirect |
block_exploits |
bool | true |
Enable common exploit blocking |
allow_websocket_upgrade |
bool | true |
Allow WebSocket connections |
安装
docker run -d \配置
{
"mcpServers": {
"npm": {
"command": "npm-mcp",
"env": {
"NPM_API_URL": "http://localhost:81/api",
"NPM_IDENTITY": "[email protected]",
"NPM_SECRET": "yourpassword"
}
}
}
}