Skip to main content
Glama
lucamarien

OPNsense MCP Server

by lucamarien

opn_add_nat_rule

Create a NAT port forwarding rule to map an external destination port to an internal target IP and port, with configurable protocol and interface.

Instructions

Create a NAT port forwarding rule with savepoint protection where supported.

Use this when you need to forward an external port to an internal host. Savepoint protection applies on OPNsense < 26.7 only: there changes auto-revert in 60 seconds unless confirmed with opn_confirm_changes. OPNsense 26.7 removed the savepoint API upstream, so on 26.7+ changes apply immediately and are NOT rolled back automatically. Check opn_mcp_info first: if 'savepoint_support' is false, take a config backup with opn_download_config before changing rules that could lock you out.

Parameters:

  • destination_port: external port to forward (e.g. '8080', '3000-3010') — required

  • target_ip: internal IP address to forward to (e.g. '192.168.1.100') — required

  • interface: source interface (default 'wan')

  • protocol: 'TCP', 'UDP', or 'TCP/UDP' (default 'TCP')

  • target_port: internal port (default: same as destination_port)

  • description: human-readable description

Returns: dict with 'revision' (str), 'uuid' (str), and 'result' (str).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocolNoTCP
interfaceNowan
target_ipNo
descriptionNo
target_portNo
destination_portNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

It discloses the savepoint protection mechanism, including the version-specific behavior (auto-revert on <26.7, immediate on 26.7+), and warns about the risk of lockout if not handled properly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise but contains redundant warnings about the savepoint behavior, repeating information in multiple sentences. It could be streamlined, but remains clear and structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description gives enough context for the tool's purpose and key behaviors, but it does not mention the return value (though output schema exists) or any prerequisites. It does cover the main warning about savepoint and lockout. Overall, it is adequate but could be enhanced with parameter explanations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description does not explain the meaning of any of the parameters (protocol, interface, target_ip, description, target_port, destination_port). It only refers to 'external port' and 'internal host' without linking to specific parameter names, leaving the parameter semantics unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool creates a NAT port forwarding rule and explains the use case: forwarding an external port to an internal host. This distinguishes it from general firewall rules and aligns with its name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says 'Use this when you need to forward an external port to an internal host' and provides important caveats about savepoint behavior and steps to check opn_mcp_info and take backup if needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucamarien/opnsense-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server