[Bug] NetBox MCP tools fail JSON parsing despite valid API response #127

Closed
opened 2026-01-23 22:29:09 +00:00 by lmiranda · 1 comment
Owner

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

Problem Summary

All NetBox MCP tools (mcp__plugin_cmdb-assistant_netbox__*) fail with JSON parsing errors, even though the NetBox API returns valid JSON responses.

Error Message:

Invalid JSON response from NetBox: Expecting value: line 8 column 1 (char 7). Status code: 200, Content length: 3511 bytes

Evidence

Test Method Result
dcim_list_devices MCP Tool FAIL - JSON parse error
dcim_list_sites MCP Tool FAIL - JSON parse error
/api/dcim/devices/ Direct curl PASS - Valid JSON
/api/dcim/sites/ Direct curl PASS - Valid JSON

Key Observations

  1. NetBox returns HTTP 200 with valid content
  2. Same error position ("line 8 column 1") on all failures
  3. Direct curl with same credentials works perfectly
  4. Content length shows data is being returned (3511 bytes)

Hypothesis

The MCP server HTTP client or JSON parser is likely:

  1. Reading HTTP headers as part of the response body
  2. Not handling chunked transfer encoding properly
  3. Having a streaming/buffer issue before parsing

Additional Issue

Service creation API requires parent_object_type + parent_object_id instead of device field, suggesting possible outdated API schema.

Suggested Investigation

  1. Check HTTP client response handling in mcp-servers/netbox/
  2. Verify chunked encoding handling
  3. Check if headers are being included in body
  4. Verify NetBox API version compatibility

Workaround

Use direct curl calls:

curl -s -H "Authorization: Token $TOKEN" "$URL/api/dcim/devices/"

Generated by /debug-report

## 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 ## Problem Summary All NetBox MCP tools (`mcp__plugin_cmdb-assistant_netbox__*`) fail with JSON parsing errors, even though the NetBox API returns valid JSON responses. **Error Message**: ``` Invalid JSON response from NetBox: Expecting value: line 8 column 1 (char 7). Status code: 200, Content length: 3511 bytes ``` ## Evidence | Test | Method | Result | |------|--------|--------| | dcim_list_devices | MCP Tool | FAIL - JSON parse error | | dcim_list_sites | MCP Tool | FAIL - JSON parse error | | /api/dcim/devices/ | Direct curl | PASS - Valid JSON | | /api/dcim/sites/ | Direct curl | PASS - Valid JSON | ## Key Observations 1. NetBox returns HTTP 200 with valid content 2. Same error position ("line 8 column 1") on all failures 3. Direct curl with same credentials works perfectly 4. Content length shows data is being returned (3511 bytes) ## Hypothesis The MCP server HTTP client or JSON parser is likely: 1. Reading HTTP headers as part of the response body 2. Not handling chunked transfer encoding properly 3. Having a streaming/buffer issue before parsing ## Additional Issue Service creation API requires `parent_object_type` + `parent_object_id` instead of `device` field, suggesting possible outdated API schema. ## Suggested Investigation 1. Check HTTP client response handling in `mcp-servers/netbox/` 2. Verify chunked encoding handling 3. Check if headers are being included in body 4. Verify NetBox API version compatibility ## Workaround Use direct curl calls: ```bash curl -s -H "Authorization: Token $TOKEN" "$URL/api/dcim/devices/" ``` --- *Generated by /debug-report*
lmiranda added the Component/BackendType/Bug labels 2026-01-23 22:29:09 +00:00
Author
Owner

Closing as duplicate of #126. See PR #132 for the fix.

Closing as duplicate of #126. See PR #132 for the fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#127