NetBox MCP Server
A read-only FastMCP server that enables AI assistants to query and retrieve network infrastructure information from NetBox using natural language.
README
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
Using uvx (Recommended)
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:
-
Clone the repository:
git clone https://github.com/yourusername/netbox-mcp.git cd netbox-mcp -
Install in development mode:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e . -
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 permissionsNETBOX_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
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.