fix(cmdb-assistant): correct NetBox API URL format in setup wizard

The /initial-setup command was generating NETBOX_API_URL without the
/api suffix, causing all MCP tools to fail with JSON parsing errors.

Changes:
- Update example URL to include /api suffix
- Add instruction to auto-append /api if user forgets
- Fix validation test to be consistent with actual usage

Root cause: Setup asked for base URL (https://netbox.company.com) but
NetBoxClient expects API URL (https://netbox.company.com/api). The
validation test incorrectly added /api/ making it pass, while the
actual MCP server failed.

Fixes #126

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 17:52:23 -05:00
parent 50bfd20fd4
commit dafa8db8bb

View File

@@ -70,13 +70,15 @@ cat ~/.config/claude/netbox.env 2>/dev/null || echo "FILE_NOT_FOUND"
### Step 3.3: Gather NetBox Information ### Step 3.3: Gather NetBox Information
Use AskUserQuestion: Use AskUserQuestion:
- Question: "What is your NetBox server URL? (e.g., https://netbox.company.com)" - Question: "What is your NetBox API URL? (e.g., https://netbox.company.com/api)"
- Header: "NetBox URL" - Header: "NetBox URL"
- Options: - Options:
- "Other (I'll provide the URL)" - "Other (I'll provide the URL)"
Ask user to provide the URL. Ask user to provide the URL.
**Important:** The URL must include `/api` at the end. If the user provides a URL without `/api`, append it automatically.
### Step 3.4: Create Configuration File ### Step 3.4: Create Configuration File
```bash ```bash
@@ -120,9 +122,11 @@ Use AskUserQuestion:
### Step 4.1: Test Configuration (if token was added) ### Step 4.1: Test Configuration (if token was added)
```bash ```bash
source ~/.config/claude/netbox.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Token $NETBOX_API_TOKEN" "$NETBOX_API_URL/api/" source ~/.config/claude/netbox.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Token $NETBOX_API_TOKEN" "$NETBOX_API_URL/"
``` ```
**Note:** The URL already includes `/api`, so we just append `/` for the root API endpoint.
Report result: Report result:
- 200: Success - 200: Success
- 403: Invalid token - 403: Invalid token