LO

lucamarien/opnsense-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

27 stars 12 forks 품질 83 트렌드 14MIT

OPNsense 방화벽을 관리하기위한 보안 MCP 서버. read-only default, savepoint rollback, 보안 감사를 가진 10개의 도메인의 62개의 공구.

개요

Claude Code, Cursor 및 기타 MCP 호환 도구와 같은 AI 보조를 통해 OPNsense 방화벽을 관리하기위한 안전한 모델 Context Protocol (MCP) 서버. 10개 영역에서: 체계, 방화벽, 네트워크, DNS, DHCP, VPN, HAProxy, 서비스, 진단 및 보안. - - - MCP 서버는 OPNsense 24.7에 소개된 MVC 기반 API 엔드포인트에 의존합니다. 이전 버전은 호환되지 않는 다른 API 구조를 사용합니다. 서버는 첫번째 연결에 OPNsense 버전을 자동 탐지하고 정확한 endpoint naming를 선정합니다 (pre-25.7를 위한 camelCase, 25.7+를 위한 snake case). OPNsense 26.x는 변경된 펌웨어 상태 응답 형식을 포함하여 완전히 지원됩니다. 이 MCP 서버는 1 차적인 관심사로 안전으로 디자인됩니다: -- 쓰기 작업은 OPNSENSE ALLOW WRITES=true을 통해 명시된 선택이 필요합니다. - OPNsense는 여전히 savepoint API를 제공, 방화벽 수정은 내장된 60초 자동 변환을 사용합니다. 변경은 명시적으로 확인되거나 자동으로 롤됩니다.

개요(AI 번역)

Claude Code, Cursor 및 기타 MCP 호환 도구와 같은 AI 보조를 통해 OPNsense 방화벽을 관리하기위한 안전한 모델 Context Protocol (MCP) 서버.

81 도구 10개 도메인: 시스템, 방화벽, 네트워크, DNS, DHCP, VPN, HAProxy, 서비스, 진단 및 보안.

요구 사항

  • **Python 3.11+ **
  • ** OPNsense 24.7 또는 newer** — MCP 서버는 OPNsense 24.7에 도입된 MVC 기반 API 엔드포인트에 의존합니다. 이전 버전은 호환되지 않는 다른 API 구조를 사용합니다. 서버는 첫번째 연결에 OPNsense 버전을 자동 탐지하고 정확한 endpoint naming를 선정합니다 (pre-25.7를 위한 camelCase, 25.7+를 위한 snake case). OPNsense 26.x는 변경된 펌웨어 상태 응답 형식을 포함하여 완전히 지원됩니다.

보안 모델

이 MCP 서버는 1 차적인 관심사로 안전으로 디자인됩니다:

  • **기본값으로만 ** — 쓰기 작업은 OPNSENSE_ALLOW_WRITES=true을 통해 명시된 선택사항이 필요합니다.
  • Savepoint/rollback (OPNsense Access > 사용자
  1. 기존 사용자를 편집하거나 전용 API 사용자를 만듭니다.
  • 생산용, 전용 사용자(e.g., mcp-api)을 생성하여 필요한 특권

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

OPNsense MCP Server

A secure Model Context Protocol (MCP) server for managing OPNsense firewalls through AI assistants like Claude Code, Cursor, and other MCP-compatible tools.

81 tools across 10 domains: system, firewall, network, DNS, DHCP, VPN, HAProxy, services, diagnostics, and security.

Requirements

  • Python 3.11+
  • OPNsense 24.7 or newer — the MCP server relies on the MVC-based API endpoints introduced in OPNsense 24.7. Older versions use a different API structure that is not compatible. The server auto-detects the OPNsense version on first connect and selects the correct endpoint naming (camelCase for pre-25.7, snake_case for 25.7+). OPNsense 26.x is fully supported, including its changed firmware status response format.

Security Model

This MCP server is designed with security as the primary concern:

  • Read-only by default — write operations require explicit opt-in via OPNSENSE_ALLOW_WRITES=true
  • Savepoint/rollback (OPNsense < 26.7 only) — where OPNsense still offers the savepoint API, firewall modifications use its built-in 60-second auto-revert; changes must be explicitly confirmed or they roll back automatically. OPNsense 26.7 removed that API upstream — the server detects the missing endpoint at runtime and applies firewall changes immediately, with no automatic rollback
  • Endpoint blocklist — dangerous endpoints (halt, reboot, poweroff, firmware update/upgrade) are hard-blocked at the API client level and can never be called
  • API-only — no SSH access, no command execution, no direct config file manipulation
  • Local transport — STDIO only, no network-exposed HTTP/SSE endpoints
  • No credential exposure — API keys are never included in tool output, logs, or error messages
  • Input validation — hostname parameters are validated against shell metacharacter injection
  • Sensitive data stripping — config backup strips passwords and keys by default

Quick Start

1. Create an OPNsense API Key

  1. Log in to your OPNsense web interface
  2. Go to System > Access > Users
  3. Either edit an existing user or create a dedicated API user:
    • For production use, create a dedicated user (e.g., mcp-api) with only the privileges needed
    • For read-only access, assign the user to a group with read-only API access
  4. Scroll down to the API keys section and click the + button
  5. A key/secret pair will be generated and a file (apikey.txt) will be downloaded
  6. The file contains two lines — key=your-api-key-here and secret=your-api-secret-here
  7. Store these credentials securely — the secret cannot be retrieved again from OPNsense

Tip: For a read-only setup (recommended for getting started), you don’t need to change any permissions — the default API access is sufficient for all read-only tools.

2. Install

# Using pip
pip install opnsense-mcp-server
GitHub에서 전체 README 보기

설치

docker run -i --rm -e OPNSENSE_URL=https://192.168.1.1/api -e OPNSENSE_API_KEY=your-api-key-here -e OPNSENSE_API_SECRET=your-api-secret-here -e OPNSENSE_VERIFY_SSL=false -e OPNSENSE_ALLOW_WRITES=false uhlenheide/opnsense-mcp-server
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "opnsense": { "command": "opnsense-mcp", "env": { "OPNSENSE_URL": "https://192.168.1.1/api", "OPNSENSE_API_KEY": "your-api-key-here", "OPNSENSE_API_SECRET": "your-api-secret-here", "OPNSENSE_VERIFY_SSL": "false", "OPNSENSE_ALLOW_WRITES": "false" } } } }