unifi-network-mcp 0.3.3__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/PKG-INFO +4 -2
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/README.md +2 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/pyproject.toml +1 -1
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/_version.py +2 -2
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/main.py +5 -1
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/runtime.py +17 -1
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/.gitignore +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/.well-known/mcp-server.json +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/LICENSE +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/bootstrap.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/config/config.yaml +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/jobs.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/client_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/connection_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/device_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/event_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/firewall_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/hotspot_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/network_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/qos_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/routing_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/stats_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/system_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/traffic_route_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/usergroup_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/managers/vpn_manager.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/schemas.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tool_index.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/clients.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/config.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/devices.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/events.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/firewall.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/hotspot.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/network.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/port_forwards.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/qos.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/routing.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/stats.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/system.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/traffic_routes.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/usergroups.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools/vpn.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/tools_manifest.json +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/confirmation.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/diagnostics.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/lazy_tool_loader.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/meta_tools.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/permissions.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/utils/tool_loader.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/validator_registry.py +0 -0
- {unifi_network_mcp-0.3.3 → unifi_network_mcp-0.4.1}/src/validators.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unifi-network-mcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Unifi Network MCP Server
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.13
|
|
7
7
|
Requires-Dist: aiohttp>=3.8.5
|
|
8
8
|
Requires-Dist: aiounifi>=88
|
|
9
9
|
Requires-Dist: jsonschema>=4.17.0
|
|
10
|
-
Requires-Dist: mcp[cli]>=1.
|
|
10
|
+
Requires-Dist: mcp[cli]>=1.23.0
|
|
11
11
|
Requires-Dist: omegaconf>=2.3.0
|
|
12
12
|
Requires-Dist: python-dotenv>=1.0.0
|
|
13
13
|
Requires-Dist: pyyaml>=6.0
|
|
@@ -538,6 +538,7 @@ The server merges settings from **environment variables**, an optional `.env` fi
|
|
|
538
538
|
| `UNIFI_TOOL_REGISTRATION_MODE` | Tool loading mode: `lazy` (default), `eager`, or `meta_only`. See [Context Optimization](#context-optimization) |
|
|
539
539
|
| `UNIFI_ENABLED_CATEGORIES` | Comma-separated list of tool categories to load (eager mode). See table below |
|
|
540
540
|
| `UNIFI_ENABLED_TOOLS` | Comma-separated list of specific tool names to register (eager mode) |
|
|
541
|
+
| `UNIFI_MCP_ALLOWED_HOSTS` | Comma-separated list of allowed hostnames for reverse proxy support. Required when running behind Nginx/Cloudflare/etc. Default `localhost,127.0.0.1` |
|
|
541
542
|
|
|
542
543
|
### Tool Categories (for UNIFI_ENABLED_CATEGORIES)
|
|
543
544
|
|
|
@@ -809,6 +810,7 @@ See [docs/permissions.md](docs/permissions.md) for complete documentation includ
|
|
|
809
810
|
* **Review permissions carefully** before enabling high-risk operations. Use environment variables for runtime control.
|
|
810
811
|
* Create, update, and delete tools should be used with caution and only enabled when necessary.
|
|
811
812
|
* Do not host outside of your network unless using a secure reverse proxy like Cloudflare Tunnel or Ngrok. Even then, an additional layer of authentication is recommended.
|
|
813
|
+
* **Reverse Proxy Configuration:** When running behind a reverse proxy, set `UNIFI_MCP_ALLOWED_HOSTS` to include your external domain (e.g., `localhost,127.0.0.1,unifi-mcp.example.com`) to bypass FastMCP's DNS rebinding protection.
|
|
812
814
|
|
|
813
815
|
---
|
|
814
816
|
|
|
@@ -522,6 +522,7 @@ The server merges settings from **environment variables**, an optional `.env` fi
|
|
|
522
522
|
| `UNIFI_TOOL_REGISTRATION_MODE` | Tool loading mode: `lazy` (default), `eager`, or `meta_only`. See [Context Optimization](#context-optimization) |
|
|
523
523
|
| `UNIFI_ENABLED_CATEGORIES` | Comma-separated list of tool categories to load (eager mode). See table below |
|
|
524
524
|
| `UNIFI_ENABLED_TOOLS` | Comma-separated list of specific tool names to register (eager mode) |
|
|
525
|
+
| `UNIFI_MCP_ALLOWED_HOSTS` | Comma-separated list of allowed hostnames for reverse proxy support. Required when running behind Nginx/Cloudflare/etc. Default `localhost,127.0.0.1` |
|
|
525
526
|
|
|
526
527
|
### Tool Categories (for UNIFI_ENABLED_CATEGORIES)
|
|
527
528
|
|
|
@@ -793,6 +794,7 @@ See [docs/permissions.md](docs/permissions.md) for complete documentation includ
|
|
|
793
794
|
* **Review permissions carefully** before enabling high-risk operations. Use environment variables for runtime control.
|
|
794
795
|
* Create, update, and delete tools should be used with caution and only enabled when necessary.
|
|
795
796
|
* Do not host outside of your network unless using a secure reverse proxy like Cloudflare Tunnel or Ngrok. Even then, an additional layer of authentication is recommended.
|
|
797
|
+
* **Reverse Proxy Configuration:** When running behind a reverse proxy, set `UNIFI_MCP_ALLOWED_HOSTS` to include your external domain (e.g., `localhost,127.0.0.1,unifi-mcp.example.com`) to bypass FastMCP's DNS rebinding protection.
|
|
796
798
|
|
|
797
799
|
---
|
|
798
800
|
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.4.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 4, 1)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -335,9 +335,13 @@ async def main_async():
|
|
|
335
335
|
async def run_http():
|
|
336
336
|
try:
|
|
337
337
|
logger.info(f"Starting FastMCP HTTP SSE server on {host}:{port} ...")
|
|
338
|
-
# MCP SDK >= 1.10 (pinned to 1.13.1): configure host/port via settings
|
|
339
338
|
server.settings.host = host
|
|
340
339
|
server.settings.port = port
|
|
340
|
+
|
|
341
|
+
# Disable uvicorn access logging to prevent stdout conflicts
|
|
342
|
+
# when running alongside stdio transport
|
|
343
|
+
logging.getLogger("uvicorn.access").disabled = True
|
|
344
|
+
|
|
341
345
|
await server.run_sse_async()
|
|
342
346
|
logger.info("HTTP SSE started via run_sse_async() using server.settings host/port.")
|
|
343
347
|
except Exception as http_e:
|
|
@@ -14,10 +14,12 @@ Lazy factories (`get_*`) are provided so unit tests can substitute fakes by
|
|
|
14
14
|
monkey‑patching before the first call.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
|
+
import os
|
|
17
18
|
from functools import lru_cache
|
|
18
19
|
from typing import Any
|
|
19
20
|
|
|
20
21
|
from mcp.server.fastmcp import FastMCP
|
|
22
|
+
from mcp.server.transport_security import TransportSecuritySettings
|
|
21
23
|
|
|
22
24
|
from src.bootstrap import load_config, logger
|
|
23
25
|
from src.managers.client_manager import ClientManager
|
|
@@ -50,7 +52,21 @@ def get_config():
|
|
|
50
52
|
@lru_cache
|
|
51
53
|
def get_server() -> FastMCP:
|
|
52
54
|
"""Create the FastMCP server instance exactly once."""
|
|
53
|
-
|
|
55
|
+
# Parse allowed hosts from environment variable for reverse proxy support
|
|
56
|
+
# Default to localhost only for backwards compatibility
|
|
57
|
+
allowed_hosts_str = os.getenv("UNIFI_MCP_ALLOWED_HOSTS", "localhost,127.0.0.1")
|
|
58
|
+
allowed_hosts = [h.strip() for h in allowed_hosts_str.split(",") if h.strip()]
|
|
59
|
+
|
|
60
|
+
# Configure transport security settings
|
|
61
|
+
transport_security = TransportSecuritySettings(allowed_hosts=allowed_hosts)
|
|
62
|
+
|
|
63
|
+
logger.debug(f"Configuring FastMCP with allowed_hosts: {allowed_hosts}")
|
|
64
|
+
|
|
65
|
+
return FastMCP(
|
|
66
|
+
name="unifi-network-mcp",
|
|
67
|
+
debug=True,
|
|
68
|
+
transport_security=transport_security,
|
|
69
|
+
)
|
|
54
70
|
|
|
55
71
|
|
|
56
72
|
# ---------------------------------------------------------------------------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|