LibreNMS MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
LibreNMS MCP Server is a Python-based Model Context Protocol (MCP) server designed to provide advanced, programmable access to LibreNMS network monitoring data and management features. It exposes a modern API for querying, automating, and integrating LibreNMS resources such as devices, ports, alerts, inventory, locations, logs, and more. The server supports both read and write operations, robust security features, and is suitable for integration with automation tools, dashboards, and custom network management workflows.
Features
Core Features
- Query LibreNMS devices, ports, inventory, locations, logs, and alerts with flexible filtering
- Retrieve network topology, device status, and performance metrics
- Access and analyze alert history, event logs, and system health
- Monitor interface statistics, port status, and traffic data
- Track endpoints and connected devices by MAC or IP address
- Retrieve and manage device groups, port groups, and poller groups
- Get detailed information about network services and routing
Management Operations
- Create, update, and delete devices, ports, and groups (if enabled)
- Manage alert rules, notifications, and device metadata
- Configure read-only mode to restrict all write operations for safe monitoring
- Support for bulk operations on devices and ports
Advanced Capabilities
- Rate limiting and API security features
- Real-time network monitoring and health tracking
- Comprehensive logging and audit trails
- SSL/TLS support and configurable timeouts
- Optional tool-search transform for large tool catalogs
- Extensible with custom middlewares and utilities
Installation
Prerequisites
- Python 3.11 to 3.15
- Access to a LibreNMS
- Valid LibreNMS token with appropriate permissions
Quick Install from PyPI
The easiest way to get started is to install from PyPI:
Remember to configure the environment variables for your LibreNMS instance before running the server:
For more details, visit: https://pypi.org/project/librenms-mcp/
Install from Source
1. Clone the repository:
2. Install dependencies:
3. Configure environment variables:
4. Run the server:
Using Docker
A Docker image is available on GitHub Packages for easy deployment. It runs the
HTTP Streamable transport on port 8000 (/mcp).
Open WebUI
Open WebUI 0.6.31 and later connect to the image directly; the separate MCPO
image (ghcr.io/mhajder/librenms-mcpo) is no longer published. In Open WebUI,
go to **Admin Settings > Integrations > External Tool Servers**, add a connection
of type **MCP (Streamable HTTP)** with the URL http:// :8000/mcp, and set
Bearer authentication to your MCP_HTTP_BEARER_TOKEN.
Development Setup
For development with additional tools:
Configuration
Environment Variables
Boolean settings accept true/false, 1/0, yes/no and on/off
(case-insensitive). Any other value stops the server at startup, so a typo
cannot silently turn read-only mode or TLS verification off. The exception is
SENTRY_SEND_DEFAULT_PII and SENTRY_ENABLE_LOGS: when SENTRY_DSN is set, an
invalid value there logs an error and leaves Sentry off, and the server keeps
running.
Available Tools
Device & Inventory Tools
- devices_list: List all devices (with optional filters)
- device_get: Get details for a specific device
- device_add: Add a new device
- device_update: Update device metadata
- device_delete: Remove a device
- device_ports: List all ports for a device
- device_ports_get: Get details for a specific port on a device
- device_fdb: List the forwarding database (learned MACs) for a device
- device_nac: List network access control (802.1X / MAB) sessions on a device
- device_availability: Get device availability
- device_outages: Get device outages
- device_set_maintenance: Set device maintenance mode
- device_discover: Discover or add a device using provided credentials
- device_rename: Rename an existing device
- device_maintenance_status: Get the maintenance status for a device
- device_vlans: List VLANs for a device
- device_links: List links for a device
- device_eventlog_add: Add an event log entry for a device
- inventory_device: Get inventory for a device
- inventory_device_flat: Get flat inventory for a device