MCP Utilities
Protocol utilities for connection health monitoring, progress tracking, and request cancellation
Protocol Utilities: Core MCP utilities for enhanced functionality
MCP provides several protocol utilities that enhance the core functionality with connection health monitoring, progress tracking, and request cancellation capabilities.
Available Utilities
Kambrium implements the following MCP protocol utilities:
- Ping: Connection health monitoring and keep-alive functionality
- Progress: Progress tracking for long-running operations
- Cancellation: Request cancellation mechanism for async operations
Ping Utility
The ping utility provides connection health monitoring and keep-alive functionality.
Method: ping
Send a ping to check server connectivity and response time.
Request:
Response:
Features
- Rate Limiting: Maximum 10 pings per minute per client
- Statistics: Response time tracking and connection statistics
- Keep-Alive: Maintains connection health for long-lived sessions
Usage Example
Progress Tracking
The progress utility enables tracking of long-running operations with real-time updates.
Progress Notifications
For operations that take time to complete, the server can send progress notifications.
Progress Notification:
Parameters
Parameter | Type | Description |
---|---|---|
progress_token | string | Unique identifier for the operation |
progress | number | Progress value between 0.0 and 1.0 |
message | string | Human-readable progress description |
Features
- Rate Limiting: Maximum 60 progress notifications per minute
- Auto-Completion: Automatic cleanup when operations complete
- Validation: Progress values validated between 0.0 and 1.0
Usage Example
Request Cancellation
The cancellation utility allows clients to cancel long-running requests.
Method: notifications/cancelled
Send a cancellation notification for a pending request.
Notification:
Parameters
Parameter | Type | Description |
---|---|---|
request_id | string | ID of the request to cancel |
Features
- Request Tracking: Tracks up to 1000 concurrent requests
- Race Condition Handling: Prevents race conditions between completion and cancellation
- Cleanup: Automatic cleanup of cancelled request data
Usage Example
Error Handling
Ping Errors
Progress Errors
Cancellation Errors
Configuration
Environment Variables
Usage Statistics
The utilities provide statistics for monitoring:
Best Practices
- Use ping sparingly - Implement exponential backoff for health checks
- Progress granularity - Send progress updates at reasonable intervals (not every item)
- Cancellation timeouts - Set reasonable timeouts for long-running operations
- Error handling - Always handle utility-specific error responses
- Resource cleanup - Utilities automatically clean up expired data
For more advanced protocol features, see the Error Handling documentation.