Nginx Proxy Manager MCP Server
Allows managing an Nginx Proxy Manager instance, including proxy hosts, redirection hosts, dead hosts, streams, access lists, certificates, users, and settings.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Nginx Proxy Manager MCP Serverlist all my proxy hosts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nginx Proxy Manager MCP Server
一个用于管理 Nginx Proxy Manager 的 Model Context Protocol (MCP) 服务器。
✨ 特性
🔐 自动 JWT 刷新:在 token 即将过期时自动刷新,避免多轮对话中认证失败
🛠️ 完整的 API 覆盖:支持 Proxy Hosts、Redirection Hosts、Dead Hosts、Streams 等所有资源
📝 支持 advanced_config:创建/更新记录时完全支持
advanced_config和locations[].advanced_config🔄 自动重试:收到 401 错误时自动重新登录并重试请求
🌐 多种传输模式:支持 stdio 和 Streamable HTTP 两种模式
🔧 灵活配置:支持命令行参数、环境变量、HTTP Headers 多种配置方式
Related MCP server: npm-mcp
📋 支持的 Tools
类别 | Tools |
Proxy Hosts |
|
Redirection Hosts |
|
Dead Hosts |
|
Streams |
|
Access Lists |
|
Certificates |
|
Users |
|
Settings |
|
🚀 快速开始
1. 安装依赖
pnpm install2. 配置环境变量(可选)
对于 stdio 模式,需要配置 NPM 连接信息。对于 Streamable HTTP 模式,可以通过 HTTP Headers 提供配置。
复制 .env.example 到 .env:
cp .env.example .env.env 文件内容:
# Nginx Proxy Manager Configuration
NPM_BASE_URL=http://your-npm-server:81
NPM_USERNAME=admin@example.com
NPM_PASSWORD=your_password
# Optional: Token refresh margin in seconds (default: 300 = 5 minutes)
NPM_TOKEN_REFRESH_MARGIN=300
# MCP Transport Configuration
# Options: stdio (default), streamable-http
MCP_TRANSPORT=stdio
# Streamable HTTP Configuration (only used when MCP_TRANSPORT=streamable-http)
MCP_HTTP_HOST=0.0.0.0
MCP_HTTP_PORT=1234
# Optional: Auth token for HTTP mode (clients must send Authorization: Bearer <token>)
MCP_HTTP_AUTH_TOKEN=3. 编译
pnpm run build4. 运行
stdio 模式(默认,适合 Claude Desktop):
pnpm run startStreamable HTTP 模式(适合远程访问):
pnpm run start:http🔧 配置方式
配置优先级(从高到低):
命令行参数 -
--base-url,--username,--password环境变量 / .env 文件 -
NPM_BASE_URL,NPM_USERNAME,NPM_PASSWORDHTTP Headers -
NPM-Base-Url,NPM-Username,NPM-Password(仅 Streamable HTTP 模式)
命令行参数
# stdio 模式
node dist/index.js --base-url http://10.0.1.199:81 --username admin@example.com --password mypassword
# Streamable HTTP 模式
node dist/index.js --transport streamable-http --host 0.0.0.0 --port 1234 --base-url http://10.0.1.199:81 --username admin@example.com --password mypassword支持的参数:
--base-url- NPM 服务器地址--username- NPM 用户名--password- NPM 密码--transport- 传输模式 (stdio 或 streamable-http)--host- HTTP 监听地址 (默认 0.0.0.0)--port- HTTP 端口--auth-token- MCP 认证 token
HTTP Headers(Streamable HTTP 模式)
当环境变量未配置时,客户端可以通过 HTTP Headers 提供 NPM 配置:
{
"mcpServers": {
"nginx-proxy-manager": {
"type": "streamable-http",
"url": "http://localhost:1234/mcp",
"headers": {
"NPM-Base-Url": "http://10.0.1.199:81",
"NPM-Username": "admin@example.com",
"NPM-Password": "password123"
}
}
}
}优势:
无需在服务器端配置
.env不同客户端可以连接不同的 NPM 服务器
适合多租户场景
环境变量(stdio 模式)
对于 stdio 模式,MCP 客户端通常通过 env 字段传递配置:
{
"mcpServers": {
"nginx-proxy-manager": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"NPM_BASE_URL": "http://10.0.1.199:81",
"NPM_USERNAME": "admin@example.com",
"NPM_PASSWORD": "password123"
}
}
}
}🌐 Streamable HTTP 模式
Streamable HTTP 模式允许通过 HTTP 访问 MCP Server,适合远程访问和团队共享。
启动
# 使用 .env 配置
pnpm run start:http
# 使用命令行参数
node dist/index.js --transport streamable-http --host 0.0.0.0 --port 1234API 端点
URL:
http://<MCP_HTTP_HOST>:<MCP_HTTP_PORT>/mcpMethods:
POST,GET,DELETEContent-Type:
application/jsonAccept:
application/json, text/event-stream
认证
可选的 MCP 认证 token 保护:
# 通过环境变量
MCP_HTTP_AUTH_TOKEN=your-secret-token pnpm run start:http
# 通过命令行参数
node dist/index.js --transport streamable-http --auth-token your-secret-token客户端配置:
{
"mcpServers": {
"nginx-proxy-manager": {
"type": "streamable-http",
"url": "http://localhost:1234/mcp",
"headers": {
"Authorization": "Bearer your-secret-token",
"NPM-Base-Url": "http://10.0.1.199:81",
"NPM-Username": "admin@example.com",
"NPM-Password": "password123"
}
}
}
}🔐 JWT 自动刷新机制
为了解决 Agent 多轮调用中 JWT 过期的问题,本 MCP Server 实现了以下机制:
提前刷新:在 token 即将过期前 5 分钟(可配置)自动刷新
自动重试:收到 401 错误时自动重新登录并重试请求
并发安全:多个请求同时触发刷新时,只会执行一次刷新
配置刷新间隔
在 .env 中设置 NPM_TOKEN_REFRESH_MARGIN(单位:秒):
# 在 token 过期前 5 分钟刷新(默认值)
NPM_TOKEN_REFRESH_MARGIN=300
# 在 token 过期前 10 分钟刷新
NPM_TOKEN_REFRESH_MARGIN=600📝 使用示例
创建带 advanced_config 的 Proxy Host
{
"name": "npm_create_proxy_host",
"arguments": {
"domain_names": ["app.example.com"],
"forward_scheme": "http",
"forward_host": "127.0.0.1",
"forward_port": 8080,
"advanced_config": "proxy_set_header Host $host;\nproxy_set_header X-Real-IP $remote_addr;",
"locations": [
{
"path": "/api",
"forward_scheme": "http",
"forward_host": "backend.local",
"forward_port": 3000,
"advanced_config": "proxy_set_header X-API-Key secret;"
}
]
}
}更新 Proxy Host 的 advanced_config
{
"name": "npm_update_proxy_host",
"arguments": {
"host_id": 1,
"advanced_config": "# Updated config\nproxy_buffering off;",
"locations": [
{
"path": "/",
"forward_scheme": "http",
"forward_host": "10.0.1.101",
"forward_port": 3000,
"advanced_config": "proxy_set_header Host $host:60443;"
}
]
}
}🚀 systemd 服务(开机启动)
Streamable HTTP 模式下,可以配置为 systemd 服务实现开机自动启动。
安装服务
# 编译项目
pnpm run build
# 安装 systemd 服务
pnpm run service:install管理服务
# 启动/停止/重启
sudo systemctl start npm-mcp
sudo systemctl stop npm-mcp
sudo systemctl restart npm-mcp
# 查看状态
sudo systemctl status npm-mcp
# 查看日志(实时)
journalctl -u npm-mcp -f开机启动控制
# 启用开机启动
sudo systemctl enable npm-mcp
# 禁用开机启动
sudo systemctl disable npm-mcp卸载服务
pnpm run service:uninstall🔧 开发
开发模式运行
# stdio 模式
pnpm run dev
# Streamable HTTP 模式
pnpm run dev:http项目结构
mcp/
├── src/
│ ├── index.ts # MCP Server 主入口
│ ├── npm-client.ts # NPM API 客户端(含 JWT 自动刷新)
│ ├── types.ts # TypeScript 类型定义
│ └── tools/
│ ├── proxy-hosts.ts # Proxy Hosts tools
│ ├── redirection-hosts.ts # Redirection Hosts tools
│ ├── dead-hosts.ts # Dead Hosts tools
│ ├── streams.ts # Streams tools
│ ├── access-lists.ts # Access Lists tools
│ ├── certificates.ts # Certificates tools
│ ├── users.ts # Users tools
│ └── settings.ts # Settings tools
├── scripts/
│ └── setup-systemd.sh # systemd 服务安装脚本
├── docs/ # API 文档
├── package.json
├── tsconfig.json
└── .env # 环境变量配置(可选)📚 API 文档
详细的 API 文档请参考 docs/ 目录:
README.md - API 概览
auth.md - 认证与令牌
proxy-hosts.md - Proxy Hosts API
redirection-hosts.md - Redirection Hosts API
dead-hosts.md - Dead Hosts API
streams.md - Streams API
access-lists.md - Access Lists API
certificates.md - Certificates API
users.md - Users API
settings.md - Settings API
📄 License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Authenticated MCP server for ClearPolicy policy and compliance workflows.
Manage feature requests, votes, roadmaps, and changelogs from any MCP client.
Hash passwords with bcrypt and issue/verify JWT session tokens over A2A + MCP.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables management of Nginx Proxy Manager instances for configuring proxy hosts, requesting Let's Encrypt SSL certificates, and managing access lists. It allows users to control their web proxy infrastructure through natural language commands in MCP-compatible environments.503MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Nginx Proxy Manager instances through natural language, covering 28 tools for proxy hosts, certificates, streams, and more.MIT
- AlicenseCqualityDmaintenanceMCP server that abstracts the Nginx Proxy Manager API, enabling management of proxy hosts, redirections, streams, certificates, access lists, and users through natural language.54161AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Nginx Proxy Manager, including proxy hosts, SSL certificates, streams, and more.13ISC
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nice-winter/node-nginx-proxy-manager-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server