Skip to main content
Glama

NetBox MCP Server

by chadkunsman
MIT License

NetBox MCP Server

A comprehensive read-only FastMCP server that exposes NetBox API functionality to AI systems via the Model Context Protocol (MCP).

Overview

This project implements a read-only MCP server that provides comprehensive tools to interact with NetBox infrastructure data. It enables natural language queries about network devices, sites, circuits, and IP prefixes, making it easier for AI assistants to retrieve and present network infrastructure information without allowing any modifications to the NetBox data.

Features

Device Management

  • Query NetBox devices using structured filters
  • Search for devices by specific name
  • Use natural language to ask about devices
  • Support for filtering by site, role, status, manufacturer, and more

Site Operations

  • List all available sites with status and region information
  • Get comprehensive site details including device and rack counts
  • Site-based filtering across all resource types

Circuit Management

  • Query circuits by provider, type, status, and termination sites
  • Search circuits using natural language
  • Track circuit terminations (A-side and Z-side)
  • Filter by circuit ID patterns

IP Prefix Management

  • Query IP prefixes by site, VRF, tenant, status, and role
  • Support for both IPv4 and IPv6 address families
  • VLAN association and filtering
  • Prefix pool management
  • CIDR notation pattern matching

Natural Language Processing

  • Intelligent parsing of natural language queries into structured API calls
  • Fuzzy matching for sites, roles, providers, and circuit types
  • Cross-field search capabilities
  • User-friendly error messages and suggestions

Example Queries

Device Queries

  • "Show me all devices at site SF1"
  • "List all active firewalls"
  • "Tell me about device sf1.as1"
  • "Find all ION devices"
  • "Show switches at NYC location"

Site Queries

  • "List all available sites"
  • "Tell me about site SF1"
  • "Show site information for Denver"

Circuit Queries

  • "Show me circuits from Zayo"
  • "List Internet circuits at SF1"
  • "Find circuit CID-12345"
  • "Show active MPLS circuits"

IP Prefix Queries

  • "Show IPv4 prefixes at SF1"
  • "List all /24 subnets"
  • "Find prefixes in VLAN 100"
  • "Show prefix pools"

Installation

The easiest way to use this MCP server is with uvx:

# Install and run with environment variables uvx --from . \ --with-editable . \ --env NETBOX_URL=https://your-netbox.example.com \ --env NETBOX_TOKEN=your_api_token \ --env NETBOX_SSL_VERIFY=true \ netbox-mcp-server

Development Setup

For development and testing:

  1. Clone the repository:
    git clone https://github.com/yourusername/netbox-mcp.git cd netbox-mcp
  2. Install in development mode:
    uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e .
  3. Set environment variables:
    export NETBOX_URL=https://your-netbox.example.com export NETBOX_TOKEN=your_api_token export NETBOX_SSL_VERIFY=true

Claude Desktop Configuration

Add this to your Claude Desktop MCP configuration:

{ "mcpServers": { "netbox": { "command": "uvx", "args": [ "--from", "git+https://github.com/yourusername/netbox-mcp.git", "--with-editable", ".", "netbox-mcp-server" ], "env": { "NETBOX_URL": "https://your-netbox.example.com", "NETBOX_TOKEN": "your_api_token", "NETBOX_SSL_VERIFY": "true" } } } }

Testing with MCPTools

For development and testing, use MCPTools:

# List all available tools mcp tools uv run --directory src python server.py # Call a specific tool with parameters mcp call get_device --params '{"name":"my-device-01"}' uv run --directory src python server.py # Start interactive testing shell mcp shell uv run --directory src python server.py # View server logs during testing mcp tools --server-logs uv run --directory src python server.py

Configuration

The server requires the following environment variables:

  • NETBOX_URL: URL of your NetBox instance (e.g., https://netbox.example.com)
  • NETBOX_TOKEN: API token with appropriate permissions
  • NETBOX_SSL_VERIFY: Whether to verify SSL certificates (true/false)
  • DEBUG: Enable debug mode (true/false)
  • LOG_LEVEL: Logging level (info, debug, warning, error)

Project Structure

netbox-mcp/ ├── src/ │ ├── server.py # Main MCP server implementation │ ├── tools/ # Tool definitions │ │ ├── devices.py # Device-related tools │ │ ├── sites.py # Site-related tools │ │ ├── circuits.py # Circuit-related tools │ │ └── prefixes.py # IP prefix-related tools │ ├── models/ # Pydantic models │ │ ├── device.py # Device-related models │ │ ├── site.py # Site-related models │ │ ├── circuit.py # Circuit-related models │ │ └── prefix.py # IP prefix-related models │ └── config/ # Configuration │ └── netbox.py # NetBox client configuration ├── docs/ # Documentation └── tests/ # Test files

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

-
security - not tested
A
license - permissive license
-
quality - not tested

A read-only FastMCP server that enables AI assistants to query and retrieve network infrastructure information from NetBox using natural language.

  1. Overview
    1. Features
      1. Device Management
      2. Site Operations
      3. Circuit Management
      4. IP Prefix Management
      5. Natural Language Processing
    2. Example Queries
      1. Device Queries
      2. Site Queries
      3. Circuit Queries
      4. IP Prefix Queries
    3. Installation
      1. Using uvx (Recommended)
      2. Development Setup
      3. Claude Desktop Configuration
      4. Testing with MCPTools
    4. Configuration
      1. Project Structure
        1. License
          1. Contributing

            Related MCP Servers

            • A
              security
              F
              license
              A
              quality
              An MCP protocol server that enables web search functionality using the Tavily API, allowing AI assistants to perform internet searches in real-time.
              Last updated -
              4
              2
              Python
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that enables AI assistants to interact with Linear project management systems, allowing users to retrieve, create, and update issues, projects, and teams through natural language.
              Last updated -
              32
              80
              5
              TypeScript
              MIT License
              • Apple
            • -
              security
              F
              license
              -
              quality
              A FastMCP server that provides natural language interaction with MS SQL databases, enabling users to query data, list tables, describe structures, and execute database operations through a conversational AI interface.
              Last updated -
              Python
            • -
              security
              A
              license
              -
              quality
              An MCP server that enables AI assistants to control a web browser through natural language commands, allowing them to navigate websites and extract information via SSE transport.
              Last updated -
              505
              Python
              MIT License
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/chadkunsman/netbox_mcp'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server