
LibreNMS MCP
io.github.mhajder由 GitHub 账号 mhajder 发布v1.13.0更新于 Nov 7, 2026
MCP server for LibreNMS network monitoring - query devices, ports, alerts, and manage infrastructure
概览
将助手连接到 LibreNMS 网络监控实例,用于查询设备、端口、告警、日志与健康状态,并可选择进行管理操作。
- 可以做什么
- 列出、查看、添加、更新、重命名和删除设备、资产清单、位置与设备组
- 搜索端口,查看端口详情、FDB、光模块与端口安全配置,并管理端口组
- 查看告警、告警规则与模板,确认或取消静音告警,读取事件、syslog、告警与认证日志
- 以图片形式渲染设备、端口、端口组和账单图表
- 查看路由、BGP、OSPF、VRF、VLAN、链路、ARP、服务、传感器及 Oxidized 配置备份
- 创建、更新和删除账单与服务,并设置维护模式
- 适用场景
- 适合已部署 LibreNMS、希望让助手回答网络状态问题、排查告警与中断,或在不打开网页界面的情况下完成确认告警、修改描述、添加设备等日常操作的场景。
- 运行要求
- 以本地 Python 包运行(Python 3.11 至 3.15,可用 uvx 或 pip),或以 Docker 镜像在 8000 端口提供 HTTP 服务。需要能访问 LibreNMS 实例,通过 LIBRENMS_URL 配置,并在 LIBRENMS_TOKEN 中提供 API 令牌。TLS 校验、超时、传输方式、限流和 Sentry 为可选项。
安装
在 SourceWeft 中
- 打开 控制台中的 LibreNMS MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
LibreNMS MCP Server
Let AI agents query and manage LibreNMS network monitoring through the Model Context Protocol
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
- Clone the repository:
- Install dependencies:
- Configure environment variables:
- 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://<host>: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 devicedevice_add: Add a new devicedevice_update: Update device metadatadevice_delete: Remove a devicedevice_ports: List all ports for a devicedevice_ports_get: Get details for a specific port on a devicedevice_fdb: List the forwarding database (learned MACs) for a devicedevice_nac: List network access control (802.1X / MAB) sessions on a devicedevice_availability: Get device availabilitydevice_outages: Get device outagesdevice_set_maintenance: Set device maintenance modedevice_discover: Discover or add a device using provided credentialsdevice_rename: Rename an existing devicedevice_maintenance_status: Get the maintenance status for a devicedevice_vlans: List VLANs for a devicedevice_links: List links for a devicedevice_wireless_sensors: List wireless sensors (frequency, clients, rssi, ...) with current valuesdevice_parents_set: Set the dependency parents of a device (replaces the current set)device_parents_clear: Remove dependency parents from a devicedevice_eventlog_add: Add an event log entry for a deviceinventory_device: Get inventory for a deviceinventory_device_flat: Get flat inventory for a devicedevicegroups_list: List device groupsdevicegroup_add: Add a device groupdevicegroup_update: Update a device groupdevicegroup_delete: Delete a device groupdevicegroup_devices: List devices in a device groupdevicegroup_set_maintenance: Set maintenance for a device groupdevicegroup_add_devices: Add devices to a device groupdevicegroup_remove_devices: Remove devices from a device grouplocations_list: List all locationslocation_add: Add a locationlocation_edit: Edit a locationlocation_delete: Delete a locationlocation_get: Get details for a locationlocation_set_maintenance: Set maintenance for a location
Port & Port Group Tools
ports_list: List all ports (with optional filters)ports_search: Search ports (general search)ports_search_field: Search ports by a specific fieldports_search_mac: Search ports by MAC addressport_get: Get details for a specific portport_fdb: List MAC addresses learned on a portport_ip_info: Get IP address information for a portport_transceiver: Get transceiver information for a portport_description_get: Get a port descriptionport_description_update: Update a port descriptionport_groups_list: List port groupsport_group_add: Add a port groupport_group_list_ports: List ports in a port groupport_group_assign: Assign ports to a port groupport_group_remove: Remove ports from a port group
Port Security Tools
port_security_list: List port security configuration across all devicesport_security_device: Get port security configuration for a deviceport_security_port: Get port security configuration for a single port
Graph Tools
Graphs are returned as MCP images. The tools ask LibreNMS for PNG, which MCP
clients such as Claude can display (SVG, LibreNMS's default webui.graph_type,
often is not). A LibreNMS release that ignores the request renders in its
webui.graph_type format instead; the MIME type is taken from the response.
device_graphs_list: List the graph types available for a devicedevice_graph: Render a device-level graph (e.g.device_icmp_perf)port_graph: Render a per-port graph by interface name (bits,upkts,nupkts,errors,etherlike; the LibreNMS names such asport_bitsare accepted too)port_group_graph: Render a traffic graph for one or more ports by port ID
Interface names containing a slash (Te2/7) are sent percent-encoded, and some
reverse proxies reject or decode the encoded slash. When that happens,
port_graph (for bits) and device_ports_get retry by port ID instead, so
they still work behind such a proxy. Authentication errors are never retried,
and LibreNMS's own "not found" answers are reported as is for names without a
slash (a name with a slash is always retried, since a decoding proxy can turn it
into a LibreNMS "not found" for the wrong path).
Other tools that put a slash-bearing value in the path (ports_search,
ports_search_field, oxidized_config_search with a prefix such as
0.0.0.0/0, location names) have no such fallback. If LibreNMS sits
behind Apache, allow encoded slashes so every tool works:
A 400 or 404 for a path with an encoded slash that did not come from LibreNMS includes this hint in the tool's error message.
Alerting & Logging Tools
alerts_get: List current and historical alertsalert_get_by_id: Get details for a specific alertalert_acknowledge: Acknowledge an alertalert_unmute: Unmute an alertalert_rules_list: List alert rulesalert_rule_get: Get details for a specific alert rulealert_rule_add: Add an alert rulealert_rule_edit: Edit an alert rulealert_rule_delete: Delete an alert rulealert_templates_list: List all alert templatesalert_template_get: Get a specific alert templatealert_template_create: Create a new alert templatealert_template_edit: Edit an alert templatelogs_eventlog: Get event log for a device, or for all devices when no hostname is givenlogs_syslog: Get syslog for a device, or for all devices when no hostname is givenlogs_alertlog: Get alert log for a device, or for all devices when no hostname is givenlogs_authlog: Get the server-wide authentication loglogs_syslogsink: Add a syslog sink
Billing Tools
bills_list: List billsbill_get: Get details for a billbill_graph: Render a bill graph as an imagebill_graph_data: Get bill graph databill_history: Get bill historybill_history_graph: Render a bill history graph as an imagebill_history_graph_data: Get bill history graph databill_create_or_update: Create or update a billbill_delete: Delete a bill
Oxidized Tools
oxidized_list: List devices tracked by Oxidized for config backupoxidized_config_get: Get the stored configuration for a specific deviceoxidized_config_search: Search all stored device configurations for a string
Network & Monitoring Tools
-
arp_search: Search ARP entries -
poller_group_get: Get poller group(s) -
routing_ip_addresses: List all IP addresses from LibreNMS. -
services_list: List all services from LibreNMS. -
services_for_device: Get services for a device from LibreNMS. -
service_add: Add a service to LibreNMS -
service_edit: Edit an existing service -
service_delete: Delete a service -
bgp_sessions: List BGP sessions -
bgp_session_get: Get details for a specific BGP session -
bgp_session_edit: Edit a BGP session -
fdb_lookup: Lookup forwarding database (FDB) entries -
nac_list: List network access control (802.1X / MAB) sessions across all devices -
ospf_list: List OSPF instances -
ospf_ports: List OSPF ports -
vrf_list: List VRFs -
ping: Ping the LibreNMS system -
health_list: List health sensors -
health_by_type: List health sensors by type -
health_sensor_get: Get details for a health sensor -
sensors_list: List sensors -
switching_vlans: List all VLANs from LibreNMS. -
switching_links: List all links from LibreNMS. -
system_info: Get system info from LibreNMS. -
Flexible filtering and search for all major resources (devices, ports, alerts, logs, inventory, etc.)
📄 Pagination & Limit Support
To prevent overloading LLM contexts when querying large LibreNMS production instances, all list, search, and log tools support pagination.
Key Features
- Sensible Defaults: All list tools default to returning 100 results per page.
- Unified Parameters:
limit: The maximum number of results to return (defaults to100, minimum1).offset(orstartfor log tools): The number of results to skip.
- Pagination Metadata: Every paginated response includes metadata fields:
limit: The active limit.offset(orstart): The active offset.count: The number of items returned in the current page.total: The total number of items available (for log tools, this is provided if returned by the LibreNMS API).
🚨 Error Responses
Every tool that returns JSON reports a failure in LibreNMS's own error shape, whether the error came from LibreNMS, from a check in this server, or from an exception such as a timeout:
Check status == "error". Up to 1.11.3, exceptions were returned as
{"error": "..."}; clients that looked for an error key need updating.
🔒 Security & Safety Features
SNMP Credential Redaction
LibreNMS returns the full device record from its device endpoints (get, list
and search), including the SNMP community and the SNMPv3 username and
passphrases in plain text. No tool needs them, and anything a tool returns
ends up in an AI client's context, chat history and traces, so the server
replaces them with <redacted> as soon as a response is decoded:
- the
community,authname,authpassandcryptopassvalues of device records (objects with adevice_idand ahostnameorsnmpver); - the community and SNMPv3 username and passphrase arguments (
-C,-U,-A,-Xand their long forms) in theservice_paramofsnmp(check_snmp) services; - the same device values in raw response text quoted in an error message.
Unset values stay as they are, so you can still see whether a credential is
configured; the SNMP version and algorithms are left visible for
troubleshooting. A community field outside a device record (a BGP
community, for instance) is not a credential and is left as is. Credentials
in other services' parameters (such as a check_mysql password) are not
redacted, and credentials sent with device_add are unaffected.
Redaction is on by default. A deployment whose clients need the credentials, such as a trusted automation, can turn it off:
Read-Only Mode
The server supports a read-only mode that disables all write operations for safe monitoring:
Tag-Based Tool Filtering
You can disable specific categories of tools by setting disabled tags:
A tool is hidden when any of its tags is disabled, and some tools carry more
than one category tag: for example, port_graph is tagged graphs and ports,
and ospf_list is tagged routing and ospf, so DISABLED_TAGS=ports also
hides port_graph. Alerting is split into three tags: alert (current alerts:
list, acknowledge, unmute), alert-rules and alert-templates; disable all
three to hide every alerting tool.
Besides the categories, read-only marks the tools that stay available in
read-only mode. The admin and global-read tags follow the permission groups
older LibreNMS releases used for their API routes (can:admin,
can:global-read). Current LibreNMS checks permissions per object instead, so
treat these two as broad categories rather than an exact match of what your
LibreNMS user may do.
Tool Search for Large Toolsets
FastMCP tool search can reduce prompt size for servers with many tools.
When enabled, list_tools returns two synthetic tools:
search_tools: Finds matching tools and returns their full schemascall_tool: Executes any discovered tool by name
Enable it with:
bm25 supports natural language queries, while regex uses a regex pattern input for deterministic matching.
Tool search respects existing visibility controls (read-only mode and disabled tags).
Short Device Names
LibreNMS matches devices by their full hostname or ID, so a call naming a
device by its short name (rtr1 for rtr1.dc1.example.net) answers
"Device rtr1 does not exist". With
a bare short name in a tool's hostname or device argument is replaced by
the stored hostname of the one device whose hostname, up to the first dot, or
whose sysName equals it (ignoring case), so a device added by IP is found by
its sysName. A device whose stored hostname is the name itself always wins,
so calls that already worked keep working. Surrounding whitespace is ignored.
This costs two devices searches (hostname and sysName) per call that uses a
short name. Names containing a dot or a colon (FQDNs, IP addresses) and
device IDs are sent as given, a name that matches no device is left for the
tool to report, and a name that matches several devices is refused with a
tool error listing the candidates.
Rate Limiting
The server supports rate limiting to control API usage and prevent abuse. If enabled, requests are limited per client using a sliding window algorithm.
Enable rate limiting by setting the following environment variables in your .env file:
If RATE_LIMIT_ENABLED is set to true, the server will apply rate limiting middleware. Adjust RATE_LIMIT_MAX_REQUESTS and RATE_LIMIT_WINDOW_MINUTES as needed for your environment.
Sentry Error Tracking & Monitoring (Optional)
The server optionally supports Sentry for error tracking, performance monitoring, and debugging. Sentry integration is completely optional and only initialized if configured.
Installation
To enable Sentry monitoring, install the optional dependency:
Configuration
Enable Sentry by setting the SENTRY_DSN environment variable in your .env file:
Features
When enabled, Sentry automatically captures:
- Exceptions & Errors: All unhandled exceptions with full context
- Performance Metrics: Request/response times and traces
- MCP Integration: Detailed MCP server activity and interactions
- Logs & Breadcrumbs: Application logs and event trails for debugging
- Context Data: Environment, client info, and request parameters
Getting a Sentry DSN
- Create a free account at sentry.io
- Create a new Python project
- Copy your DSN from the project settings
- Set it in your
.envfile
Disabling Sentry
Sentry is completely optional. If you don't set SENTRY_DSN, the server will run normally without any Sentry integration, and no monitoring data will be collected.
SSL/TLS Configuration
The server supports SSL certificate verification and custom timeout settings:
Transport Configuration
The server supports multiple transport mechanisms for the MCP protocol. MCP_TRANSPORT is case-insensitive, streamable-http is accepted as an alias for http, and any other value stops the server at startup with an error rather than silently falling back to STDIO:
STDIO Transport (Default)
The default transport uses standard input/output for communication. This is ideal for local usage and integration with tools that communicate via stdin/stdout:
HTTP SSE Transport (Server-Sent Events)
For network-based deployments, you can use HTTP with Server-Sent Events. This allows the MCP server to be accessed over HTTP with real-time streaming:
When using SSE transport with a bearer token, clients must include the token in their requests:
HTTP Streamable Transport
The HTTP Streamable transport provides HTTP-based communication with request/response streaming. This is ideal for web integrations and tools that need HTTP endpoints:
When using streamable transport with a bearer token:
Note: The HTTP transport requires proper JSON-RPC formatting with jsonrpc and id fields. The server may also require session initialization for some operations.
Health Endpoint
Both HTTP transports (sse and http) serve GET /health, which answers 200 ok
when the server is handling requests. It needs no bearer token and does not
contact LibreNMS, so a LibreNMS outage does not mark the MCP server unhealthy.
The Docker image's HEALTHCHECK uses it:
For more information on FastMCP transports, see the FastMCP documentation.
🤝 Contributing
Contributions are welcome. See CONTRIBUTING.md for the dev setup, checks and commit message format, and use the issue templates for bugs and feature requests.
Found a security problem? Please report it privately as described in SECURITY.md.
📜 License
MIT License - see LICENSE for details.
来源:README.md,提交 692f1de
工具
0版本历史
4- v1.13.0最新Nov 7, 2026
- v1.12.0Oct 13, 2026
- v1.11.3Oct 7, 2026
- v1.11.2Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分