<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: blizzy</title>
    <description>The latest articles on DEV Community by blizzy (@blizzy).</description>
    <link>https://dev.to/blizzy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3925529%2Fc3fa031c-dad4-463f-b034-a5094a31b84e.png</url>
      <title>DEV Community: blizzy</title>
      <link>https://dev.to/blizzy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/blizzy"/>
    <language>en</language>
    <item>
      <title>Talk to Your Firewall: Query OPNsense from tools like Claude Code with MCP</title>
      <dc:creator>blizzy</dc:creator>
      <pubDate>Tue, 12 May 2026 03:01:55 +0000</pubDate>
      <link>https://dev.to/blizzy/talk-to-your-firewall-query-opnsense-from-claude-code-with-mcp-2obd</link>
      <guid>https://dev.to/blizzy/talk-to-your-firewall-query-opnsense-from-claude-code-with-mcp-2obd</guid>
      <description>&lt;h2&gt;
  
  
  Talk to Your Firewall: Query OPNsense from tools like Claude Code with MCP
&lt;/h2&gt;

&lt;p&gt;If you run OPNsense at home or in a lab, you've probably lost time to the same ritual: SSH in, run &lt;code&gt;pfctl -sr&lt;/code&gt;, scroll through DHCP leases, or tcpdump a suspicious host. It's not hard — it's just friction.&lt;/p&gt;

&lt;p&gt;What if you could ask Claude Code &lt;em&gt;"who's on my network right now?"&lt;/em&gt; and get a clean answer without opening a terminal?&lt;/p&gt;

&lt;p&gt;That's what &lt;a href="https://github.com/coreyhines/opnsense-mcp" rel="noopener noreferrer"&gt;opnsense-mcp&lt;/a&gt; does. It's a Model Context Protocol (MCP) server that exposes your OPNsense firewall as a set of tools any MCP client can call — stay in your editor, no terminal context-switching.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Can Ask
&lt;/h2&gt;

&lt;p&gt;With &lt;code&gt;opnsense-mcp&lt;/code&gt; connected, natural language questions become actual firewall queries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"What's happening on the network?"&lt;/strong&gt; → ARP table + active DHCP leases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Show me the last 20 blocked connections"&lt;/strong&gt; → Filtered firewall log&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Who is 192.168.1.47?"&lt;/strong&gt; → MAC, hostname, lease status, interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Capture packets from that host for 30 seconds"&lt;/strong&gt; → Packet capture + download link&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"List my firewall rules for port 443"&lt;/strong&gt; → Rule search with descriptions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The server talks to OPNsense over its native REST API, so responses are live and you stay in your editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;

&lt;p&gt;You need an OPNsense API key. Generate one under &lt;strong&gt;System → Access → API&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/coreyhines/opnsense-mcp
&lt;span class="nb"&gt;cd &lt;/span&gt;opnsense-mcp
uv venv &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
uv pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="nb"&gt;cp &lt;/span&gt;examples/.env.example .env
&lt;span class="c"&gt;# Edit .env with your API key, secret, and firewall host&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option A: STDIO (local Claude Code / Cursor)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"opnsense-mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/bin/bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/absolute/path/to/opnsense-mcp/mcp_start.sh"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"cwd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/absolute/path/to/opnsense-mcp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option B: SSE (shared service)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;bash deploy/install.sh   &lt;span class="c"&gt;# Podman + Caddy TLS&lt;/span&gt;
&lt;span class="c"&gt;# Clients point to https://your-host/sse&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A Real Session
&lt;/h2&gt;

&lt;p&gt;Here's what it looks like in practice:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; "Show me DHCP leases for devices named 'desktop'"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Claude:&lt;/strong&gt; &lt;em&gt;(calls &lt;code&gt;dhcp&lt;/code&gt; tool)&lt;/em&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hostname: desktop-lab, IP: 192.168.10.45, MAC: aa:bb:cc:dd:ee:ff
Status: active, Lease expires: 2026-05-12 08:00
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; "Any blocks in the last 10 minutes?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Claude:&lt;/strong&gt; &lt;em&gt;(calls &lt;code&gt;get_logs&lt;/code&gt; with time filter)&lt;/em&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-05-11 18:12:34 BLOCK 10.0.0.55:443 -&amp;gt; 192.168.1.0/24:443 (TCP)
Rule: Default deny / Interface: WAN
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;No terminal diving. No context-switching. Just questions and answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;I manage multiple OPNsense instances and got tired of context-switching between terminals, web dashboards, and my editor. MCP lets the AI client handle the mechanical work — formatting tables, filtering logs, correlating ARP with DHCP — while I stay focused on the actual decision.&lt;/p&gt;

&lt;p&gt;The server is intentionally narrow: it doesn't write rules unless you ask it to, and it logs what it touches. You can run it locally (STDIO) or host it as a shared SSE endpoint for a team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/coreyhines/opnsense-mcp" rel="noopener noreferrer"&gt;coreyhines/opnsense-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glama:&lt;/strong&gt; &lt;a href="https://glama.ai/mcp/servers/coreyhines/opnsense-mcp" rel="noopener noreferrer"&gt;glama.ai/mcp/servers/coreyhines/opnsense-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requirements:&lt;/strong&gt; Python 3.11+, OPNsense API key, &lt;code&gt;uv&lt;/code&gt; or &lt;code&gt;pip&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try it, open an issue or PR — I want to hear what workflows it unlocks for you.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Have an OPNsense box in your homelab? Give it a voice.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>opnsense</category>
      <category>homelab</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
