惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
The Cloudflare Blog
博客园_首页
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
美团技术团队
博客园 - 【当耐特】
博客园 - Franky
T
Tailwind CSS Blog
雷峰网
雷峰网
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
V
V2EX
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Talk to Your Firewall: Query OPNsense from tools like Cla...
blizzy · 2026-05-12 · via DEV Community

blizzy

Talk to Your Firewall: Query OPNsense from tools like Claude Code with MCP

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

What if you could ask Claude Code "who's on my network right now?" and get a clean answer without opening a terminal?

That's what opnsense-mcp 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.

What You Can Ask

With opnsense-mcp connected, natural language questions become actual firewall queries:

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

The server talks to OPNsense over its native REST API, so responses are live and you stay in your editor.

Quick Start

You need an OPNsense API key. Generate one under System → Access → API.

git clone https://github.com/coreyhines/opnsense-mcp
cd opnsense-mcp
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt

cp examples/.env.example .env
# Edit .env with your API key, secret, and firewall host

Enter fullscreen mode Exit fullscreen mode

Option A: STDIO (local Claude Code / Cursor)

{
  "mcpServers": {
    "opnsense-mcp": {
      "command": "/bin/bash",
      "args": ["/absolute/path/to/opnsense-mcp/mcp_start.sh"],
      "cwd": "/absolute/path/to/opnsense-mcp"
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Option B: SSE (shared service)

sudo bash deploy/install.sh   # Podman + Caddy TLS
# Clients point to https://your-host/sse

Enter fullscreen mode Exit fullscreen mode

A Real Session

Here's what it looks like in practice:

You: "Show me DHCP leases for devices named 'desktop'"

Claude: (calls dhcp tool)

Hostname: desktop-lab, IP: 192.168.10.45, MAC: aa:bb:cc:dd:ee:ff
Status: active, Lease expires: 2026-05-12 08:00

You: "Any blocks in the last 10 minutes?"

Claude: (calls get_logs with time filter)

2026-05-11 18:12:34 BLOCK 10.0.0.55:443 -> 192.168.1.0/24:443 (TCP)
Rule: Default deny / Interface: WAN

No terminal diving. No context-switching. Just questions and answers.

Why I Built This

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.

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.

Get It

If you try it, open an issue or PR — I want to hear what workflows it unlocks for you.


Have an OPNsense box in your homelab? Give it a voice.