Expand description
§HTTP MCP Server
Production HTTP transport layer for Model Context Protocol (MCP) servers.
Provides both modern Streamable HTTP and legacy HTTP+SSE transports with automatic protocol detection, CORS support, and session management for maximum compatibility.
§Installation
[dependencies]
turul-http-mcp-server = "0.4"
turul-mcp-server = "0.4"§Supported Transports
- Streamable HTTP: Recommended for production deployments
- HTTP+SSE: Legacy transport for backwards compatibility
§Features
- Automatic protocol version detection and routing
- CORS support for browser-based clients
- Session management with cryptographically secure IDs
- Graceful error handling and JSON-RPC 2.0 compliance
§Quick Start
use turul_http_mcp_server::HttpMcpServerBuilder;
use std::net::SocketAddr;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr: SocketAddr = "127.0.0.1:8080".parse()?;
let server = HttpMcpServerBuilder::new()
.bind_address(addr)
.cors(true)
.build();
println!("Server running on http://127.0.0.1:8080/mcp");
server.run().await?;
Ok(())
}Re-exports§
pub use cors::CorsLayer;pub use notification_bridge::BroadcastError;pub use notification_bridge::NotificationBroadcaster;pub use notification_bridge::StreamManagerNotificationBroadcaster;pub use origin::OriginPolicy;pub use protocol::McpProtocolVersion;pub use protocol::extract_last_event_id;pub use protocol::extract_protocol_version;pub use protocol::extract_session_id;pub use routes::RouteBody;pub use routes::RouteHandler;pub use routes::RouteRegistry;pub use routes::RouteValidationError;pub use server::HttpMcpServer;pub use server::HttpMcpServerBuilder;pub use server::ServerConfig;pub use server::ServerStats;pub use session_handler::SessionMcpHandler;pub use session_handler::SessionSseStream;pub use stream_manager::StreamConfig;pub use stream_manager::StreamError;pub use stream_manager::StreamManager;pub use stream_manager::StreamStats;pub use streamable_http::StreamableHttpContext;pub use streamable_http::StreamableHttpHandler;
Modules§
- caching
- Core MCP protocol types and error handling Cache-control hints for results (SEP-2549).
- completion
- Core MCP protocol types and error handling MCP Completion Protocol Types
- content
- Core MCP protocol types and error handling Content block types for MCP 2026-07-28.
- cors
- CORS (Cross-Origin Resource Sharing) support
- discover
- Core MCP protocol types and error handling
server/discovertypes for MCP 2026-07-28. - elicitation
- Core MCP protocol types and error handling MCP Elicitation Protocol Types
- handler
- SSE stream body utilities for MCP protocol
- headers
- Core MCP protocol types and error handling HTTP header name constants for MCP Streamable HTTP transport (SEP-2243, changelog Minor #4).
- icons
- Core MCP protocol types and error handling MCP Icon Types
- initialize
- Core MCP protocol types and error handling Shared capability and implementation identity types for MCP 2026-07-28.
- input_
required - Core MCP protocol types and error handling Multi-round-trip input requests for MCP 2026-07-28 (SEP-2322).
- json_
rpc - Core MCP protocol types and error handling
MCP-specific
paramsandresultshapes that layer on top of generic JSON-RPC 2.0 wire envelopes fromturul-rpc. - json_
rpc_ responses - JSON-RPC 2.0 response builders for HTTP transport
- logging
- Core MCP protocol types and error handling MCP Logging Protocol Types
- mcp_
session - Streamable HTTP session management for MCP transport
- meta
- Core MCP protocol types and error handling
_metaField Support for MCP 2026-07-28. - middleware
- Middleware system for MCP servers
- notification_
bridge - Notification Bridge - Connects NotificationBroadcaster to StreamManager
- notifications
- Core MCP protocol types and error handling Notification payload types for MCP 2026-07-28.
- origin
- Origin-header validation (DNS-rebinding protection) for the MCP endpoint.
- param_
extraction - Core MCP protocol types and error handling Parameter extraction utilities for MCP protocol
- ping
- Core MCP protocol types and error handling
EmptyResultandEmptyParams— utility shapes for empty payloads. - prelude
- HTTP MCP Server Prelude
- prompts
- Core MCP protocol types and error handling MCP Prompts Protocol Types
- protocol
- MCP Protocol Version Detection and Features
- resources
- Core MCP protocol types and error handling MCP Resources Protocol Types
- result_
type - Core MCP protocol types and error handling Result discrimination for MCP 2026-07-28.
- roots
- Core MCP protocol types and error handling MCP Roots Protocol Types
- routes
- Route registry for custom HTTP paths (e.g.,
.well-knownendpoints) - sampling
- Core MCP protocol types and error handling MCP Sampling Protocol Types
- schema
- Core MCP protocol types and error handling JSON Schema Support for MCP
- server
- HTTP MCP Server with SessionStorage integration
- session_
handler - JSON-RPC 2.0 over HTTP handler for MCP requests with SessionStorage integration
- sse
- Server-Sent Events (SSE) support for MCP
- stream_
manager - Enhanced Stream Manager with MCP 2025-11-25 Resumability
- streamable_
http - Streamable HTTP Transport for MCP 2025-11-25
- subscriptions
- Core MCP protocol types and error handling Unified subscription stream for MCP 2026-07-28.
- tools
- Core MCP protocol types and error handling MCP Tools Protocol Types
- traits
- Core MCP protocol types and error handling Traits for JSON-RPC types as per MCP specification (2026-07-28).
- version
- Core MCP protocol types and error handling MCP Protocol Version Support
Macros§
- impl_
serde_ extractor - Core MCP protocol types and error handling Macro to implement SerdeParamExtractor for any Params type that implements Deserialize
Structs§
- Annotations
- Core MCP protocol types and error handling
Annotations for resources, prompts, and tools —
audience,priority,last_modified. Carried onResource,ResourceTemplate,Prompt,Tool(viaToolAnnotations), andContentBlock. - Blob
Resource Contents - Core MCP protocol types and error handling Binary resource contents (matches TypeScript BlobResourceContents exactly)
- Cacheable
Result - Core MCP protocol types and error handling
Cacheable-result mixin per schema. Embed via
#[serde(flatten)]: - Call
Tool Request - Core MCP protocol types and error handling Inner content of a tools/call request (method name and parameters).
- Call
Tool Result - Core MCP protocol types and error handling
Result for tools/call — extends
Result. - Cancelled
Notification - Core MCP protocol types and error handling Method: “notifications/cancelled”
- Client
Capabilities - Core MCP protocol types and error handling Capabilities that a client may support.
- Discover
Request - Core MCP protocol types and error handling
Client → server
server/discoverrequest. - Discover
Result - Core MCP protocol types and error handling
Server → client
server/discoverresult. - Discover
Result Response - Core MCP protocol types and error handling
Envelope
JSONRPCResultResponsespecialized to carry aDiscoverResult. - Elicit
Request - Core MCP protocol types and error handling
elicitation/createrequest. - Elicit
Request Form Params - Core MCP protocol types and error handling
Form-mode elicitation params. Per schema this interface does NOT extend
RequestParams— no_metafield. - Elicit
Result - Core MCP protocol types and error handling
The client’s response to an elicitation request:
{ action: "accept"|"decline"|"cancel", content?: {[k]: string|number|boolean|string[]} }. - Elicitation
Builder - Core MCP protocol types and error handling Builder for creating common elicitation patterns
- Elicitation
Schema - Core MCP protocol types and error handling Restricted schema for elicitation (only primitive types, no nesting) - per MCP spec
- Empty
Params - Core MCP protocol types and error handling
- Empty
Result - Core MCP protocol types and error handling
EmptyResult— theResultshape with no extra fields. - GetPrompt
Request - Core MCP protocol types and error handling Complete prompts/get request (matches TypeScript GetPromptRequest interface)
- GetPrompt
Result - Core MCP protocol types and error handling
Result for prompts/get — extends
Result. NoteGetPromptResultResponse.resultis aGetPromptResult | InputRequiredResultunion; callers needing the InputRequired variant should returncrate::input_required::InputRequiredResultdirectly. - Icon
- Core MCP protocol types and error handling Icon for tools, resources, prompts, and implementations. Icons are display hints — most implementations do not need icons. Defined on tool/resource/prompt/implementation interfaces in the 2026-07-28 schema.
- Implementation
- Core MCP protocol types and error handling Describes the name and version of an MCP implementation
- Input
Required Result - Core MCP protocol types and error handling
A
Resultdiscriminated as"input_required"— server signals that additional input must be gathered and the original request re-issued. - Input
Response Request Params - Core MCP protocol types and error handling
Mixin shape that may appear on the
paramsof any client-initiated request, allowing the client to attach prior input responses + echoed request state. - Json
RpcDispatcher - JSON-RPC 2.0 dispatcher and handler trait for protocol operations JSON-RPC method dispatcher with a typed domain-error type.
- Json
RpcError - Core MCP protocol types and error handling JSON-RPC Error response
- Json
RpcError Object - Core MCP protocol types and error handling JSON-RPC Error object
- Json
RpcNotification - Core MCP protocol types and error handling A JSON-RPC notification (request without an id)
- Json
RpcRequest - Core MCP protocol types and error handling A JSON-RPC request
- Json
RpcSuccess Response - Core MCP protocol types and error handling
A successful JSON-RPC response object (JSON-RPC 2.0 §5, success case):
{jsonrpc, id, result}. - List
Prompts Request - Core MCP protocol types and error handling
Complete prompts/list request —
ListPromptsRequest extends PaginatedRequest { method: "prompts/list" }. - List
Prompts Result - Core MCP protocol types and error handling Result for prompts/list (per MCP spec)
- List
Resources Request - Core MCP protocol types and error handling
Complete resources/list request —
ListResourcesRequest extends PaginatedRequest { method: "resources/list" }. - List
Resources Result - Core MCP protocol types and error handling
Result for resources/list — extends
PaginatedResultandCacheableResult. - List
Tools Request - Core MCP protocol types and error handling
Complete tools/list request —
ListToolsRequest extends PaginatedRequest { method: "tools/list" }. - List
Tools Result - Core MCP protocol types and error handling
Result for tools/list — extends
PaginatedResultandCacheableResult. - Logging
Message Notification Deprecated - Core MCP protocol types and error handling Method: “notifications/message”.
- Logging
Message Notification Params Deprecated - Core MCP protocol types and error handling
Deprecated per SEP-2577 — see
LoggingMessageNotification. - Meta
Cursor - Core MCP protocol types and error handling Cursor for pagination support
- Notification
- Core MCP protocol types and error handling Base notification structure following MCP TypeScript specification
- Notification
Params - Core MCP protocol types and error handling Base notification parameters that can include _meta
- Paginated
Request Params - Core MCP protocol types and error handling
paramsshape for any request that extendsPaginatedRequest—PaginatedRequestParams extends RequestParams { cursor?: Cursor }. - Progress
Notification - Core MCP protocol types and error handling Method: “notifications/progress”
- Progress
Notification Params - Core MCP protocol types and error handling
- Prompt
- Core MCP protocol types and error handling A prompt descriptor (matches TypeScript Prompt interface exactly)
- Prompt
Argument - Core MCP protocol types and error handling Argument definition for prompts (extends BaseMetadata per MCP spec)
- Prompt
List Changed Notification - Core MCP protocol types and error handling MCP notification payload for “notifications/prompts/list_changed”.
- Prompt
Message - Core MCP protocol types and error handling Message content for prompts (matches MCP PromptMessage interface exactly)
- Read
Resource Request - Core MCP protocol types and error handling Complete resources/read request (matches TypeScript ReadResourceRequest interface)
- Read
Resource Result - Core MCP protocol types and error handling
Result for
resources/read—ReadResourceResult extends CacheableResult. Caller may also returnInputRequiredResultvia theReadResourceResultResponse.resultunion. - Request
Meta Object - Core MCP protocol types and error handling
Strictly-typed request
_metacarrying the per-request capability negotiation. See alsoMetaObjectfor key naming rules and reserved prefixes, and General fields: _meta for the full spec section. - Request
Params - Core MCP protocol types and error handling
JSON-RPC
paramsobject for any request —_metais required per 2026-07-28 stateless core (carriesprotocolVersion,clientInfo,clientCapabilitiesfor per-request negotiation). - Resource
- Core MCP protocol types and error handling A resource descriptor (matches TypeScript Resource interface) Resource extends BaseMetadata, so it includes name and title fields
- Resource
List Changed Notification - Core MCP protocol types and error handling MCP notification payload for “notifications/resources/list_changed”.
- Resource
Reference - Core MCP protocol types and error handling Resource reference for resource links.
- Resource
Updated Notification - Core MCP protocol types and error handling Method: “notifications/resources/updated”
- Resource
Updated Notification Params - Core MCP protocol types and error handling
- Server
Capabilities - Core MCP protocol types and error handling Capabilities that a server may support.
- Subscription
Filter - Core MCP protocol types and error handling Opt-in filter for which notification types the client wants on this stream.
- Subscriptions
Acknowledged Notification - Core MCP protocol types and error handling
notifications/subscriptions/acknowledged— sent by the server as the first message on asubscriptions/listenstream. - Subscriptions
Acknowledged Notification Params - Core MCP protocol types and error handling Params for the acknowledgement notification.
- Subscriptions
Listen Request - Core MCP protocol types and error handling
subscriptions/listenrequest. - Subscriptions
Listen Request Params - Core MCP protocol types and error handling
Params for
subscriptions/listen—SubscriptionsListenRequestParams extends RequestParams, so_metais the typedcrate::meta::RequestMetaObjectcarrying the per-request capability negotiation (protocol version, client info, client capabilities). Required by schema. - Subscriptions
Listen Result - Core MCP protocol types and error handling
The response to a
subscriptions/listenrequest, signalling that the subscription ended gracefully (e.g. server shutdown). The listen stream is long-lived, so this result is sent only when the server tears the subscription down deliberately — an abrupt transport close carries no response. The result body is otherwise empty;_meta.subscriptionIdis the only substantive field. - Subscriptions
Listen Result Meta Object - Core MCP protocol types and error handling
_metaforSubscriptionsListenResult. Schema:SubscriptionsListenResultMetaObject extends ResultMetaObjectwith a REQUIREDio.modelcontextprotocol/subscriptionId: RequestId— the id of thesubscriptions/listenrequest this result closes (equals the result’s ownidin the JSON-RPC envelope). Extendingcrate::meta::ResultMetaObjectmeans it also carries the optionalio.modelcontextprotocol/serverInfo. - Subscriptions
Listen Result Response - Core MCP protocol types and error handling
JSON-RPC envelope carrying a
SubscriptionsListenResult, sent when the server tears the subscription down gracefully. - Text
Resource Contents - Core MCP protocol types and error handling Text resource contents (matches TypeScript TextResourceContents exactly)
- Tool
- Core MCP protocol types and error handling Tool definition
- Tool
List Changed Notification - Core MCP protocol types and error handling MCP notification payload for “notifications/tools/list_changed”.
- Tool
Output Schema - Core MCP protocol types and error handling
JSON Schema for
Tool.outputSchemaper 2026-07-28: - Tool
Schema - Core MCP protocol types and error handling
JSON Schema for
Tool.inputSchemaper 2026-07-28:
Enums§
- Cache
Scope - Core MCP protocol types and error handling
Cache-sharing scope, analogous to HTTP
Cache-Control: public/private. - Content
Block - Core MCP protocol types and error handling
Content block union —
text | image | audio | resource_link | resource | tool_use | tool_result. - Elicit
Action - Core MCP protocol types and error handling User action in response to elicitation
- Http
McpError - HTTP MCP specific errors
- Icon
Theme - Core MCP protocol types and error handling Theme preference for an icon (light or dark mode). Defined on tool/resource/prompt/implementation interfaces in the 2026-07-28 schema.
- Input
Request - Core MCP protocol types and error handling
Server → client request emitted as part of an
InputRequiredResult. - Input
Response - Core MCP protocol types and error handling
Client → server response for an
InputRequest, keyed by the server-assigned identifier from the correspondingInputRequestsentry. - Json
RpcError Code - Core MCP protocol types and error handling JSON-RPC error codes
- Json
RpcMessage - Core MCP protocol types and error handling
Enum representing the inbound JSON-RPC messages a server parses:
a request or a notification. Responses are produced, not parsed here,
and live in
turul_rpc_core::response::JsonRpcResponse. - Json
RpcParams - Core MCP protocol types and error handling Parameters for a JSON-RPC request
- Json
RpcResponse - Core MCP protocol types and error handling A JSON-RPC Response object (JSON-RPC 2.0 §5): success XOR error.
- Json
RpcVersion - Core MCP protocol types and error handling JSON-RPC version
- Json
RpcWire Message - Core MCP protocol types and error handling Any single JSON-RPC 2.0 message read off the wire, in either direction.
- Json
Schema - Core MCP protocol types and error handling A JSON Schema definition
- McpError
- Core MCP protocol types and error handling MCP-specific errors
- McpVersion
- Core MCP protocol types and error handling Supported MCP protocol versions
- Primitive
Schema Definition - Core MCP protocol types and error handling Restricted schema definitions that only allow primitive types without nested objects or arrays (per MCP spec).
- Progress
Token - Core MCP protocol types and error handling Progress token for tracking long-running operations.
- Progress
Token Value - Core MCP protocol types and error handling Progress token for tracking long-running operations.
- Request
Id - Core MCP protocol types and error handling A uniquely identifying ID for a JSON-RPC request: a String, a Number, or Null.
- Resource
Content - Core MCP protocol types and error handling Union type for resource contents (matches TypeScript union)
- Resource
Contents - Core MCP protocol types and error handling Resource contents union type (matches TypeScript TextResourceContents | BlobResourceContents)
- Response
Result - Core MCP protocol types and error handling Result data for a JSON-RPC response
- Result
Type - Core MCP protocol types and error handling
Discriminator for
Result-shaped responses. - String
Format - Core MCP protocol types and error handling String format constraints
Constants§
- CURRENT_
VERSION - Core MCP protocol types and error handling The current MCP protocol version implemented by this crate
- ERROR_
CODE_ HEADER_ MISMATCH - Core MCP protocol types and error handling
JSON-RPC error code for header-validation failures. Matches the schema’s
HEADER_MISMATCHconst andHeaderMismatchErrorinterface. Returned with HTTP400 Bad Requestwhen a required standard header is missing/malformed or a header value does not match the corresponding request-body value. - HTTP_
HEADER_ METHOD - Core MCP protocol types and error handling
Mcp-Method— REQUIRED per SEP-2243 on all requests and notifications. Carries the JSON-RPCmethodstring at the HTTP layer to enable intelligent routing without body inspection. Servers MUST reject requests where this header and the body’smethoddisagree. - HTTP_
HEADER_ NAME - Core MCP protocol types and error handling
Mcp-Name— REQUIRED per SEP-2243 fortools/call(params.name),resources/read(params.uri), andprompts/get(params.name). Servers MUST reject requests where this header and the body’s value disagree. - HTTP_
HEADER_ PARAM_ PREFIX - Core MCP protocol types and error handling
Mcp-Param-{name}— header name prefix for custom headers mirrored from tool parameters (SEP-2243 §Custom Headers from Tool Parameters). - HTTP_
HEADER_ PROTOCOL_ VERSION - Core MCP protocol types and error handling
MCP-Protocol-Version— REQUIRED on every Streamable HTTP POST. Must match_meta.io.modelcontextprotocol/protocolVersionin the request body (servers MUST return400 Bad Requeston mismatch per theRequestMetaObjectschema). - JSONRPC_
VERSION - Core MCP protocol types and error handling
JSON-RPC version constant. Mirrors
turul_rpc::JSONRPC_VERSIONfor the few sites that still need a&strliteral rather than the typed enum. - MCP_
PARAM_ BASE64_ PREFIX - Core MCP protocol types and error handling
Sentinel prefix marking a Base64-encoded
Mcp-Param-*value (=?base64?{Base64EncodedValue}?=, case-sensitive, lowercase). - MCP_
PARAM_ BASE64_ SUFFIX - Core MCP protocol types and error handling
Sentinel suffix closing a Base64-encoded
Mcp-Param-*value. - MCP_
VERSION - Core MCP protocol types and error handling
The MCP protocol version string this crate currently targets, exactly as it appears
on the wire in
LATEST_PROTOCOL_VERSIONof the upstreamschema.ts. - META_
KEY_ BAGGAGE - Core MCP protocol types and error handling
_metakey carrying the W3C Trace Contextbaggageheader value per SEP-414. Conventional, not schema-declared. - META_
KEY_ CLIENT_ CAPABILITIES - Core MCP protocol types and error handling
Schema-declared
_metakey for the request client capabilities. - META_
KEY_ CLIENT_ INFO - Core MCP protocol types and error handling
Schema-declared
_metakey for the request client info. - META_
KEY_ LOG_ LEVEL Deprecated - Core MCP protocol types and error handling
Schema-declared
_metakey for the per-request log level opt-in. Declared as the named fieldio.modelcontextprotocol/logLevelonRequestMetaObject. The constant is provided for use when callers index into a genericMetaObjectand want the spelling pinned. - META_
KEY_ PROTOCOL_ VERSION - Core MCP protocol types and error handling
Schema-declared
_metakey for the request protocol version. - META_
KEY_ SUBSCRIPTION_ ID - Core MCP protocol types and error handling
_metakey carrying the subscription id used by the server to tag notifications delivered on asubscriptions/listenstream. Schema-declared:NotificationMetaObject.io.modelcontextprotocol/subscriptionId(optional; value = theRequestIdof thesubscriptions/listenrequest that opened the stream) andSubscriptionsListenResultMetaObject.io.modelcontextprotocol/subscriptionId(required, on the result that closes the stream). - META_
KEY_ TRACEPARENT - Core MCP protocol types and error handling
_metakey carrying the W3C Trace Contexttraceparentheader value per SEP-414. Conventional, not schema-declared. - META_
KEY_ TRACESTATE - Core MCP protocol types and error handling
_metakey carrying the W3C Trace Contexttracestateheader value per SEP-414. Conventional, not schema-declared. - SERVER_
DISCOVER_ METHOD - Core MCP protocol types and error handling Wire method string for the discover RPC.
- SUBSCRIPTIONS_
ACKNOWLEDGED_ METHOD - Core MCP protocol types and error handling Wire method string for the acknowledgement notification.
- SUBSCRIPTIONS_
LISTEN_ METHOD - Core MCP protocol types and error handling Wire method string for the subscription RPC.
- X_
MCP_ HEADER_ SCHEMA_ KEY - Core MCP protocol types and error handling
x-mcp-header— the JSON Schema extension property (inside a tool’sinputSchema) that designates a parameter for header mirroring. This is a schema annotation key, NOT a wire header name — the wire header it produces isHTTP_HEADER_PARAM_PREFIX{name}.
Traits§
- HasData
- Core MCP protocol types and error handling
Escape hatch — flatten a typed result into a JSON-object map. Not part of
the
RpcResultsupertrait bound; consumers that need this should preferserde_json::to_value. Retained for the rare framework site that needs an untyped view. - HasData
Param - Core MCP protocol types and error handling
- HasError
Object - Core MCP protocol types and error handling
Exposes the
errorfield on aJSONRPCErrorResponse. The schema’sErrorinterface maps toturul_rpc::error::JsonRpcErrorObject({ code, message, data? }). - HasMeta
- Core MCP protocol types and error handling
Exposes
Result._meta?: ResultMetaObject— the result-side carrier, which addsio.modelcontextprotocol/serverInfoon top ofMetaObject. Borrowed, typed — no JSON round-trip. - HasMeta
Param - Core MCP protocol types and error handling
- HasNotification
Meta - Core MCP protocol types and error handling
Exposes
Notification.params._meta?. Separate fromHasMetabecause the schema gives the two sides different carriers: results extendMetaObjectwithserverInfo, notifications withsubscriptionId. One trait returning one type cannot model both. - HasOptional
Request Id - Core MCP protocol types and error handling
Optional request id — used by
JSONRPCErrorResponsewhere the server may omitidif it couldn’t parse the original request’s id. - HasProgress
Token Param - Core MCP protocol types and error handling
- HasRequest
Id - Core MCP protocol types and error handling
Required request id — present on requests and successful responses.
Schema:
RequestId = string | number; we expose as borrowedValuefor permissive accept (the typed narrowing is a separate follow-up). - HasResult
Type - Core MCP protocol types and error handling
Exposes the
resultTypediscriminator per the schema’sResult.resultType: ResultTypefield. Every spec-compliant result MUST carry this; per the schema doc-comment, absent values default toCompletefor backward compatibility with pre-2026-07-28 servers. - Json
RpcError Response Trait - Core MCP protocol types and error handling
JSONRPCErrorResponseper schema — error response with optionalid. - Json
RpcHandler - JSON-RPC 2.0 dispatcher and handler trait for protocol operations Trait for handling JSON-RPC method calls.
- Json
RpcNotification Trait - Core MCP protocol types and error handling
- Json
RpcRequest Trait - Core MCP protocol types and error handling
- Json
RpcResult Response Trait - Core MCP protocol types and error handling
JSONRPCResultResponseper schema — successful response carryingresult. - Params
- Core MCP protocol types and error handling
- RpcResult
- Core MCP protocol types and error handling
Schema’s
Resultinterface:{ _meta?: ResultMetaObject, resultType: ResultType, [key: string]: unknown }. Bound toHasMeta+HasResultType— arbitrary[key: string]: unknownextra keys are domain-specific and expressed on the concrete struct itself. - Tool
Change Notifier - Awaitable notifier for tool change events (restart/redeploy fingerprint mismatch).
Implemented by the server layer (backed by SessionManager → dispatcher).
Used by HTTP handlers to persist
notifications/tools/list_changedthrough the session architecture, not directly via StreamManager.
Functions§
- parse_
json_ rpc_ wire_ message - Core MCP protocol types and error handling
Parse a JSON string into a
JsonRpcWireMessage.
Type Aliases§
- Input
Requests - Core MCP protocol types and error handling Map of server-assigned identifiers → server-initiated requests.
- Input
Responses - Core MCP protocol types and error handling
Map of identifiers → client responses, keyed identically to the originating
InputRequests. - McpResult
- Core MCP protocol types and error handling Common result type for MCP operations
- Meta
Object - Core MCP protocol types and error handling
Loose
_metacarrier —Record<string, unknown>in the schema. - Result
- Result type for HTTP MCP operations
- Tool
Result - Core MCP protocol types and error handling
Alias for
crate::content::ContentBlockkept for callers that reference the type by its older name.