Skip to main content
Glama
NetBox MCP Server - Read & Write Edition

NetBox MCP Server - Read & Write Edition

by alexkiwi1

NetBox MCP Server - Read & Write Edition

The first Model Context Protocol (MCP) server with full read AND write capabilities for NetBox.

Unlike existing read-only NetBox MCP implementations, this server provides comprehensive CRUD (Create, Read, Update, Delete) operations, enabling you to not only query your NetBox data but also modify it directly through LLMs that support MCP.

What Makes This Special

  • First Read-Write NetBox MCP: The only MCP server that allows both reading from AND writing to NetBox

  • Full CRUD Operations: Create, read, update, and delete any NetBox object type

  • Bulk Operations: Efficiently handle multiple objects at once

  • Comprehensive Coverage: Supports all major NetBox models (DCIM, IPAM, Circuits, Virtualization, etc.)

  • Production Ready: Built with proper error handling, validation, and security practices

Related MCP server: NetBox MCP Server

Features

Read Operations

  • List and filter any NetBox object type

  • Get detailed information about specific objects

  • Access change history and audit trails

  • Advanced filtering and search capabilities

Write Operations

  • Create new devices, IP addresses, sites, racks, and more

  • Update existing object properties

  • Delete objects (with proper safeguards)

  • Bulk create, update, and delete operations

Supported Object Types

DCIM (Device and Infrastructure):

  • devices, device-types, device-roles, manufacturers

  • sites, locations, racks, rack-roles

  • cables, interfaces, power-ports, console-ports

  • platforms, regions, virtual-chassis

IPAM (IP Address Management):

  • ip-addresses, prefixes, vlans, vrfs

  • asns, aggregates, services

  • roles, rirs, route-targets

Circuits:

  • circuits, circuit-types, providers

  • circuit-terminations, provider-networks

Virtualization:

  • virtual-machines, clusters, cluster-groups

  • cluster-types, vm-interfaces

And many more...

Installation

  1. Clone this repository:

git clone https://github.com/alexkiwi1/netbox-mcp-rw.git
cd netbox-mcp-rw
  1. Install dependencies:

# Using UV (recommended)
uv sync

# Or using pip
pip install -e .
  1. Set environment variables:

export NETBOX_URL="https://your-netbox-instance.com/"
export NETBOX_TOKEN="your-api-token"
  1. Test the server:

NETBOX_URL=https://netbox.example.com/ NETBOX_TOKEN=<your-token> uv run server.py

MCP Client Configuration

Claude Desktop (Mac/Windows)

Add to your Claude Desktop configuration:

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

Other MCP Clients

This server works with any MCP-compatible client. Adjust the command and arguments based on your client's requirements.

Usage Examples

Reading Data

"Show me all active devices in the NYC datacenter"
"List available IP addresses in the 10.0.1.0/24 subnet"
"What changes were made to devices last week?"

Writing Data

"Create a new server called 'web-01' in rack R42 at site NYC-DC1"
"Add IP address 192.168.1.100/24 to device 'firewall-01'"
"Update device 'switch-01' status to maintenance mode"
"Create a new VLAN 100 named 'DMZ' at site headquarters"

Bulk Operations

"Create 10 new servers with names web-01 through web-10"
"Update all Cisco devices to set the platform to 'ios'"
"Delete all IP addresses in the decommissioned subnet"

Available Tools

Device Management

  • netbox_get_objects - List/filter any object type

  • netbox_get_object_by_id - Get specific object details

  • netbox_create_object - Create new objects

  • netbox_update_object - Update existing objects

  • netbox_delete_object - Delete objects

  • netbox_bulk_create_objects - Bulk create operations

  • netbox_bulk_update_objects - Bulk update operations

  • netbox_bulk_delete_objects - Bulk delete operations

Audit & History

  • netbox_get_changelogs - Access change history and audit trails

Security Features

  • API tokens stored in environment variables (never hardcoded)

  • SSL/TLS verification enabled by default

  • Proper error handling and validation

  • Audit trail preservation through NetBox's built-in changelog

Requirements

  • Python 3.13+

  • NetBox instance with API access

  • Valid NetBox API token with appropriate permissions

Contributing

This is the first read-write NetBox MCP server - help us make it better:

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests

  5. Submit a pull request

Roadmap

  • Add input validation with Pydantic models

  • Implement caching for better performance

  • Add async support

  • Create comprehensive test suite

  • Add support for custom fields and plugins

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Acknowledgments

Built on top of the excellent FastMCP framework and NetBox's comprehensive REST API.


Warning: This server has write capabilities. Always test in a development environment first and ensure your API token has appropriate permissions. Use bulk operations carefully as they can modify many objects at once.

Available Tools

9 tools
netbox_bulk_create_objectsB

Create multiple objects in NetBox in a single request.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") data: List of dicts containing the object data to create

Returns: List of created objects

Example: To create multiple sites: netbox_bulk_create_objects("sites", [ {"name": "Site A", "slug": "site-a", "status": "active"}, {"name": "Site B", "slug": "site-b", "status": "active"} ])

Inputs: object_type (required), data (required).

netbox_bulk_delete_objectsA

Delete multiple objects from NetBox in a single request.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
object_ids: List of numeric IDs to delete

Returns: Success status

WARNING: This permanently deletes the objects and cannot be undone!

Example: To delete multiple devices: netbox_bulk_delete_objects("devices", [5, 6, 7])

Inputs: object_type (required), object_ids (required).

netbox_bulk_update_objectsA

Update multiple objects in NetBox in a single request.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") data: List of dicts containing the object data to update (must include "id" field)

Returns: List of updated objects

Example: To update multiple devices: netbox_bulk_update_objects("devices", [ {"id": 1, "status": "offline"}, {"id": 2, "status": "maintenance"} ])

Inputs: object_type (required), data (required).

netbox_create_objectB

Create a new object in NetBox.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") data: Dict containing the object data to create

Returns: The created object as a dict

Example: To create a new site: netbox_create_object("sites", { "name": "New Site", "slug": "new-site", "status": "active" })

To create a new device: netbox_create_object("devices", { "name": "new-device", "device_type": 1, # ID of device type "site": 1, # ID of site "role": 1, # ID of device role "status": "active" })

Inputs: object_type (required), data (required).

netbox_delete_objectA

Delete an object from NetBox.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") object_id: The numeric ID of the object to delete

Returns: True if deletion was successful

WARNING: This permanently deletes the object and cannot be undone!

Example: To delete a device: netbox_delete_object("devices", 5)

To delete an IP address: netbox_delete_object("ip-addresses", 123)

Inputs: object_type (required), object_id (required).

netbox_get_changelogsA

Get object change records (changelogs) from NetBox based on filters.

Args: filters: dict of filters to apply to the API call based on the NetBox API filtering options

Returns: List of changelog objects matching the specified filters

Filtering options include:

  • user_id: Filter by user ID who made the change

  • user: Filter by username who made the change

  • changed_object_type_id: Filter by ContentType ID of the changed object

  • changed_object_id: Filter by ID of the changed object

  • object_repr: Filter by object representation (usually contains object name)

  • action: Filter by action type (created, updated, deleted)

  • time_before: Filter for changes made before a given time (ISO 8601 format)

  • time_after: Filter for changes made after a given time (ISO 8601 format)

  • q: Search term to filter by object representation

Example: To find all changes made to a specific device with ID 123: {"changed_object_type_id": "dcim.device", "changed_object_id": 123}

To find all deletions in the last 24 hours: {"action": "delete", "time_after": "2023-01-01T00:00:00Z"}

Each changelog entry contains:

  • id: The unique identifier of the changelog entry

  • user: The user who made the change

  • user_name: The username of the user who made the change

  • request_id: The unique identifier of the request that made the change

  • action: The type of action performed (created, updated, deleted)

  • changed_object_type: The type of object that was changed

  • changed_object_id: The ID of the object that was changed

  • object_repr: String representation of the changed object

  • object_data: The object's data after the change (null for deletions)

  • object_data_v2: Enhanced data representation

  • prechange_data: The object's data before the change (null for creations)

  • postchange_data: The object's data after the change (null for deletions)

  • time: The timestamp when the change was made

Inputs: filters (required).

netbox_get_object_by_idC

Get detailed information about a specific NetBox object by its ID.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") object_id: The numeric ID of the object

Returns: Complete object details

Inputs: object_type (required), object_id (required).

netbox_get_objectsB

Get objects from NetBox based on their type and filters Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") filters: dict of filters to apply to the API call based on the NetBox API filtering options

Valid object_type values:

DCIM (Device and Infrastructure):

  • cables

  • console-ports

  • console-server-ports

  • devices

  • device-bays

  • device-roles

  • device-types

  • front-ports

  • interfaces

  • inventory-items

  • locations

  • manufacturers

  • modules

  • module-bays

  • module-types

  • platforms

  • power-feeds

  • power-outlets

  • power-panels

  • power-ports

  • racks

  • rack-reservations

  • rack-roles

  • regions

  • sites

  • site-groups

  • virtual-chassis

IPAM (IP Address Management):

  • asns

  • asn-ranges

  • aggregates

  • fhrp-groups

  • ip-addresses

  • ip-ranges

  • prefixes

  • rirs

  • roles

  • route-targets

  • services

  • vlans

  • vlan-groups

  • vrfs

Circuits:

  • circuits

  • circuit-types

  • circuit-terminations

  • providers

  • provider-networks

Virtualization:

  • clusters

  • cluster-groups

  • cluster-types

  • virtual-machines

  • vm-interfaces

Tenancy:

  • tenants

  • tenant-groups

  • contacts

  • contact-groups

  • contact-roles

VPN:

  • ike-policies

  • ike-proposals

  • ipsec-policies

  • ipsec-profiles

  • ipsec-proposals

  • l2vpns

  • tunnels

  • tunnel-groups

Wireless:

  • wireless-lans

  • wireless-lan-groups

  • wireless-links

See NetBox API documentation for filtering options for each object type.

Inputs: object_type (required), filters (required).

netbox_update_objectB

Update an existing object in NetBox.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") object_id: The numeric ID of the object to update data: Dict containing the object data to update (only changed fields needed)

Returns: The updated object as a dict

Example: To update a site's description: netbox_update_object("sites", 1, {"description": "Updated description"})

To change a device's status: netbox_update_object("devices", 5, {"status": "offline"})

Inputs: object_type (required), object_id (required), data (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity. The bulk operations (create, update, delete) are separate from single-object operations, and changelog retrieval is a distinct audit function. The object_type parameter consistently differentiates which resource each tool acts upon.

    Naming Consistency5/5

    All tools follow a perfect 'netbox_verb_object' pattern with consistent snake_case throughout. The naming is predictable: netbox_create_object, netbox_get_objects, netbox_update_object, etc., with clear differentiation between singular and bulk operations.

    Tool Count5/5

    9 tools is well-scoped for a comprehensive NetBox API interface. It covers all essential CRUD operations (create, read, update, delete) for both single and bulk scenarios, plus changelog retrieval, without being overwhelming or redundant.

    Completeness5/5

    The toolset provides complete CRUD/lifecycle coverage for NetBox's domain. It includes single and bulk operations for create, read, update, and delete, plus changelog access for audit trails. There are no obvious gaps for the stated read/write purpose.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables read-only interaction with NetBox network documentation and infrastructure data through LLMs. Allows querying devices, sites, IP addresses, and viewing change history via natural language.
      3
      Apache 2.0
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables interaction with NetBox infrastructure management platform to query and manage devices, VMs, IP addresses, and VLANs. Features secure HashiCorp Vault integration and PostgreSQL state tracking for comprehensive infrastructure automation.
      2
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables an LLM to read and write NetBox data through its REST API, supporting listing endpoints, inspecting schemas, and creating, updating, or deleting objects.
      7
      -