{
  "markdown": "# LibreNMS MCP Server\n\n<!-- mcp-name: io.github.mhajder/librenms-mcp -->\n\nLibreNMS 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.\n\n## Features\n\n### Core Features\n\n- Query LibreNMS devices, ports, inventory, locations, logs, and alerts with flexible filtering\n- Retrieve network topology, device status, and performance metrics\n- Access and analyze alert history, event logs, and system health\n- Monitor interface statistics, port status, and traffic data\n- Track endpoints and connected devices by MAC or IP address\n- Retrieve and manage device groups, port groups, and poller groups\n- Get detailed information about network services and routing\n\n### Management Operations\n\n- Create, update, and delete devices, ports, and groups (if enabled)\n- Manage alert rules, notifications, and device metadata\n- Configure read-only mode to restrict all write operations for safe monitoring\n- Support for bulk operations on devices and ports\n\n### Advanced Capabilities\n\n- Rate limiting and API security features\n- Real-time network monitoring and health tracking\n- Comprehensive logging and audit trails\n- SSL/TLS support and configurable timeouts\n- Optional tool-search transform for large tool catalogs\n- Extensible with custom middlewares and utilities\n\n## Installation\n\n### Prerequisites\n\n- Python 3.11 to 3.14\n- Access to a LibreNMS\n- Valid LibreNMS token with appropriate permissions\n\n### Quick Install from PyPI\n\nThe easiest way to get started is to install from PyPI:\n\n```sh\n# Using UV (recommended)\nuvx librenms-mcp\n\n# Or using pip\npip install librenms-mcp\n```\n\nRemember to configure the environment variables for your LibreNMS instance before running the server:\n\n```sh\n# Create environment configuration\nexport LIBRENMS_URL=https://domain.tld:8443\nexport LIBRENMS_TOKEN=your-librenms-token\n```\n\nFor more details, visit: https://pypi.org/project/librenms-mcp/\n\n### Install from Source\n\n1. Clone the repository:\n\n```sh\ngit clone https://github.com/mhajder/librenms-mcp.git\ncd librenms-mcp\n```\n\n2. Install dependencies:\n\n```sh\n# Using UV (recommended)\nuv sync\n\n# Or using pip\npip install -e .\n```\n\n3. Configure environment variables:\n\n```sh\ncp .env.example .env\n# Edit .env with your LibreNMS url and token\n```\n\n4. Run the server:\n\n```sh\n# Using UV (recommended)\nuv run librenms-mcp\n\n# Or using the installed command directly\nlibrenms-mcp\n```\n\n### Using Docker\n\nA Docker images are available on GitHub Packages for easy deployment.\n\n```sh\n# Normal STDIO image\ndocker pull ghcr.io/mhajder/librenms-mcp:latest\n\n# MCPO image for usage with Open WebUI\ndocker pull ghcr.io/mhajder/librenms-mcpo:latest\n```\n\n### Development Setup\n\nFor development with additional tools:\n\n```sh\n# Clone and install with development dependencies\ngit clone https://github.com/mhajder/librenms-mcp.git\ncd librenms-mcp\nuv sync --group dev\n\n# Run tests\nuv run pytest\n\n# Run with coverage\nuv run pytest --cov=src/\n\n# Run linting and formatting\nuv run ruff check .\nuv run ruff format .\n\n# Run type checking\nuv run ty check .\n\n# Setup pre-commit hooks\nuv run prek install\n```\n\n## Configuration\n\n### Environment Variables\n\n```env\n# LibreNMS Connection Details\nLIBRENMS_URL=https://domain.tld:8443\nLIBRENMS_TOKEN=your-librenms-token\n\n# SSL Configuration\nLIBRENMS_VERIFY_SSL=true\nLIBRENMS_TIMEOUT=30\n\n# Read-Only Mode\n# Set READ_ONLY_MODE true to disable all write operations (put, post, delete)\nREAD_ONLY_MODE=false\n\n# Disabled Tags\n# Comma-separated list of tags to disable tools for (empty by default)\n# Example: DISABLED_TAGS=alert,bills\nDISABLED_TAGS=\n\n# Logging Configuration\nLOG_LEVEL=INFO\n\n# Rate Limiting (requests per minute)\n# Set RATE_LIMIT_ENABLED true to enable rate limiting\nRATE_LIMIT_ENABLED=false\nRATE_LIMIT_MAX_REQUESTS=100\nRATE_LIMIT_WINDOW_MINUTES=1\n\n# Tool Search Transform (Optional)\n# Set TOOL_SEARCH_ENABLED true to replace full tool listings with search_tools + call_tool\nTOOL_SEARCH_ENABLED=false\n# Search strategy: bm25 (natural language) or regex (pattern match)\nTOOL_SEARCH_STRATEGY=bm25\n# Maximum number of tools returned by search_tools\nTOOL_SEARCH_MAX_RESULTS=5\n\n# Sentry Error Tracking (Optional)\n# Set SENTRY_DSN to enable error tracking and performance monitoring\n# SENTRY_DSN=https://your-key@o12345.ingest.us.sentry.io/6789\n# Optional Sentry configuration\n# SENTRY_TRACES_SAMPLE_RATE=1.0\n# SENTRY_SEND_DEFAULT_PII=true\n# SENTRY_ENVIRONMENT=production\n# SENTRY_RELEASE=1.2.3\n# SENTRY_PROFILE_SESSION_SAMPLE_RATE=1.0\n# SENTRY_PROFILE_LIFECYCLE=trace\n# SENTRY_ENABLE_LOGS=true\n\n# MCP Transport Configuration\n# Transport type: 'stdio' (default), 'sse' (Server-Sent Events), or 'http' (HTTP Streamable)\nMCP_TRANSPORT=stdio\n\n# HTTP Transport Settings (used when MCP_TRANSPORT=sse or MCP_TRANSPORT=http)\n# Host to bind the HTTP server (default: 127.0.0.1)\n# MCP_HTTP_HOST=127.0.0.1\n# Port to bind the HTTP server (default: 8000)\n# MCP_HTTP_PORT=8000\n# Optional bearer token for authentication (leave empty for no auth)\n# MCP_HTTP_BEARER_TOKEN=\n```\n\n## Available Tools\n\n### Device & Inventory Tools\n\n- `devices_list`: List all devices (with optional filters)\n- `device_get`: Get details for a specific device\n- `device_add`: Add a new device\n- `device_update`: Update device metadata\n- `device_delete`: Remove a device\n- `device_ports`: List all ports for a device\n- `device_ports_get`: Get details for a specific port on a device\n- `device_fdb`: List the forwarding database (learned MACs) for a device\n- `device_nac`: List network access control (802.1X / MAB) sessions on a device\n- `device_availability`: Get device availability\n- `device_outages`: Get device outages\n- `device_set_maintenance`: Set device maintenance mode\n- `device_discover`: Discover or add a device using provided credentials\n- `device_rename`: Rename an existing device\n- `device_maintenance_status`: Get the maintenance status for a device\n- `device_vlans`: List VLANs for a device\n- `device_links`: List links for a device\n- `device_eventlog_add`: Add an event log entry for a device\n- `inventory_device`: Get inventory for a device\n- `inventory_device_flat`: Get flat inventory for a device\n- `devicegroups_list`: List device groups\n- `devicegroup_add`: Add a device group\n- `devicegroup_update`: Update a device group\n- `devicegroup_delete`: Delete a device group\n- `devicegroup_devices`: List devices in a device group\n- `devicegroup_set_maintenance`: Set maintenance for a device group\n- `devicegroup_add_devices`: Add devices to a device group\n- `devicegroup_remove_devices`: Remove devices from a device group\n- `locations_list`: List all locations\n- `location_add`: Add a location\n- `location_edit`: Edit a location\n- `location_delete`: Delete a location\n- `location_get`: Get details for a location\n- `location_set_maintenance`: Set maintenance for a location\n\n### Port & Port Group Tools\n\n- `ports_list`: List all ports (with optional filters)\n- `ports_search`: Search ports (general search)\n- `ports_search_field`: Search ports by a specific field\n- `ports_search_mac`: Search ports by MAC address\n- `port_get`: Get details for a specific port\n- `port_fdb`: List MAC addresses learned on a port\n- `port_ip_info`: Get IP address information for a port\n- `port_transceiver`: Get transceiver information for a port\n- `port_description_get`: Get a port description\n- `port_description_update`: Update a port description\n- `port_groups_list`: List port groups\n- `port_group_add`: Add a port group\n- `port_group_list_ports`: List ports in a port group\n- `port_group_assign`: Assign ports to a port group\n- `port_group_remove`: Remove ports from a port group\n\n### Port Security Tools\n\n- `port_security_list`: List port security configuration across all devices\n- `port_security_device`: Get port security configuration for a device\n- `port_security_port`: Get port security configuration for a single port\n\n### Graph Tools\n\nGraphs are returned as MCP images. LibreNMS serves SVG on current releases and\nPNG on older ones; the MIME type is taken from the response.\n\n- `device_graphs_list`: List the graph types available for a device\n- `device_graph`: Render a device-level graph (e.g. `device_icmp_perf`)\n- `port_graph`: Render a per-port graph by interface name (`bits`, `upkts`, `errors`, `etherlike`)\n- `port_group_graph`: Render a traffic graph for one or more ports by port ID\n\n`port_graph` falls back to the port-group endpoint for `bits` when the per-port\nendpoint fails, which works around LibreNMS releases that return a 500 naming an\nempty graph type.\n\n### Alerting & Logging Tools\n\n- `alerts_get`: List current and historical alerts\n- `alert_get_by_id`: Get details for a specific alert\n- `alert_acknowledge`: Acknowledge an alert\n- `alert_unmute`: Unmute an alert\n- `alert_rules_list`: List alert rules\n- `alert_rule_get`: Get details for a specific alert rule\n- `alert_rule_add`: Add an alert rule\n- `alert_rule_edit`: Edit an alert rule\n- `alert_rule_delete`: Delete an alert rule\n- `alert_templates_list`: List all alert templates\n- `alert_template_get`: Get a specific alert template\n- `alert_template_create`: Create a new alert template\n- `alert_template_edit`: Edit an alert template\n- `logs_eventlog`: Get event log for a device\n- `logs_syslog`: Get syslog for a device\n- `logs_alertlog`: Get alert log for a device\n- `logs_authlog`: Get auth log for a device\n- `logs_syslogsink`: Add a syslog sink\n\n### Billing Tools\n\n- `bills_list`: List bills\n- `bill_get`: Get details for a bill\n- `bill_graph`: Render a bill graph as an image\n- `bill_graph_data`: Get bill graph data\n- `bill_history`: Get bill history\n- `bill_history_graph`: Render a bill history graph as an image\n- `bill_history_graph_data`: Get bill history graph data\n- `bill_create_or_update`: Create or update a bill\n- `bill_delete`: Delete a bill\n\n### Oxidized Tools\n\n- `oxidized_list`: List devices tracked by Oxidized for config backup\n- `oxidized_config_get`: Get the stored configuration for a specific device\n- `oxidized_config_search`: Search all stored device configurations for a string\n\n### Network & Monitoring Tools\n\n- `arp_search`: Search ARP entries\n- `poller_group_get`: Get poller group(s)\n- `routing_ip_addresses`: List all IP addresses from LibreNMS.\n- `services_list`: List all services from LibreNMS.\n- `services_for_device`: Get services for a device from LibreNMS.\n- `service_add`: Add a service to LibreNMS\n- `service_edit`: Edit an existing service\n- `service_delete`: Delete a service\n- `bgp_sessions`: List BGP sessions\n- `bgp_session_get`: Get details for a specific BGP session\n- `bgp_session_edit`: Edit a BGP session\n- `fdb_lookup`: Lookup forwarding database (FDB) entries\n- `nac_list`: List network access control (802.1X / MAB) sessions across all devices\n- `ospf_list`: List OSPF instances\n- `ospf_ports`: List OSPF ports\n- `vrf_list`: List VRFs\n- `ping`: Ping the LibreNMS system\n- `health_list`: List health sensors\n- `health_by_type`: List health sensors by type\n- `health_sensor_get`: Get details for a health sensor\n- `sensors_list`: List sensors\n- `switching_vlans`: List all VLANs from LibreNMS.\n- `switching_links`: List all links from LibreNMS.\n- `system_info`: Get system info from LibreNMS.\n\n- Flexible filtering and search for all major resources (devices, ports, alerts, logs, inventory, etc.)\n\n## Pagination & Limit Support\n\nTo prevent overloading LLM contexts when querying large LibreNMS production instances, all list, search, and log tools support pagination.\n\n### Key Features\n- **Sensible Defaults**: All list tools default to returning **100 results per page**.\n- **Unified Parameters**:\n  - `limit`: The maximum number of results to return (defaults to `100`, minimum `1`).\n  - `offset` (or `start` for log tools): The number of results to skip.\n- **Pagination Metadata**: Every paginated response includes metadata fields:\n  - `limit`: The active limit.\n  - `offset` (or `start`): The active offset.\n  - `count`: The number of items returned in the current page.\n  - `total`: The total number of items available (for log tools, this is provided if returned by the LibreNMS API).\n\n## Security & Safety Features\n\n### Read-Only Mode\n\nThe server supports a read-only mode that disables all write operations for safe monitoring:\n\n```env\nREAD_ONLY_MODE=true\n```\n\n### Tag-Based Tool Filtering\n\nYou can disable specific categories of tools by setting disabled tags:\n\n```env\nDISABLED_TAGS=alert,bills\n```\n\n### Tool Search for Large Toolsets\n\nFastMCP tool search can reduce prompt size for servers with many tools.\nWhen enabled, `list_tools` returns two synthetic tools:\n\n- `search_tools`: Finds matching tools and returns their full schemas\n- `call_tool`: Executes any discovered tool by name\n\nEnable it with:\n\n```env\nTOOL_SEARCH_ENABLED=true\nTOOL_SEARCH_STRATEGY=bm25    # bm25 or regex\nTOOL_SEARCH_MAX_RESULTS=5    # optional, default is 5\n```\n\n`bm25` supports natural language queries, while `regex` uses a regex `pattern` input for deterministic matching.\n\nTool search respects existing visibility controls (read-only mode and disabled tags).\n\n### Rate Limiting\n\nThe server supports rate limiting to control API usage and prevent abuse. If enabled, requests are limited per client using a sliding window algorithm.\n\nEnable rate limiting by setting the following environment variables in your `.env` file:\n\n```env\nRATE_LIMIT_ENABLED=true\nRATE_LIMIT_MAX_REQUESTS=100   # Maximum requests allowed per window\nRATE_LIMIT_WINDOW_MINUTES=1   # Window size in minutes\n```\n\nIf `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.\n\n### Sentry Error Tracking & Monitoring (Optional)\n\nThe server optionally supports **Sentry** for error tracking, performance monitoring, and debugging. Sentry integration is completely optional and only initialized if configured.\n\n#### Installation\n\nTo enable Sentry monitoring, install the optional dependency:\n\n```sh\n# Using UV (recommended)\nuv sync --extra sentry\n```\n\n#### Configuration\n\nEnable Sentry by setting the `SENTRY_DSN` environment variable in your `.env` file:\n\n```env\n# Required: Sentry DSN for your project\nSENTRY_DSN=https://your-key@o12345.ingest.us.sentry.io/6789\n\n# Optional: Performance monitoring sample rate (0.0-1.0, default: 1.0)\nSENTRY_TRACES_SAMPLE_RATE=1.0\n\n# Optional: Include personally identifiable information (default: true)\nSENTRY_SEND_DEFAULT_PII=true\n\n# Optional: Environment name (e.g., \"production\", \"staging\")\nSENTRY_ENVIRONMENT=production\n\n# Optional: Release version (auto-detected from package if not set)\nSENTRY_RELEASE=1.2.2\n\n# Optional: Profiling - continuous profiling sample rate (0.0-1.0, default: 1.0)\nSENTRY_PROFILE_SESSION_SAMPLE_RATE=1.0\n\n# Optional: Profiling - lifecycle mode for profiling (default: \"trace\")\n# Options: \"all\", \"continuation\", \"trace\"\nSENTRY_PROFILE_LIFECYCLE=trace\n\n# Optional: Enable log capture as breadcrumbs and events (default: true)\nSENTRY_ENABLE_LOGS=true\n```\n\n#### Features\n\nWhen enabled, Sentry automatically captures:\n\n- **Exceptions & Errors**: All unhandled exceptions with full context\n- **Performance Metrics**: Request/response times and traces\n- **MCP Integration**: Detailed MCP server activity and interactions\n- **Logs & Breadcrumbs**: Application logs and event trails for debugging\n- **Context Data**: Environment, client info, and request parameters\n\n#### Getting a Sentry DSN\n\n1. Create a free account at [sentry.io](https://sentry.io)\n2. Create a new Python project\n3. Copy your DSN from the project settings\n4. Set it in your `.env` file\n\n#### Disabling Sentry\n\nSentry 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.\n\n### SSL/TLS Configuration\n\nThe server supports SSL certificate verification and custom timeout settings:\n\n```env\nLIBRENMS_VERIFY_SSL=true    # Enable SSL certificate verification\nLIBRENMS_TIMEOUT=30         # Connection timeout in seconds\n```\n\n### Transport Configuration\n\nThe server supports multiple transport mechanisms for the MCP protocol:\n\n#### STDIO Transport (Default)\n\nThe default transport uses standard input/output for communication. This is ideal for local usage and integration with tools that communicate via stdin/stdout:\n\n```env\nMCP_TRANSPORT=stdio\n```\n\n#### HTTP SSE Transport (Server-Sent Events)\n\nFor 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:\n\n```env\nMCP_TRANSPORT=sse\nMCP_HTTP_HOST=127.0.0.1        # Localhost\nMCP_HTTP_PORT=8000           # Port to listen on\nMCP_HTTP_BEARER_TOKEN=your-secret-token  # Optional authentication token\n```\n\nWhen using SSE transport with a bearer token, clients must include the token in their requests:\n\n```bash\ncurl -H \"Authorization: Bearer your-secret-token\" http://localhost:8000/sse\n```\n\n#### HTTP Streamable Transport\n\nThe HTTP Streamable transport provides HTTP-based communication with request/response streaming. This is ideal for web integrations and tools that need HTTP endpoints:\n\n```env\nMCP_TRANSPORT=http\nMCP_HTTP_HOST=127.0.0.1        # Localhost\nMCP_HTTP_PORT=8000           # Port to listen on\nMCP_HTTP_BEARER_TOKEN=your-secret-token  # Optional authentication token\n```\n\nWhen using streamable transport with a bearer token:\n\n```sh\ncurl -H \"Authorization: Bearer your-secret-token\" \\\n     -H \"Accept: application/json, text/event-stream\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}' \\\n     http://localhost:8000/mcp\n```\n\n**Note**: The HTTP transport requires proper JSON-RPC formatting with `jsonrpc` and `id` fields. The server may also require session initialization for some operations.\n\nFor more information on FastMCP transports, see the [FastMCP documentation](https://gofastmcp.com/deployment/running-server#transport-protocols).\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Run tests and ensure code quality (`uv run pytest && uv run ruff check .`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\n## License\n\nMIT License - see LICENSE file for details.\n",
  "bytes": 18744,
  "sha": "4545c52469832a970127c9a5565af0078489f472b466e1088f80dd81e46715b9",
  "repo_slug": "mhajder/librenms-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_mhajder_librenms_mcp_872b64c9/readme"
}