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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。