unifi-network-mcp 0.5.1__py3-none-any.whl → 0.5.3__py3-none-any.whl

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.
src/_version.py CHANGED
@@ -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
src/main.py CHANGED
@@ -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")
src/runtime.py CHANGED
@@ -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",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unifi-network-mcp
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: Unifi Network MCP Server
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.13
@@ -541,6 +541,7 @@ The server merges settings from **environment variables**, an optional `.env` fi
541
541
  | `UNIFI_ENABLED_CATEGORIES` | Comma-separated list of tool categories to load (eager mode). See table below |
542
542
  | `UNIFI_ENABLED_TOOLS` | Comma-separated list of specific tool names to register (eager mode) |
543
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` |
544
545
 
545
546
  ### Tool Categories (for UNIFI_ENABLED_CATEGORIES)
546
547
 
@@ -762,6 +763,8 @@ These tools will give any LLM or agent configured to use them full access to you
762
763
 
763
764
  The server includes a comprehensive permission system with **safe defaults**:
764
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
+
765
768
  **Disabled by Default (High-Risk):**
766
769
  - Network creation/modification (`unifi_create_network`, `unifi_update_network`)
767
770
  - Wireless configuration (`unifi_create_wlan`, `unifi_update_wlan`)
@@ -812,7 +815,9 @@ See [docs/permissions.md](docs/permissions.md) for complete documentation includ
812
815
  * **Review permissions carefully** before enabling high-risk operations. Use environment variables for runtime control.
813
816
  * Create, update, and delete tools should be used with caution and only enabled when necessary.
814
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.
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.
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.
816
821
 
817
822
  ---
818
823
 
@@ -1,8 +1,8 @@
1
- src/_version.py,sha256=cYMOhuaBHd0MIZmumuccsEQ-AxM8LIJy9dsBAWgOpqE,704
1
+ src/_version.py,sha256=EWl7XaGZUG57Di8WiRltpKAkwy1CShJuJ-i6_rAPr-w,704
2
2
  src/bootstrap.py,sha256=mqkDDfn5xKRzun07TS8xPLZm_WnfLt3xTguxxFnfRV0,7572
3
3
  src/jobs.py,sha256=3IUO8ChpeRUjyJTWeFlyIwtkQLv-_KvfzuA5Ra4PmDI,5984
4
- src/main.py,sha256=gmOt3jlpWv5r9dlIpva7YCkZ8Yw45jQR3k9o7hBQhw4,15830
5
- src/runtime.py,sha256=Johuv7cVP0SFD9zDgjJt52E-DvwtcLZpH8FlzP1caFQ,7236
4
+ src/main.py,sha256=uqij-gAld5ARvPHNUP_Od-9UPjTrdEZ-TULvvSr7Lgo,16161
5
+ src/runtime.py,sha256=VGk5c18ebDMP1n54DDGwBmIQZGx8mCS5Hn1UH0K1zak,7679
6
6
  src/schemas.py,sha256=Y9fglAAgRGh8zxwO0J5zpj5BsRMLDDwevwXY_6kj5VU,33725
7
7
  src/tool_index.py,sha256=aUPFqES4i_cq9ZsfAoiWuhKwoEEJ8NEAOafQ2h1g1NE,5492
8
8
  src/validator_registry.py,sha256=dboNY36ZQphCr7tDQuVQtNvXu4X1FBkgqoLb-sGNwJQ,3005
@@ -45,9 +45,9 @@ src/utils/permissions.py,sha256=dILy7uSb7WJsCfpYKr18VpEts3HfUQhNhNGoRV9IExU,4080
45
45
  src/utils/tool_loader.py,sha256=QpfHOxyZ_bzPJM0SItB7UM8uW_p7vl2Sm25rfgfwsAY,4147
46
46
  src/tools_manifest.json,sha256=FX4_TrE4gs8Ao_4B40yinipifyE256fzbwhia9W4-Zs,43100
47
47
  src/config/config.yaml,sha256=KiYwuDyq5L_6QZL-xG1N1gvO7W3Tck1JYZ-fv1YOi8U,4170
48
- unifi_network_mcp-0.5.1.data/data/share/unifi-network-mcp/.well-known/mcp-server.json,sha256=Ru2oF_SdOzkathJVTQ6R0bRB-NTmiXLlNVvsp7GqmPs,1427
49
- unifi_network_mcp-0.5.1.dist-info/METADATA,sha256=cRkmeIzNQMJPwgqped05WGevxLsF2Iz59oCyGu5dhTI,38820
50
- unifi_network_mcp-0.5.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
51
- unifi_network_mcp-0.5.1.dist-info/entry_points.txt,sha256=iDs5JXOBoUROpkuTXoxr-1WSrz1FLEgI0TO4pFsZ8u0,52
52
- unifi_network_mcp-0.5.1.dist-info/licenses/LICENSE,sha256=1tMHOACX4Nse1DzgSKufrvTGztT8kS71LE8l29IAvto,1068
53
- unifi_network_mcp-0.5.1.dist-info/RECORD,,
48
+ unifi_network_mcp-0.5.3.data/data/share/unifi-network-mcp/.well-known/mcp-server.json,sha256=Ru2oF_SdOzkathJVTQ6R0bRB-NTmiXLlNVvsp7GqmPs,1427
49
+ unifi_network_mcp-0.5.3.dist-info/METADATA,sha256=Gk3fEDxJWzRjf6sbA6OkToBSCNu_87OCjDGYTafcYFc,39647
50
+ unifi_network_mcp-0.5.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
51
+ unifi_network_mcp-0.5.3.dist-info/entry_points.txt,sha256=iDs5JXOBoUROpkuTXoxr-1WSrz1FLEgI0TO4pFsZ8u0,52
52
+ unifi_network_mcp-0.5.3.dist-info/licenses/LICENSE,sha256=1tMHOACX4Nse1DzgSKufrvTGztT8kS71LE8l29IAvto,1068
53
+ unifi_network_mcp-0.5.3.dist-info/RECORD,,