Skip to content

Conversation

@EmmaLouise2018
Copy link
Contributor

Summary

Adds comprehensive wire-level logging for both MCP and A2A protocol requests. This allows debugging of exact HTTP requests/responses being sent over the network.

Changes

  • Added protocolLogging configuration to ADCPClientConfig
  • Implemented detailed logging in both MCP and A2A protocol handlers
  • Added custom fetch wrappers to intercept and log requests/responses
  • Includes request/response headers, bodies, latency tracking
  • Authentication headers are redacted by default for security
  • Created comprehensive documentation and examples

Configuration Options

const client = new ADCPClient(agent, {
  protocolLogging: {
    enabled: true,
    logRequests: true,
    logResponses: true,
    logRequestBodies: true,
    logResponseBodies: true,
    maxBodySize: 50000,
    redactAuthHeaders: true
  }
});

Documentation

  • Added docs/PROTOCOL-LOGGING.md with comprehensive guide
  • Added examples/protocol-logging.ts with 9 usage examples
  • Added test-protocol-logging.ts for testing

Testing

  • Tested with both MCP and A2A protocols
  • Verified logging output format and redaction
  • Confirmed minimal performance overhead (~1-5ms per request)

Fixes request for detailed wire-level protocol logging.

@bokelley
Copy link
Contributor

bokelley commented Dec 2, 2025

why did this reformat every single file? it's ok but hard to see what changed. did you update the testing UI to use this for debug?

@EmmaLouise2018 EmmaLouise2018 force-pushed the add-detailed-logging-main branch from fd514bd to de0f954 Compare December 9, 2025 20:23
Add configurable wire-level logging to capture exact HTTP
requests and responses for both MCP and A2A protocols.

Features:
- Log exact request/response payloads, headers, and timing
- Configurable granularity (requests, responses, bodies)
- Auth header redaction for security (enabled by default)
- Body size limits to prevent log spam
- Latency tracking for performance monitoring

Configuration example:
  protocolLogging: {
    enabled: true,
    logRequests: true,
    logResponses: true,
    logRequestBodies: true,
    logResponseBodies: true,
    maxBodySize: 50000,
    redactAuthHeaders: true
  }

Use cases: debugging, monitoring, troubleshooting

Files: ADCPClient.ts, TaskExecutor.ts, mcp.ts, a2a.ts,
protocols/index.ts

Performance impact: ~3-7ms per request with full logging
- Add protocol logging checkbox to testing UI
- Add /api/sales/agents/:agentId/query endpoint with protocol logging support
- Export ProtocolLoggingConfig type from library
- Wire-level HTTP logs now display in debug panel when enabled
@EmmaLouise2018 EmmaLouise2018 force-pushed the add-detailed-logging-main branch from cd9f60e to 134852e Compare December 16, 2025 17:05
@EmmaLouise2018
Copy link
Contributor Author

Addressed feedback:

  1. Formatting issue: Fixed - removed the mass reformatting. Now only the protocol logging changes are in the PR (~1400 lines of actual feature code). Added docs/api/** and dist/** to .prettierignore to prevent this in the future.

  2. Testing UI integration: ✅ Done! Added in commit 134852e:

    • Added "🔍 Protocol Logging" checkbox to testing UI (next to agent selector)
    • When enabled, wire-level HTTP requests/responses now display in the debug panel
    • Shows: method, URL, headers (auth redacted), request/response bodies, latency
    • Created /api/sales/agents/:agentId/query endpoint that accepts protocol logging config
    • Frontend JavaScript passes logging config from checkbox to API

How to test:

  1. Check the "🔍 Protocol Logging" checkbox in the UI
  2. Execute any agent operation (get_products, etc.)
  3. Debug panel will show detailed HTTP request/response logs with full bodies and headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants