Skip to main content
The UniFi MCP Server is designed with a safety-first philosophy: AI agents can read everything freely, but any operation that modifies your network requires a deliberate, explicit action. Two flags—confirm and dry_run—are built into every mutating tool. All operations, successful or not, are written to an audit log for accountability and troubleshooting.

Confirmation required: confirm=True

Every tool that creates, updates, or deletes a resource requires you to pass confirm=True explicitly. If you omit this flag or pass confirm=False, the tool returns a ConfirmationRequiredError and makes no changes. This design prevents an AI agent from accidentally modifying your network in response to an ambiguous prompt. The confirmation flag must be intentional—it cannot be inferred or defaulted.

Dry-run preview: dry_run=True

Passing dry_run=True to any mutating tool shows you exactly what the operation would do—without actually applying any changes. The tool returns a preview of the configuration that would be sent to the UniFi API.
Always run dry_run=True before executing complex or destructive changes. This is especially useful when creating firewall rules, deleting networks, or making bulk configuration updates where a mistake could disrupt connectivity.
You can combine both flags: dry_run=True takes precedence over confirm=True, so passing both is a safe way to preview.

Audit logging

Every tool call—reads and writes alike—is appended to audit.log in the working directory. The log records the tool name, parameters, outcome, and a timestamp. Sensitive values such as passwords and API keys are automatically masked before writing. Example audit.log entries:
The audit log is append-only and is never truncated by the server. Rotate it externally using a tool like logrotate if needed.

Input validation

All tool parameters are validated using Pydantic models before any API call is made. Validation catches:
  • Missing required fields
  • Values outside allowed ranges (for example, VLAN IDs must be between 1 and 4094)
  • Invalid formats (MAC addresses, IP subnets, SSID names)
  • Unsupported enum values (security types, protocol names)
A ValidationError is returned with a detailed message describing which parameter failed and why, before any network request is made.

Password masking

Any tool parameter that appears to contain a credential—including password, api_key, secret, and similar field names—is replaced with ***MASKED*** in all log output, including the audit log and debug logs. The actual value is never written to disk. This applies to WiFi passwords in create_wlan and update_wlan, RADIUS secrets, and any other sensitive string fields.

Summary of safety mechanisms