Feature: 021-request-id-logging Date: 2026-01-07
This feature adds request-scoped logging with X-Request-Id header support. Every API request gets a unique ID that appears in error responses and server logs, enabling easy debugging and log correlation.
When a CLI command fails, the Request ID is displayed with a suggestion:
$ mcpproxy upstream list
Error: Failed to connect to daemon
Request ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Run 'mcpproxy logs --request-id a1b2c3d4-e5f6-7890-abcd-ef1234567890' to see detailed logs# Get all logs for a specific request
$ mcpproxy logs --request-id a1b2c3d4-e5f6-7890-abcd-ef1234567890
2026-01-07T10:30:00Z INFO handling server list request request_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890
2026-01-07T10:30:01Z ERROR server connection failed request_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890
# Limit output
$ mcpproxy logs --request-id a1b2c3d4 --tail 10Request ID is NOT displayed on success (to reduce noise):
$ mcpproxy upstream list
NAME STATUS TOOLS
google-drive ready 15
github-server ready 23Clients MAY provide their own request ID:
curl -H "X-Request-Id: my-trace-123" \
-H "X-API-Key: your-api-key" \
http://127.0.0.1:8080/api/v1/serversEvery response includes X-Request-Id:
$ curl -i http://127.0.0.1:8080/api/v1/servers -H "X-API-Key: ..."
HTTP/1.1 200 OK
X-Request-Id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Content-Type: application/json
[{"name":"google-drive","status":"ready",...}]All errors include request_id in JSON:
$ curl http://127.0.0.1:8080/api/v1/servers/nonexistent -H "X-API-Key: ..."
HTTP/1.1 404 Not Found
X-Request-Id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Content-Type: application/json
{
"error": "server_not_found",
"message": "Server 'nonexistent' not found",
"request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"suggestion": "Check server name. Available: google-drive, github-server"
}# Filter by request ID
curl "http://127.0.0.1:8080/api/v1/logs?request_id=a1b2c3d4" \
-H "X-API-Key: your-api-key"
# Combined filters
curl "http://127.0.0.1:8080/api/v1/logs?request_id=a1b2c3d4&level=error&limit=50" \
-H "X-API-Key: your-api-key"All clients receive the same response format:
| Client | On Error | User Action |
|---|---|---|
| CLI | Prints Request ID + log suggestion | Copy ID, run mcpproxy logs --request-id <id> |
| Tray | Notification shows Request ID | Click "Copy ID" button |
| Web UI | Error modal shows Request ID | Click "Copy" or "View Logs" |
OAuth responses include both IDs:
{
"success": true,
"server_name": "google-drive",
"request_id": "req-abc123",
"correlation_id": "oauth-def456",
"browser_opened": true
}Lookup behavior:
--request-id req-abc123: Find logs for the login HTTP request--correlation-id oauth-def456: Find logs for entire OAuth flow (including callbacks)
UUID v4 format: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Must match pattern: ^[a-zA-Z0-9_-]{1,256}$
Valid examples:
my-trace-123request_2026-01-07_001user-session-abc
Invalid (rejected):
my trace(spaces not allowed)<script>(special chars not allowed)- String longer than 256 characters
$ mcpproxy auth login --server=google-drvie
Error: Server 'google-drvie' not found
Request ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Run 'mcpproxy logs --request-id a1b2c3d4-e5f6-7890-abcd-ef1234567890' to see detailed logs$ mcpproxy logs --request-id a1b2c3d4-e5f6-7890-abcd-ef1234567890
2026-01-07T10:30:00Z INFO received login request request_id=a1b2c3d4 server=google-drvie
2026-01-07T10:30:00Z DEBUG looking up server request_id=a1b2c3d4 server=google-drvie
2026-01-07T10:30:01Z WARN server not found request_id=a1b2c3d4 server=google-drvie available=[google-drive,github-server]
2026-01-07T10:30:01Z ERROR validation failed request_id=a1b2c3d4 error=server_not_foundInclude Request ID in bug reports or support requests:
**Issue**: Login failed with "Server not found"
**Request ID**: a1b2c3d4-e5f6-7890-abcd-ef1234567890
**Command**: mcpproxy auth login --server=google-drvie
Request IDs are safe to share:
- Generated IDs are random UUIDs (no embedded information)
- Client IDs are validated (alphanumeric only)
- IDs do not contain secrets, tokens, or PII
- IDs are not used for authentication
Your client-provided ID contains invalid characters. Use only:
- Letters (a-z, A-Z)
- Numbers (0-9)
- Dashes (-)
- Underscores (_)
Possible causes:
- Request ID was from a different daemon instance (daemon restarted)
- Logs were rotated/cleaned
- Typo in request ID
Check that:
- You're calling the REST API (not MCP protocol)
- Response is JSON (not SSE or plain text)
- Daemon version supports request ID (this feature)