-
Couldn't load subscription status.
- Fork 5
Description
Overview
Add support for tracking MCP elicitation events, which allow servers to request additional information from users through the client during interactions. MCPcat should capture when elicitation requests happen and how users respond to them.
Background
The MCP elicitation specification (spec) provides a standardized method for servers to dynamically gather necessary information from users. This includes:
- Simple text requests for basic string input
- Structured data requests with JSON schema validation
- Three response actions: accept (user submits data), decline (explicit rejection), and cancel (dismissal without choice)
Implementation Requirements
1. Event Type Support
Add new event types to track elicitation interactions:
MCP_ELICITATION_CREATE- When a server requests information from the userMCP_ELICITATION_RESPONSE- When the user responds with accept/decline/cancel
2. Request Interception
Extend the existing request handler system in modules/overrides/mcp_server.py to intercept:
elicitation/createrequests from servers- Response messages from clients
3. Event Tracking
Capture the following data for elicitation events:
- Request events: Message displayed to user, requested schema, validation rules
- Response events: User action (accept/decline/cancel), submitted data (if accepted)
4. Data Structure
Events should leverage existing UnredactedEvent fields:
event_type: New elicitation event typesparameters: Request schema and messageresponse: User's response action and datauser_intent: Could store the elicitation message for context
Technical Approach
- Add EventType enum values in
src/mcpcat/types.py:
MCP_ELICITATION_CREATE = "mcp:elicitation/create"
MCP_ELICITATION_RESPONSE = "mcp:elicitation/response"- Create wrapper handlers in
src/mcpcat/modules/overrides/mcp_server.py:
async def wrapped_elicitation_create_handler(request: ElicitationCreateRequest) -> ServerResult:
# Track the elicitation request
# Store schema, message, and context
# Forward to original handler
# Track the response- Handle forward compatibility: Since elicitation may not be in the current Python MCP SDK version, we should:
- Check for elicitation request types dynamically
- Create temporary type definitions if needed
- Gracefully handle missing elicitation support
Acceptance Criteria
- MCPcat tracks when servers request information via elicitation
- User responses (accept/decline/cancel) are captured with appropriate context
- Submitted data from accepted elicitations is recorded
- Implementation is forward-compatible with future MCP SDK updates
- Events are properly sent to MCPcat API or telemetry exporters
Notes
- The Python MCP SDK may not yet include elicitation support, so implementation should be designed to activate when the SDK adds these capabilities
- Consider privacy implications when tracking user-submitted data in elicitations
- Ensure redaction functions work properly with elicitation response data