[Bug] NetBox MCP tools fail JSON parsing despite valid API response #126
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Diagnostic Report
Generated: 2026-01-23T22:30:00Z
Command Tested:
/cmdb-assistant:cmdb-device(device listing)Reporter: Claude Code via /debug-report
Plugin: cmdb-assistant
Project Context
bandit-den/serv-bandit-appsgit@100.82.122.98:bandit-den/serv-bandit-apps.git/home/bandit/appsmainConfiguration
NetBox credentials at
~/.config/claude/netbox.env:Diagnostic Results
Test 1: MCP Tool - dcim_list_devices
Call:
mcp__plugin_cmdb-assistant_netbox__dcim_list_devices()Status: FAIL
Error:
Test 2: MCP Tool - dcim_list_sites
Call:
mcp__plugin_cmdb-assistant_netbox__dcim_list_sites()Status: FAIL
Error:
Test 3: Direct curl - Same endpoint
Call:
Status: PASS
Response: Valid JSON with 3 devices returned (HTTP 200)
Test 4: Direct curl - Sites endpoint
Call:
Status: PASS
Response: Valid JSON with 3 sites returned (HTTP 200)
Test 5: Direct curl - Services creation
Call: POST to
/api/ipam/services/Status: PASS (with field name adjustment)
Note: API requires
parent_object_type+parent_object_idinstead ofdevicefieldSummary
Failed Tools
dcim_list_devicesdcim_list_sitesError Category
Key Observations
Hypothesis
The MCP server's HTTP client or JSON parser is:
Additional Issue: Service API Schema
When creating services via curl, the API rejected
devicefield:Solution: Use
parent_object_type: "dcim.device"+parent_object_id: <id>instead.This suggests the MCP server may be using outdated NetBox API schema.
Suggested Investigation
mcp-servers/netbox/- HTTP client implementationhttpxorrequestsis used and how streaming is handledReproduction Steps
~/.config/claude/netbox.envwith valid NetBox credentials/cmdb-device listWorkaround
Use direct curl calls instead of MCP tools:
Generated by /debug-report - Labels: Type/Bug, Component/Backend
Root Cause Identified & Fix Proposed
Problem: The
/cmdb-assistant:initial-setupcommand was generatingNETBOX_API_URLwithout the/apisuffix.https://netbox.hotserv.cloudhttps://netbox.hotserv.cloud/apiThe validation test in the setup wizard incorrectly appended
/api/to the URL, making it pass even though the saved config was wrong. The actual MCP server then failed because it used the URL as-is.Fix: PR #132 updates the setup wizard to:
/apisuffix/apiif user forgetsImmediate Workaround: Edit
~/.config/claude/netbox.envand append/apitoNETBOX_API_URL.Investigated via /debug-review
Fix merged via PR #132. Closing issue.
Lesson learned captured: Setup Wizard URL Format Mismatch