OPNsense MCP fixes: O1,O2,O4,O6 - narrow except, health check, register host, VLAN tools

This commit is contained in:
Hermes CT107
2026-07-04 20:16:00 +00:00
parent 22e4f3a469
commit b62e05113d
7 changed files with 212 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ from typing import Any
from mcp.server.fastmcp import FastMCP
from opnsense_mcp.audit import audit_log
from opnsense_mcp.client import get_client
from opnsense_mcp.client import OpnsenseAPIError, get_client
from opnsense_mcp.config import settings
from opnsense_mcp.guards import is_dry_run_response, require_writes
@@ -17,7 +17,7 @@ def _search_nat(nat_type: str, search_phrase: str, row_count: int) -> str:
client = get_client()
try:
result = client.search_get("firewall", nat_type, "searchRule", search_phrase, row_count)
except Exception:
except OpnsenseAPIError:
result = client.search_grid("firewall", nat_type, "searchRule", search_phrase, row_count)
return json.dumps(result, indent=2, default=str)