Nginx Proxy Manager Mcp

io.github.euisuh由 GitHub 账号 euisuh 发布v0.5.2更新于 Oct 24, 2026

Manage Nginx Proxy Manager hosts, certificates, streams and access lists with dry-run previews.

概览

AI 生成的概览

让助手管理 Nginx Proxy Manager 的反向代理主机、重定向、TCP/UDP 流、证书和访问列表,并支持 dry-run 预览的 MCP 服务器。

可以做什么
  • 列出、查看、创建、更新、启用/停用和删除代理主机,含一步完成 Let's Encrypt HTTPS 主机的流程
  • 列出、申请、续期和删除 Let's Encrypt 证书(HTTP-01,通配符用 DNS-01)
  • 列出、创建、更新和删除重定向主机与 TCP/UDP 流,并可启用或停用
  • 管理访问列表,包括 IP 允许/拒绝规则和 basic-auth 用户
  • 诊断:按域名查找相关主机与证书,列出指定时间窗口内到期的证书
  • 所有写操作可用 dry_run 先预览请求再执行
适用场景
适合自建或家庭实验室环境中重复的反向代理操作:把域名指向某个容器、挂上证书、或用访问列表限制某个主机。也适合希望助手通过类型化工具而非管理界面完成这些 NPM 变更的用户。
运行要求
以 stdio 本地运行(PyPI 包 nginx-proxy-manager-mcp-server,可用 uvx 或 pipx;已发布 wheel 需 Python 3.12+),或以 SSE Docker sidecar 运行。需要现有 NPM 用户的 NPM_URL、NPM_EMAIL 和 NPM_PASSWORD,客户端启动时还需 MCP_TRANSPORT=stdio。需能访问 NPM 管理 API。
安装前请注意
任何能访问该服务器的对象都会以 NPM_EMAIL 账户的权限修改代理主机和证书;建议使用专用受限用户并开启 NPM_READ_ONLY=true。删除类工具不可恢复,update_access_list 会整体替换 basic-auth 用户。DNS-01 凭据作为工具参数传入,会出现在客户端对话记录中。不要公开暴露 SSE 端点;设置 MCP_BEARER_TOKEN 并仅绑定本机端口。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Nginx Proxy Manager Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Nginx Proxy Manager MCP

[CI] [Docker] [Python Package] [PyPI] [License: MIT] [Glama MCP server]

An MCP server for Nginx Proxy Manager. It lets Claude and other MCP clients manage proxy hosts, redirection hosts, TCP/UDP streams, Let's Encrypt certificates, and access lists through typed tools instead of clicking through the NPM admin UI.

text
"Point blog.example.com at the container on port 3000 with HTTPS"      │      ▼Claude / MCP client ──► Nginx Proxy Manager MCP ──HTTP + JWT──► NPM API

[Dry-run preview of creating an HTTPS proxy host]

The demo calls create_proxy_host_with_letsencrypt(dry_run=True) against a mocked NPM API and prints both request previews. No real NPM instance or credentials are used. To record it again, install the development dependencies and VHS, then run vhs docs/demo.tape from the repository root; docs/demo.py uses the same respx mocking approach as the tests.

Why this exists

Reverse-proxy changes are repetitive homelab work: create a host, point it at a container, attach a certificate, maybe restrict it to an access list. That is exactly the kind of operational task an AI assistant can handle well when it has narrow, typed tools and a local admin boundary.

This server runs either:

  • as an SSE Docker sidecar next to an existing NPM container, or
  • as a stdio MCP server for local clients.

Features

  • 34 MCP tools for common NPM operations (table below).
  • dry_run on all mutating tools to preview NPM requests before applying them.
  • One-shot create_proxy_host_with_letsencrypt requests a certificate, then creates an HTTPS-forced proxy host.
  • Let's Encrypt over HTTP-01 or DNS-01 (wildcards), with the request shape picked from the NPM version reported by GET /api/.
  • NPM_READ_ONLY=true registers only the 12 list_/get_/find_ tools.
  • JWT auth against the NPM API with in-memory token caching and automatic re-authentication on 401.
  • Docker sidecar deployment that binds the MCP port to localhost by default.
  • Offline pytest suite with mocked NPM API responses, including end-to-end calls through the MCP protocol layer; CI runs it on Python 3.10–3.13.
  • Ruff quality gate and contributor templates for public maintenance.
  • Python wheel build validation and MCP directory metadata for promotion readiness.
  • No token persistence and no hardcoded credentials.

Tools

ToolCategoryRead-onlyDescription
list_proxy_hostsProxy hostsyesList proxy hosts configured in NPM, including their current status.
get_proxy_hostProxy hostsyesFetch one proxy host by ID, including its configured fields and current status.
create_proxy_hostProxy hostsCreate a proxy host that routes the supplied domains to an HTTP or HTTPS upstream.
create_proxy_host_with_letsencryptProxy hostsRequest a Let's Encrypt certificate, then create a proxy host using that certificate with HTTPS forced.
update_proxy_hostProxy hostsUpdate writable settings on an existing proxy host by ID.
delete_proxy_hostProxy hostsPermanently delete a proxy host by ID, removing its configured domain routing from NPM.
enable_proxy_hostProxy hostsEnable a disabled proxy host by ID so NPM serves its configured domain routing again.
disable_proxy_hostProxy hostsDisable a proxy host by ID while retaining its configuration.
list_certificatesCertificatesyesList SSL certificates known to NPM, including expiry information when provided by NPM.
get_certificateCertificatesyesFetch one certificate by ID, including provider, domain names, expiry and meta.
create_letsencrypt_certCertificatesRequest a new Let's Encrypt certificate for the supplied domains, over HTTP-01 by default or DNS-01 with dns_challenge=True (required for wildcards).
delete_certificateCertificatesPermanently delete a certificate by ID, for example one left behind when create_proxy_host_with_letsencrypt fails at the proxy step.
renew_certificateCertificatesRequest renewal of an existing certificate by ID.
list_access_listsAccess listsyesList access lists configured in NPM.
get_access_listAccess listsyesFetch one access list by ID, including its client rules and basic-auth user metadata.
create_access_listAccess listsCreate an access list containing optional IP allow/deny rules and basic-auth users.
update_access_listAccess listsUpdate writable fields on an existing access list by ID, including client rules and basic-auth users.
delete_access_listAccess listsPermanently delete an access list by ID from NPM.
list_redirection_hostsRedirection hostsyesList configured redirection hosts and their current status.
get_redirection_hostRedirection hostsyesFetch one redirection host by ID with its configured destination and status.
create_redirection_hostRedirection hostsCreate a host that redirects requests for domains to a destination using the selected HTTP status.
update_redirection_hostRedirection hostsUpdate writable settings on an existing redirection host by ID.
delete_redirection_hostRedirection hostsPermanently delete a redirection host by ID, removing its redirect configuration from NPM.
enable_redirection_hostRedirection hostsEnable a disabled redirection host by ID so NPM serves its redirect again.
disable_redirection_hostRedirection hostsDisable a redirection host by ID while keeping its configuration in NPM.
list_streamsStreamsyesList configured TCP/UDP streams and their current status.
get_streamStreamsyesFetch one TCP/UDP stream by ID, including its forwarding ports and protocol settings.
create_streamStreamsCreate a TCP/UDP port forward from an incoming port to a destination host and port.
update_streamStreamsUpdate writable port, destination, or protocol fields on an existing stream by ID.
delete_streamStreamsPermanently delete a TCP/UDP stream by ID; NPM stops forwarding that port immediately and this cannot be undone.
enable_streamStreamsEnable a disabled TCP/UDP stream by ID so NPM forwards its incoming port again.
disable_streamStreamsDisable a TCP/UDP stream by ID while retaining its forwarding configuration.
find_host_by_domainDiagnosticsyesFind proxy hosts, redirection hosts, and certificates serving a domain using exact or wildcard matching.
list_expiring_certificatesDiagnosticsyesList certificates expiring within the requested UTC time window, including certificates already expired, sorted by expiry.

The table is generated by docs/tools_table.py from the registered tools; tests/test_readme.py fails if it drifts. Read-only tools are the ones NPM_READ_ONLY keeps.

List tools support optional server-side filtering after fetching from NPM: domain matches a case-insensitive substring in any domain name for proxy hosts, redirection hosts, and certificates; enabled filters proxy hosts, redirection hosts, and streams by status. All four accept compact=True to return only summary fields. Filters combine, and calls without arguments return the full, unchanged NPM list. For example, list_proxy_hosts(domain="example", enabled=True, compact=True) lists enabled hosts matching "example" with compact output.

All mutating tools expose dry_run=True. Previews contain method and path, plus json when the request has a body; the HTTPS workflow returns two previews in steps. The flag suppresses mutating requests, though some previews read current state. Update tools send only the fields in NPM's PUT schema (fixes #19); this is covered by mocked tests and not yet checked against a live NPM instance.

Compared to other NPM MCP servers

Competitor facts below come only from their linked READMEs fetched with gh api repos/<owner>/nginx-proxy-manager-mcp/readme on 2026-10-13. “not documented” means the README does not establish the capability, not that it is absent. Auth guard means inbound MCP client authentication, distinct from NPM API login.

RepositoryTool count documentedDry-run supportTransportAuth guard
euisuh (this server)34dry_run on all mutating toolsstdio, SSEOptional SSE bearer token (MCP_BEARER_TOKEN); /healthz exempt
b3nw14 named tools (13 catalog rows plus list_instances)not documentedstdio, HTTPHTTP bearer token (NPM_MCP_AUTH_TOKEN)
omichelbraga66DELETE without confirm: true previews affected resources; general dry_run not documentedstdio, Streamable HTTPOptional bearer token (NPM_MCP_BEARER_TOKEN); unset means no inbound auth
drmogie4 named tools (npm_status, npm_hosts, npm_audit_log, npm_call)Changes show what will be sent and require confirm; dry_run not documentednot documentednot documented

This server's implementations expose dry_run on every mutating tool, provide the one-shot create_proxy_host_with_letsencrypt workflow, and publish the Docker sidecar at 127.0.0.1:8000:8000. These are verified in tools/, server.py, and docker-compose.yml. They do not establish that other servers lack equivalent capabilities.

Quick start: Docker sidecar

The bundled docker-compose.yml starts both Nginx Proxy Manager and this MCP sidecar from source. If you already run NPM, copy only the nginx-proxy-manager-mcp service into your existing compose file.

bash
git clone https://github.com/euisuh/nginx-proxy-manager-mcp.gitcd nginx-proxy-manager-mcpcp .env.example .env# edit .env — NPM_EMAIL / NPM_PASSWORD of an existing NPM user (a dedicated non-admin user works; see Security)docker compose up -d

NPM_URL defaults to http://app:81, the NPM admin API on the internal Docker network. Leave it as-is when both services share a compose stack; point it at your NPM host otherwise.

To use the published GHCR image instead of building locally:

yaml
services:  nginx-proxy-manager-mcp:    image: ghcr.io/euisuh/nginx-proxy-manager-mcp:latest    restart: unless-stopped    environment:      NPM_URL: http://app:81      NPM_EMAIL: ${NPM_EMAIL}      NPM_PASSWORD: ${NPM_PASSWORD}      MCP_TRANSPORT: sse      MCP_HOST: 0.0.0.0      MCP_PORT: 8000      MCP_BEARER_TOKEN: ${MCP_BEARER_TOKEN:-}    ports:      - "127.0.0.1:8000:8000"

Register the SSE server with Claude Code (without --transport sse, claude mcp add treats the URL as a command to run):

bash
claude mcp add --transport sse npm http://localhost:8000/sse# with MCP_BEARER_TOKEN set:claude mcp add --transport sse npm http://localhost:8000/sse -H "Authorization: Bearer YOUR_TOKEN"

Or add it manually to an MCP client config:

json
{  "mcpServers": {    "nginx-proxy-manager": {      "url": "http://localhost:8000/sse"    }  }}

More examples live in examples/: Claude Desktop, Claude Code, Cursor, and Windsurf.

Quick start: uvx / pipx

If you do not want Docker, run it from PyPI (package nginx-proxy-manager-mcp-server):

bash
NPM_URL=http://localhost:81 \[email protected] \NPM_PASSWORD=... \MCP_TRANSPORT=stdio \uvx nginx-proxy-manager-mcp-server

Or from a local checkout:

bash
git clone https://github.com/euisuh/nginx-proxy-manager-mcp.gitcd nginx-proxy-manager-mcp
NPM_URL=http://localhost:81 \[email protected] \NPM_PASSWORD=... \MCP_TRANSPORT=stdio \uvx --from . nginx-proxy-manager-mcp

Or install it into an isolated environment:

bash
pipx install nginx-proxy-manager-mcp-server

The published 0.6.0 wheel requires Python 3.12+; the source supports Python 3.10+.

Claude Desktop (claude_desktop_config.json) launching it with uvx:

json
{  "mcpServers": {    "nginx-proxy-manager": {      "command": "uvx",      "args": ["nginx-proxy-manager-mcp-server"],      "env": {        "NPM_URL": "http://localhost:81",        "NPM_EMAIL": "[email protected]",        "NPM_PASSWORD": "...",        "MCP_TRANSPORT": "stdio"      }    }  }}

Claude Code, same launch:

bash
claude mcp add npm \  -e NPM_URL=http://localhost:81 -e [email protected] -e NPM_PASSWORD=... \  -e MCP_TRANSPORT=stdio \  -- uvx nginx-proxy-manager-mcp-server

To check a launch without touching NPM, list tools: tool listing makes no NPM request, and NPM is contacted on the first tool call.

Quick start: stdio

Use stdio when you want the MCP client to launch the server process directly instead of talking to a sidecar.

bash
python -m venv .venv. .venv/bin/activatepip install -e .NPM_URL=http://localhost:81 \[email protected] \NPM_PASSWORD=... \MCP_TRANSPORT=stdio \nginx-proxy-manager-mcp

Example client config:

json
{  "mcpServers": {    "nginx-proxy-manager": {      "command": "/path/to/nginx-proxy-manager-mcp/.venv/bin/python",      "args": ["-m", "nginx_proxy_manager_mcp.server"],      "env": {        "NPM_URL": "http://localhost:81",        "NPM_EMAIL": "[email protected]",        "NPM_PASSWORD": "...",        "MCP_TRANSPORT": "stdio"      }    }  }}

Configuration

VariableRequiredDefaultDescription
NPM_URLyes—Base URL of the NPM admin API (http://app:81 inside Docker)
NPM_EMAILyes—Email of the NPM user the server logs in as (see NPM credential scope)
NPM_PASSWORDyes—That user's password
NPM_READ_ONLYnodisabled1, true, or yes (case-insensitive) registers only list_, get_, and find_ tools; all other values disable read-only mode
MCP_TRANSPORTnosseMCP transport: sse or stdio
MCP_HOSTno127.0.0.1Bind address for SSE mode; Docker Compose sets 0.0.0.0 inside the container while publishing only to localhost
MCP_PORTno8000Bind port for SSE mode
MCP_BEARER_TOKENno—Optional bearer token required for SSE HTTP requests

Set NPM_READ_ONLY=true to expose only read-only tools.

Missing required variables make the server exit with a clear error at startup rather than fail on the first API call.

SSE mode also exposes GET /healthz, an unauthenticated liveness endpoint that returns a small JSON response. It does not contact NPM or validate credentials; use it for container and reverse-proxy health checks only.

NPM compatibility

Request bodies follow the JSON schemas in NPM's backend/schema/ and were checked against tags v2.12.6, v2.13.0, and v2.16.0. NPM rejects unknown fields (additionalProperties: false), so version differences matter:

  • NPM 2.13.0 removed meta.letsencrypt_email and meta.letsencrypt_agree and uses the NPM user's account email for Let's Encrypt. The server reads the version once from the unauthenticated GET /api/ and only sends those fields to NPM older than 2.13; there, email is required.
  • Update tools send only the fields in NPM's PUT schema (see #19).

These checks are against schema files and mocked tests, not a live NPM instance.

Architecture

text
┌───────────────┐   MCP over SSE/stdio   ┌──────────────────────────┐│ Claude/Cursor │ ─────────────────────► │ Nginx Proxy Manager MCP  ││ / MCP client  │                        │ server.py + tools/       │└───────────────┘                         └───────────┬──────────────┘                                                       │ HTTP + Bearer JWT                                                       ▼                                           ┌──────────────────────────┐                                           │ Nginx Proxy Manager API  │                                           │ app:81 / localhost:81    │                                           └──────────────────────────┘
  • nginx_proxy_manager_mcp/server.py validates required env vars, builds the FastMCP app, registers every tool module, and serves either SSE or stdio.
  • nginx_proxy_manager_mcp/npm_client.py wraps httpx, exchanges the email/password for a JWT on first use, caches the token in memory, and re-authenticates once on 401. NPM errors become NPMAPIError with NPM's own message; transport failures become NPMConnectionError naming NPM_URL.
  • nginx_proxy_manager_mcp/tools/ keeps one module per NPM resource. Adding a resource means adding one register_*_tools(mcp, client) function and one registration line.

Development

bash
python -m venv .venv. .venv/bin/activatepip install -e . -r requirements-dev.txtpytest -q

Tests mock the NPM API with respx, so the suite runs offline and touches no real infrastructure. CI runs the same command on every push and pull request.

Releases

Tagged releases (vX.Y.Z) publish the nginx-proxy-manager-mcp-server package to PyPI via trusted publishing (.github/workflows/publish.yml) and multi-architecture Docker images to GitHub Container Registry:

  • ghcr.io/euisuh/nginx-proxy-manager-mcp:<version> for tags such as v0.2.0
  • ghcr.io/euisuh/nginx-proxy-manager-mcp:<major>.<minor> for semver tags
  • ghcr.io/euisuh/nginx-proxy-manager-mcp:latest for the newest tagged release

The Docker workflow also builds pull requests without pushing an image, so packaging changes are validated before release.

Security

Anything that can reach this MCP server has the NPM permissions of the account in NPM_EMAIL, so it can change proxy hosts and certificates.

NPM credential scope

The server needs no NPM admin rights. It only calls /api/tokens, /api/nginx/*, and the unauthenticated GET /api/. It never touches users, settings, or the audit log. Create a dedicated NPM user (Users → Add User) instead of reusing your admin login:

  • Permissions are per resource: proxy hosts, redirection hosts, streams, access lists, and certificates, each manage, view, or hidden (NPM permission-object.json). Grant manage only where the assistant should make changes.
  • Item visibility all lets the user see hosts created by others; user limits it to items it created.
  • For an inspect-only setup, pair a view-only NPM user with NPM_READ_ONLY=true. NPM enforces the first and the server enforces the second.
  • On NPM 2.13+, Let's Encrypt registers with this user's email, so give it a real address.

Deployment

  • Do not expose the MCP endpoint publicly.
  • Keep the Docker port bound to 127.0.0.1 unless you have another trusted network boundary.
  • Bare SSE runs bind to 127.0.0.1 by default; set MCP_HOST=0.0.0.0 only behind a trusted network boundary.
  • Set MCP_BEARER_TOKEN for SSE deployments that can be reached by anything beyond the local machine, and configure clients to send Authorization: Bearer YOUR_TOKEN.
  • Use environment variables or a secrets manager for NPM credentials; do not commit .env.
  • The NPM JWT lives in process memory, is sent only in the Authorization header, and is never logged or written to disk. Error messages carry NPM's error text and URL, not request headers or bodies.
  • create_letsencrypt_cert with DNS-01 takes the DNS provider credentials as a tool argument, so they appear in the MCP client's transcript. NPM never returns them, and dry-run previews show <redacted>.
  • get_access_list drops NPM's password hint field, which reveals the first character and length of each basic-auth password.
  • The container runs as a non-root user.

See SECURITY.md for reporting and deployment guidance.

Roadmap

See ROADMAP.md. Near-term priorities are broader NPM resource coverage and operational hardening.

Listings

Directory metadata lives in server.json (MCP Registry), glama.json (Glama maintainer verification) and smithery.yaml (stdio launch config for Smithery-style directories).

Limitations

  • Covers proxy hosts, redirection hosts, streams, certificates, and access lists only. 404 hosts, users, audit log, and settings are not implemented.
  • Certificates: Let's Encrypt (HTTP-01, or DNS-01 via a certbot DNS plugin NPM knows). No custom certificate upload or download.
  • update_access_list replaces basic-auth users wholesale when items is given, and each item needs its password (NPM cannot return stored passwords).
  • Integration tests against a live NPM container (CI, NPM 2.16.0) cover only the version probe and proxy-host create/list/delete. Other request shapes are checked against NPM's schema files and mocked tests.
  • One NPM instance per server process; there is no multi-tenant or multi-host routing.
  • Optional SSE bearer-token auth protects the HTTP endpoint, but there is no per-tool authorization after a client is authenticated.
  • /healthz reports only process liveness, not NPM reachability.
  • Written against the NPM v2 API; older or forked NPM builds may differ.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md. Adding a new NPM resource follows a fixed shape:

  1. Create nginx_proxy_manager_mcp/tools/<resource>.py with a register_<resource>_tools(mcp, client) function.
  2. Register it in register_all() in nginx_proxy_manager_mcp/server.py.
  3. Add tests/test_<resource>.py covering each tool with respx-mocked NPM responses.
  4. Regenerate the README tool table with python docs/tools_table.py.
  5. Run ruff check . and pytest -q.

Commits follow Conventional Commits.

Author

Built and maintained by Euisuh Jeong to manage a homelab reverse proxy from Claude Code.

License

MIT — see LICENSE.

来源:README.md,提交 ffac950

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.5.2最新Oct 16, 2026
  2. v0.5.1Oct 13, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分