MCP HubMCP Hub
netboxlabs

netbox-mcp-server

by: netboxlabs

Model Context Protocol (MCP) server for read-only interaction with NetBox data in LLMs

26created 27/02/2025
Visit
NetBox
LLMs

📌Overview

Purpose: To provide a read-only Model Context Protocol (MCP) server for interacting with NetBox data through compatible LLMs.

Overview: The NetBox MCP Server enables users to access NetBox core objects directly using LLMs that support the Model Context Protocol. It focuses on delivering essential data retrieval capabilities while ensuring simplicity and ease of use.

Key Features:

  • get_objects: Retrieves core NetBox objects based on defined types and filters, allowing users to access relevant data effortlessly.

  • search_netbox: Performs a comprehensive global search across all NetBox objects, facilitating quick information retrieval.

  • get_object_by_id: Provides detailed information about specific NetBox objects identified by their unique IDs, enhancing data accessibility for users.


NetBox MCP Server

This is a simple read-only Model Context Protocol server for NetBox. It enables you to interact with your data in NetBox directly via LLMs that support MCP.

Tools

ToolDescription
get_objectsRetrieves NetBox core objects based on their type and filters
get_object_by_idGets detailed information about a specific NetBox object by its ID
get_changelogsRetrieves change history records (audit trail) based on filters

Note: The supported object types are limited to core NetBox objects and do not work with plugin object types.

Usage

  1. Create a read-only API token in NetBox with sufficient permissions for the tool to access the data you want to expose via MCP.

  2. Install dependencies:

    uv add -r requirements.txt
    
  3. Verify the server can run:

    NETBOX_URL=https://netbox.example.com/ NETBOX_TOKEN=<your-api-token> uv run server.py
    
  4. Add the MCP server configuration to your LLM client. For example, in Claude Desktop (Mac):

    {
      "mcpServers": {
        "netbox": {
          "command": "uv",
          "args": [
            "--directory",
            "/path/to/netbox-mcp-server",
            "run",
            "server.py"
          ],
          "env": {
            "NETBOX_URL": "https://netbox.example.com/",
            "NETBOX_TOKEN": "<your-api-token>"
          }
        }
      }
    }
    

    On Windows, use full, escaped paths to your instance, such as C:\\Users\\myuser\\.local\\bin\\uv and C:\\Users\\myuser\\netbox-mcp-server.
    For detailed troubleshooting, consult the MCP quickstart at https://modelcontextprotocol.io/quickstart/user.

  5. Use the tools in your LLM client. For example:

    > Get all devices in the 'Equinix DC14' site
    ...
    > Tell me about my IPAM utilization
    ...
    > What Cisco devices are in my network?
    ...
    > Who made changes to the NYC site in the last week?
    ...
    > Show me all configuration changes to the core router in the last month
    

Development

Contributions are welcome! Please open an issue or submit a PR.

License

This project is licensed under the Apache 2.0 license. See the LICENSE file for details.