Thank you for your interest in contributing to the NetBox MCP Server project!
-
Clone the repository
git clone https://github.com/simonpainter/netbox-mcp.git cd netbox-mcp -
Install dependencies
pip install fastmcp httpx
-
Set up environment variables
export NETBOX_URL="https://netbox.example.com" export NETBOX_TOKEN="your-api-token" export MCP_PORT=8000
-
Test your setup
python3 -m py_compile app.py python3 app.py
This repository follows specific conventions for adding NetBox MCP tools. Please read the detailed guidelines in .github/copilot-instructions.md before contributing.
- Each NetBox resource must have two tools:
search_<resource>andget_<resource>_details - Tools must be organized by NetBox API root (circuits, dcim, ipam, etc.)
- All tools require descriptive docstrings with clear parameter documentation
- Use the helper functions
_search()and_get_detail()(defined inapp.py) to reduce code duplication - Return structured JSON objects (no human-readable messages in responses)
- Identify the NetBox API endpoint and appropriate section in
app.py - Create
search_<resource>function with proper docstring and parameter mapping - Create
get_<resource>_detailsfunction for single object lookup - Run syntax check:
python3 -m py_compile app.py - Test your changes with a running NetBox instance
- Commit with a clear message describing what was added
For detailed step-by-step instructions, see the "How to add a new resource (step-by-step)" section in .github/copilot-instructions.md.
- Follow Python conventions (PEP 8)
- Use type hints:
async def func(args: Dict[str, Any]) -> List[Dict[str, Any]] - Keep functions focused and single-purpose
- Include comprehensive docstrings for all tools
Before submitting a PR:
- Run syntax check:
python3 -m py_compile app.py - Test with your NetBox instance to verify tools work correctly
- Verify parameter mapping matches NetBox API expectations
If you have questions or encounter issues:
- Check the
.github/copilot-instructions.mdfor detailed guidance - Review existing tools in
app.pyfor examples - Open an issue on GitHub for discussion
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.