NetBox MCP

v0.4.0
io.github.mhajder/netbox-mcp Checked 12 hours ago Published 3 days ago

MCP server for NetBox DCIM/IPAM with read-only and dry-run modes

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

netbox_list_object_types Netbox List Object Types

List the NetBox object types these tools accept, with their API endpoints. Types are named 'app.model' (e.g. 'dcim.device'). Plugin types appear when the server runs with plugin discovery enabled.

ParameterTypeDescription
appOnly types of this app, e.g. 'dcim', 'ipam', 'netbox_dns'.
rediscoverbooleanRe-read plugin types from NetBox (plugin discovery must be enabled on the server).

netbox_get_objects Netbox Get Objects

List NetBox objects of one type, with filtering and pagination. Returns 'results' plus 'total' (all matches) and 'has_more'/'next_offset'. Results are paginated - check 'has_more' before concluding. To count objects cheaply use fields=['id'] and limit=1 and read 'total'.

ParameterTypeDescription
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.
briefbooleanReturn the minimal representation (id, url, display, name).
fieldsOnly return these fields, e.g. ['id', 'name', 'status']. ALWAYS pass this for listings - full objects cost 10x more tokens.
filtersNetBox filters, e.g. {'site_id': 1, 'status': 'active', 'name__ic': 'core'}. Pass a list for OR: {'id': [1, 2]}. null matches empty: {'tenant_id': None}. Lookup suffixes: n, ic, nic, isw, nisw, iew, n…
limitintegerPage size (1-1000).
offsetintegerNumber of results to skip.
omitDrop these fields from the response, e.g. ['config_context', 'custom_fields']. NetBox 4.5.2+. Ignored when 'fields' is set.
orderingSort field(s); prefix with '-' for descending, e.g. 'name' or ['site', '-name'].

netbox_get_object Netbox Get Object

Get one NetBox object by type and ID.

ParameterTypeDescription
object_id *integerNumeric object ID.
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.
briefbooleanReturn the minimal representation (id, url, display, name).
fieldsOnly return these fields, e.g. ['id', 'name', 'status']. ALWAYS pass this for listings - full objects cost 10x more tokens.
omitDrop these fields from the response, e.g. ['config_context', 'custom_fields']. NetBox 4.5.2+. Ignored when 'fields' is set.

netbox_search_objects Netbox Search Objects

Search several NetBox object types at once with NetBox's 'q' filter. Returns results keyed by object type. A '_meta' key appears when some types failed ('errors' - treat as unknown, NOT as "no match") or had more matches than 'limit' ('truncated' - the full count per type).

ParameterTypeDescription
query *stringFree text: a name, IP, serial, asset tag, description...
fieldsOnly return these fields, e.g. ['id', 'name', 'status']. ALWAYS pass this for listings - full objects cost 10x more tokens.
limitintegerMaximum results per type.
object_typesTypes to search. Default: dcim.device, dcim.site, ipam.ipaddress, ipam.prefix, dcim.interface, dcim.rack, ipam.vlan, circuits.circuit, virtualization.virtualmachine

netbox_describe_object_type Netbox Describe Object Type

Describe the writable fields of an object type: type, required, choices. Call this before creating or updating an object to build a valid payload. Foreign keys take the related object's numeric ID.

ParameterTypeDescription
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_get_changelogs Netbox Get Changelogs

List change log entries (who changed what and when), newest first. Each entry has action (create/update/delete), user_name, time, changed_object_type/id and object_repr. Entries of one request share a request_id. Set include_data to see what exactly changed.

ParameterTypeDescription
filtersChange log filters, e.g. {'changed_object_type': 'dcim.device', 'changed_object_id': 5}, {'user': 'admin'}, {'action': 'delete'}, {'time_after': '2026-01-01T00:00:00Z'}, {'request_id': '<uuid>'}.
include_databooleanInclude prechange_data/postchange_data - the full object before and after the change (several KB per entry). Use it with a narrow filter, e.g. one changed_object_id.
limitintegerPage size (1-1000).
offsetintegerNumber of results to skip.

netbox_get_status Netbox Get Status

Get NetBox version, installed plugins and apps, worker status and the authenticated user. Also reports this server's read-only/dry-run modes.

netbox_graphql_query Netbox Graphql Query

Run a read-only GraphQL query against NetBox's /graphql/ endpoint. Use it to fetch nested data that would otherwise need many REST calls. Mutations and subscriptions are rejected. Always paginate large lists, e.g. device_list(pagination: {limit: 50}).

ParameterTypeDescription
query *stringGraphQL query. Fetch related data in one round trip, e.g. '{ device_list(filters: {site: {name: {exact: "DC1"}}}) { id name interfaces { name ip_addresses { address } } } }'. NetBox 4.5+ requires look…
variablesGraphQL variables.

netbox_get_available Netbox Get Available

List free IPs, child prefixes, VLAN IDs or ASNs in a pool. Examples: free IPs in prefix 12 -> ('ipam.prefix', 12, 'ips'); free /24s in a prefix -> ('ipam.prefix', 12, 'prefixes'); free VLAN IDs in group 3 -> ('ipam.vlangroup', 3, 'vlans').

ParameterTypeDescription
kind *stringWhat to look for: 'ips' (prefix or IP range), 'prefixes' (prefix), 'vlans' (VLAN group), 'asns' (ASN range).
parent_id *integerNumeric object ID.
parent_type *stringType of the parent object that holds the pool.
limitintegerMaximum results.

netbox_trace_cable Netbox Trace Cable

Trace cable paths from a port through patch panels and circuits. For an interface, console, power port/outlet or power feed: the path from it to the far end, one hop (near end, cable, far end) per segment. For a pass-through port (front/rear port, circuit termination): every cable path running through it, each as its list of nodes.

ParameterTypeDescription
object_id *integerNumeric object ID.
object_type *stringType of the starting port.

netbox_render_config Netbox Render Config

Render the configuration of a device or VM from its assigned config template (NetBox config templates + config context). Changes nothing, but NetBox only allows it for API tokens with write enabled.

ParameterTypeDescription
object_id *integerNumeric object ID.
object_type *stringDevice or virtual machine.
config_template_idRender this config template instead of the one assigned to the object.
extra_contextExtra variables merged into the template context.

netbox_find_rack_space Netbox Find Rack Space

Find racks with room for a device of a given height. Counts devices on the chosen face (and full-depth devices on the other) and rack reservations as taken. Lists the bottom-up start positions where the device fits. Give at least one of site_id, location_id or rack_ids.

ParameterTypeDescription
u_height *numberHeight of the device to place, in rack units.
facestringRack face to mount on.
full_depthbooleanThe device is full depth, so the other face must be free too.
location_idSearch this location.
max_racksintegerRacks to check.
rack_idsSearch these racks.
site_idSearch this site.

netbox_get_prefix_utilization Netbox Get Prefix Utilization

Get the utilization of prefixes, as shown in the NetBox UI. A container counts the address space of its child prefixes; any other prefix counts its IP addresses plus IP ranges marked utilized. NetBox's REST API does not return this, so it is computed from the children.

ParameterTypeDescription
prefix_ids *arrayPrefix IDs. Find them with netbox_get_objects on 'ipam.prefix' (e.g. filters={'site_id': 1}).

netbox_create_object Netbox Create Object

Create one NetBox object. Returns the created object. Look up related objects first (netbox_get_objects) and pass their IDs.

ParameterTypeDescription
data *objectField values. Foreign keys take numeric IDs, e.g. {'name': 'sw01', 'device_type': 4, 'role': 2, 'site': 1, 'status': 'active'}. Tags: [{'name': 'core'}] or [3]. Use netbox_describe_object_type for the…
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_update_object Netbox Update Object

Update fields of one NetBox object (partial update). Returns the updated object.

ParameterTypeDescription
data *objectOnly the fields to change (PATCH), e.g. {'status': 'offline', 'description': 'RMA'}.
object_id *integerNumeric object ID.
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_bulk_create_objects Netbox Bulk Create Objects

Create many objects of one type in a single transaction (all or nothing). Returns the IDs of the created objects.

ParameterTypeDescription
data *arrayObjects to write.
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_bulk_update_objects Netbox Bulk Update Objects

Update many objects of one type in a single transaction (all or nothing).

ParameterTypeDescription
data *arrayPartial updates, each with the object 'id', e.g. [{'id': 1, 'status': 'active'}, {'id': 2, 'status': 'active'}].
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_allocate_available Netbox Allocate Available

Allocate the next free IP, prefix, VLAN or ASN from a pool and create it. NetBox picks the value atomically, so concurrent callers never get the same one.

ParameterTypeDescription
kind *stringWhat to look for: 'ips' (prefix or IP range), 'prefixes' (prefix), 'vlans' (VLAN group), 'asns' (ASN range).
parent_id *integerNumeric object ID.
parent_type *stringType of the parent object that holds the pool.
dataAttributes of the new object(s). Prefixes need {'prefix_length': 24}; VLANs need {'name': 'users'}. A list allocates several at once, e.g. [{'description': 'a'}, {'description': 'b'}] for two IPs.

netbox_delete_object Netbox Delete Object

Permanently delete one NetBox object. Dependent objects may be deleted with it (e.g. a device's interfaces). Confirm with the user first.

ParameterTypeDescription
object_id *integerNumeric object ID.
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_bulk_delete_objects Netbox Bulk Delete Objects

Permanently delete many objects of one type in a single transaction. Confirm with the user first.

ParameterTypeDescription
object_ids *arrayIDs of the objects to delete.
object_type *stringNetBox object type as 'app.model' (e.g. 'dcim.device', 'ipam.ipaddress', 'virtualization.virtualmachine') or as an API path ('dcim/devices'). netbox_list_object_types lists every type.

netbox_run_script Netbox Run Script

Run a NetBox custom script and return its log and output. Runs with commit=false (changes rolled back) unless commit is set. The script runs as a background job; if it is still running after wait_seconds, poll it with netbox_get_object('core.job', job id). Confirm with the user before commit=true.

ParameterTypeDescription
script *Script ID, or 'module.ClassName' (e.g. 'cleanup.StaleIPs'). List scripts with netbox_get_objects on 'extras.script'.
commitbooleanKeep the script's database changes. False (default) runs it and rolls its changes back - use that first.
dataValues for the script's input variables, e.g. {'site': 3, 'dry_run_note': 'test'}. Object variables take IDs.
wait_secondsintegerHow long to wait for the result. 0 returns as soon as the job is queued.

netbox_connect_cable Netbox Connect Cable

Connect ports with a new cable. Ports can be given by device and name - no ID lookups needed. Fails before writing if a port is not found, is ambiguous or is already cabled. Use netbox_trace_cable afterwards to check the path.

ParameterTypeDescription
a_terminations *arrayPorts on this end, usually one, e.g. [{'object_type': 'dcim.interface', 'device': 'sw01', 'name': 'eth1'}] or [{'object_type': 'dcim.frontport', 'object_id': 42}].
b_terminations *arrayPorts on this end, usually one, e.g. [{'object_type': 'dcim.interface', 'device': 'sw01', 'name': 'eth1'}] or [{'object_type': 'dcim.frontport', 'object_id': 42}].
cableCable attributes, e.g. {'type': 'cat6', 'status': 'connected', 'label': 'C-101', 'color': 'ff0000', 'length': 3, 'length_unit': 'm'}.