Skip to main content

Module mcp

Module mcp 

Source
Expand description

MCP message taxonomy (spec v2025-11-25).

See PIPELINE.md §Types. Method identity is a cheap enum — one string match per message. Grouping by feature area (Tools, Resources, …) matches the spec table and lets middlewares pattern-match at the granularity they need.

Every method enum has an Unknown(String) tail variant so non-spec methods forward unchanged instead of failing classification.

Structs§

McpMessage
Shallow envelope paired with its classification. Used inside McpRequest (client direction) and Response::McpBuffered (server direction).

Enums§

ClientKind
Kind of message the client is sending. Computed at intake from method + id + result/error presence.
ClientMethod
ClientNotifMethod
CompletionMethod
LifecycleMethod
LoggingMethod
MessageKind
Direction discriminator for an McpMessage.
PromptsMethod
ResourcesMethod
ServerKind
Kind of message the server is sending. Appears in response bodies (streamable-HTTP chunks or legacy SSE frames).
ServerMethod
ServerNotifMethod
TasksMethod
Task lifecycle methods. Used by both directions (client asks the server about tasks; server can also request task state from the client).
ToolsMethod

Functions§

classify_client
Classify a client→server envelope. Assumes the envelope came from JsonRpcEnvelope::parse, which already rejected malformed shapes.
classify_server
Classify a server→client envelope.