unifi-network-mcp 0.5.1__tar.gz → 0.5.3__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.
Files changed (53) hide show
  1. unifi_network_mcp-0.5.1/README.md → unifi_network_mcp-0.5.3/PKG-INFO +22 -1
  2. unifi_network_mcp-0.5.1/PKG-INFO → unifi_network_mcp-0.5.3/README.md +6 -17
  3. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/_version.py +2 -2
  4. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/main.py +7 -0
  5. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/runtime.py +14 -2
  6. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/.gitignore +0 -0
  7. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/.well-known/mcp-server.json +0 -0
  8. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/LICENSE +0 -0
  9. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/pyproject.toml +0 -0
  10. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/bootstrap.py +0 -0
  11. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/config/config.yaml +0 -0
  12. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/jobs.py +0 -0
  13. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/client_manager.py +0 -0
  14. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/connection_manager.py +0 -0
  15. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/device_manager.py +0 -0
  16. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/event_manager.py +0 -0
  17. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/firewall_manager.py +0 -0
  18. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/hotspot_manager.py +0 -0
  19. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/network_manager.py +0 -0
  20. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/qos_manager.py +0 -0
  21. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/routing_manager.py +0 -0
  22. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/stats_manager.py +0 -0
  23. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/system_manager.py +0 -0
  24. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/traffic_route_manager.py +0 -0
  25. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/usergroup_manager.py +0 -0
  26. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/managers/vpn_manager.py +0 -0
  27. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/schemas.py +0 -0
  28. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tool_index.py +0 -0
  29. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/clients.py +0 -0
  30. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/config.py +0 -0
  31. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/devices.py +0 -0
  32. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/events.py +0 -0
  33. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/firewall.py +0 -0
  34. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/hotspot.py +0 -0
  35. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/network.py +0 -0
  36. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/port_forwards.py +0 -0
  37. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/qos.py +0 -0
  38. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/routing.py +0 -0
  39. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/stats.py +0 -0
  40. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/system.py +0 -0
  41. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/traffic_routes.py +0 -0
  42. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/usergroups.py +0 -0
  43. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools/vpn.py +0 -0
  44. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/tools_manifest.json +0 -0
  45. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/config_helpers.py +0 -0
  46. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/confirmation.py +0 -0
  47. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/diagnostics.py +0 -0
  48. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/lazy_tool_loader.py +0 -0
  49. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/meta_tools.py +0 -0
  50. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/permissions.py +0 -0
  51. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/utils/tool_loader.py +0 -0
  52. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/validator_registry.py +0 -0
  53. {unifi_network_mcp-0.5.1 → unifi_network_mcp-0.5.3}/src/validators.py +0 -0
@@ -1,3 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: unifi-network-mcp
3
+ Version: 0.5.3
4
+ Summary: Unifi Network MCP Server
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: aiohttp>=3.8.5
8
+ Requires-Dist: aiounifi>=88
9
+ Requires-Dist: jsonschema>=4.17.0
10
+ Requires-Dist: mcp[cli]>=1.23.0
11
+ Requires-Dist: omegaconf>=2.3.0
12
+ Requires-Dist: python-dotenv>=1.0.0
13
+ Requires-Dist: pyyaml>=6.0
14
+ Requires-Dist: typing-extensions>=4.4.0
15
+ Description-Content-Type: text/markdown
16
+
1
17
  # 📡 UniFi Network MCP Server
2
18
 
3
19
  [![License][license-shield]](LICENSE)
@@ -525,6 +541,7 @@ The server merges settings from **environment variables**, an optional `.env` fi
525
541
  | `UNIFI_ENABLED_CATEGORIES` | Comma-separated list of tool categories to load (eager mode). See table below |
526
542
  | `UNIFI_ENABLED_TOOLS` | Comma-separated list of specific tool names to register (eager mode) |
527
543
  | `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` |
544
+ | `UNIFI_MCP_ENABLE_DNS_REBINDING_PROTECTION` | Enable/disable DNS rebinding protection. Set to `false` for Kubernetes/proxy deployments where `UNIFI_MCP_ALLOWED_HOSTS` is insufficient. Default `true` |
528
545
 
529
546
  ### Tool Categories (for UNIFI_ENABLED_CATEGORIES)
530
547
 
@@ -746,6 +763,8 @@ These tools will give any LLM or agent configured to use them full access to you
746
763
 
747
764
  The server includes a comprehensive permission system with **safe defaults**:
748
765
 
766
+ > **Permissions control tool visibility.** Tools with disabled permissions are **not registered** with the MCP server and will not appear in your client's tool list. If you're missing expected tools, check that the relevant permissions are enabled. All tools remain discoverable via `unifi_tool_index` regardless of permission settings — but disabled tools cannot be called. See [docs/permissions.md](docs/permissions.md) for full details.
767
+
749
768
  **Disabled by Default (High-Risk):**
750
769
  - Network creation/modification (`unifi_create_network`, `unifi_update_network`)
751
770
  - Wireless configuration (`unifi_create_wlan`, `unifi_update_wlan`)
@@ -796,7 +815,9 @@ See [docs/permissions.md](docs/permissions.md) for complete documentation includ
796
815
  * **Review permissions carefully** before enabling high-risk operations. Use environment variables for runtime control.
797
816
  * Create, update, and delete tools should be used with caution and only enabled when necessary.
798
817
  * 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.
799
- * **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.
818
+ * **Reverse Proxy Configuration:** When running behind a reverse proxy (Kubernetes ingress, Nginx, Cloudflare, etc.):
819
+ * First try: Set `UNIFI_MCP_ALLOWED_HOSTS` to include your external domain (e.g., `localhost,127.0.0.1,unifi-mcp.example.com`)
820
+ * If that's insufficient: Set `UNIFI_MCP_ENABLE_DNS_REBINDING_PROTECTION=false` to disable host validation entirely. Only use this in trusted network environments.
800
821
 
801
822
  ---
802
823
 
@@ -1,19 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: unifi-network-mcp
3
- Version: 0.5.1
4
- Summary: Unifi Network MCP Server
5
- License-File: LICENSE
6
- Requires-Python: >=3.13
7
- Requires-Dist: aiohttp>=3.8.5
8
- Requires-Dist: aiounifi>=88
9
- Requires-Dist: jsonschema>=4.17.0
10
- Requires-Dist: mcp[cli]>=1.23.0
11
- Requires-Dist: omegaconf>=2.3.0
12
- Requires-Dist: python-dotenv>=1.0.0
13
- Requires-Dist: pyyaml>=6.0
14
- Requires-Dist: typing-extensions>=4.4.0
15
- Description-Content-Type: text/markdown
16
-
17
1
  # 📡 UniFi Network MCP Server
18
2
 
19
3
  [![License][license-shield]](LICENSE)
@@ -541,6 +525,7 @@ The server merges settings from **environment variables**, an optional `.env` fi
541
525
  | `UNIFI_ENABLED_CATEGORIES` | Comma-separated list of tool categories to load (eager mode). See table below |
542
526
  | `UNIFI_ENABLED_TOOLS` | Comma-separated list of specific tool names to register (eager mode) |
543
527
  | `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` |
528
+ | `UNIFI_MCP_ENABLE_DNS_REBINDING_PROTECTION` | Enable/disable DNS rebinding protection. Set to `false` for Kubernetes/proxy deployments where `UNIFI_MCP_ALLOWED_HOSTS` is insufficient. Default `true` |
544
529
 
545
530
  ### Tool Categories (for UNIFI_ENABLED_CATEGORIES)
546
531
 
@@ -762,6 +747,8 @@ These tools will give any LLM or agent configured to use them full access to you
762
747
 
763
748
  The server includes a comprehensive permission system with **safe defaults**:
764
749
 
750
+ > **Permissions control tool visibility.** Tools with disabled permissions are **not registered** with the MCP server and will not appear in your client's tool list. If you're missing expected tools, check that the relevant permissions are enabled. All tools remain discoverable via `unifi_tool_index` regardless of permission settings — but disabled tools cannot be called. See [docs/permissions.md](docs/permissions.md) for full details.
751
+
765
752
  **Disabled by Default (High-Risk):**
766
753
  - Network creation/modification (`unifi_create_network`, `unifi_update_network`)
767
754
  - Wireless configuration (`unifi_create_wlan`, `unifi_update_wlan`)
@@ -812,7 +799,9 @@ See [docs/permissions.md](docs/permissions.md) for complete documentation includ
812
799
  * **Review permissions carefully** before enabling high-risk operations. Use environment variables for runtime control.
813
800
  * Create, update, and delete tools should be used with caution and only enabled when necessary.
814
801
  * 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.
815
- * **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.
802
+ * **Reverse Proxy Configuration:** When running behind a reverse proxy (Kubernetes ingress, Nginx, Cloudflare, etc.):
803
+ * First try: Set `UNIFI_MCP_ALLOWED_HOSTS` to include your external domain (e.g., `localhost,127.0.0.1,unifi-mcp.example.com`)
804
+ * If that's insufficient: Set `UNIFI_MCP_ENABLE_DNS_REBINDING_PROTECTION=false` to disable host validation entirely. Only use this in trusted network environments.
816
805
 
817
806
  ---
818
807
 
@@ -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.5.1'
32
- __version_tuple__ = version_tuple = (0, 5, 1)
31
+ __version__ = version = '0.5.3'
32
+ __version_tuple__ = version_tuple = (0, 5, 3)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -253,6 +253,13 @@ async def main_async():
253
253
  logger.info(" Meta-tools: unifi_tool_index, unifi_execute, unifi_batch, unifi_batch_status")
254
254
  logger.info(" Use unifi_execute to run any tool discovered via unifi_tool_index")
255
255
  logger.info(" To load all tools directly: set UNIFI_TOOL_REGISTRATION_MODE=eager")
256
+
257
+ # Setup lazy loading interceptor so unifi_execute/unifi_batch can load tools on demand
258
+ setup_lazy_loading(server, _original_tool_decorator)
259
+
260
+ from src.utils.lazy_tool_loader import TOOL_MODULE_MAP
261
+
262
+ logger.info(f" On-demand loader ready - {len(TOOL_MODULE_MAP)} tools available via unifi_execute")
256
263
  elif UNIFI_TOOL_REGISTRATION_MODE == "lazy":
257
264
  logger.info("⚡ Tool registration mode: lazy")
258
265
  logger.info(" Meta-tools: unifi_tool_index, unifi_execute, unifi_batch, unifi_batch_status, unifi_load_tools")
@@ -80,10 +80,22 @@ def get_server() -> FastMCP:
80
80
  allowed_hosts_str = os.getenv("UNIFI_MCP_ALLOWED_HOSTS", "localhost,127.0.0.1")
81
81
  allowed_hosts = [h.strip() for h in allowed_hosts_str.split(",") if h.strip()]
82
82
 
83
+ # Allow disabling DNS rebinding protection entirely (default: enabled)
84
+ # Set to "false" for Kubernetes/proxy deployments where allowed_hosts is insufficient
85
+ enable_dns_rebinding = (
86
+ os.getenv("UNIFI_MCP_ENABLE_DNS_REBINDING_PROTECTION", "true").lower() == "true"
87
+ )
88
+
83
89
  # Configure transport security settings
84
- transport_security = TransportSecuritySettings(allowed_hosts=allowed_hosts)
90
+ transport_security = TransportSecuritySettings(
91
+ allowed_hosts=allowed_hosts,
92
+ enable_dns_rebinding_protection=enable_dns_rebinding,
93
+ )
85
94
 
86
- logger.debug(f"Configuring FastMCP with allowed_hosts: {allowed_hosts}")
95
+ logger.debug(
96
+ f"Configuring FastMCP with allowed_hosts: {allowed_hosts}, "
97
+ f"dns_rebinding_protection: {enable_dns_rebinding}"
98
+ )
87
99
 
88
100
  server = FastMCP(
89
101
  name="unifi-network-mcp",