Expand description
§HTTP MCP Server Prelude
This module provides convenient re-exports of the most commonly used types from the HTTP MCP server library.
use turul_http_mcp_server::prelude::*;
Re-exports§
pub use crate::cors::CorsLayer;
pub use crate::server::HttpMcpServer;
pub use crate::server::HttpMcpServerBuilder;
pub use crate::server::ServerConfig;
pub use crate::server::ServerStats;
pub use crate::session_handler::SessionMcpHandler;
pub use crate::session_handler::SessionSseStream;
pub use crate::stream_manager::StreamConfig;
pub use crate::stream_manager::StreamError;
pub use crate::stream_manager::StreamManager;
pub use crate::stream_manager::StreamStats;
pub use crate::notification_bridge::BroadcastError;
pub use crate::notification_bridge::NotificationBroadcaster;
pub use crate::notification_bridge::StreamManagerNotificationBroadcaster;
pub use crate::protocol::McpProtocolVersion;
pub use crate::protocol::extract_last_event_id;
pub use crate::protocol::extract_protocol_version;
pub use crate::protocol::extract_session_id;
pub use crate::middleware::DispatcherResult;
pub use crate::middleware::McpMiddleware;
pub use crate::middleware::MiddlewareError;
pub use crate::middleware::MiddlewareStack;
pub use crate::middleware::RequestContext;
pub use crate::middleware::SessionInjection;
pub use crate::middleware::StorageBackedSessionView;
pub use crate::middleware::error_codes;
pub use crate::HttpMcpError;
pub use crate::Result;
Macros§
- json
- Construct a
serde_json::Value
from a JSON literal.
Structs§
- Annotations
- Generic annotations structure (matches TypeScript Annotations) Used across all MCP types that support client annotations
- Call
Tool Params - Parameters for tools/call request (matches TypeScript CallToolRequest.params)
- Call
Tool Request - Complete tools/call request (matches TypeScript CallToolRequest interface)
- Call
Tool Result - Result for tools/call (per MCP spec)
- Client
Capabilities - Capabilities that a client may support
- Complete
Params - Completion request parameters (per MCP spec)
- Complete
Result - Complete completion/complete response (per MCP spec)
- Create
Message Result - Result for sampling/createMessage (per MCP spec)
- Cursor
- Cursor for pagination support
- GetPrompt
Params - Parameters for prompts/get request (matches MCP GetPromptRequest.params exactly)
- HashMap
- A hash map implemented with quadratic probing and SIMD lookup.
- Implementation
- Describes the name and version of an MCP implementation
- Initialize
Request - Parameters for initialize request
- Json
RpcDispatcher - JSON-RPC 2.0 dispatcher and handler trait for protocol operations JSON-RPC method dispatcher with specific error type
- Json
RpcNotification - A JSON-RPC 2.0 notification (no response expected)
- Json
RpcRequest - A standard JSON-RPC 2.0 request
- Json
RpcResponse - A standard JSON-RPC 2.0 response
- List
Resources Params - Parameters for resources/list request
- List
Roots Params - Parameters for roots/list request (per MCP spec - no params required but can have _meta)
- Logging
Message Notification - Method: “notifications/message”
- Logging
Message Notification Params - Notification
- Base notification structure following MCP TypeScript specification
- Notification
Params - Base notification parameters that can include _meta
- Progress
Notification - Method: “notifications/progress”
- Progress
Notification Params - Prompt
- A prompt descriptor (matches TypeScript Prompt interface exactly)
- Prompt
Argument - Argument definition for prompts (extends BaseMetadata per MCP spec)
- Prompt
Message - Message content for prompts (matches MCP PromptMessage interface exactly)
- Read
Resource Params - Parameters for resources/read request
- Resource
- A resource descriptor (matches TypeScript Resource interface) Resource extends BaseMetadata, so it includes name and title fields
- Resource
Template - A template description for resources available on the server ResourceTemplate extends BaseMetadata
- Resource
Updated Notification - Method: “notifications/resources/updated”
- Resource
Updated Notification Params - Root
- Root directory entry (per MCP spec)
- Sampling
Message - Sampling message (per MCP spec)
- Tool
- Tool definition
- Tool
Schema - JSON Schema definition for tool input/output (matches TypeScript spec exactly) Must be an object with type: “object”, properties, and required fields
Enums§
- Completion
Reference - Union type for completion references (per MCP spec)
- Content
Block - Content block union type matching MCP 2025-06-18 specification exactly
- McpError
- MCP-specific errors
- McpVersion
- Supported MCP protocol versions
- Resource
Content - Union type for resource contents (matches TypeScript union)
- Value
- Represents any valid JSON value.
Traits§
- Json
RpcHandler - JSON-RPC 2.0 dispatcher and handler trait for protocol operations Trait for handling JSON-RPC method calls
Type Aliases§
- McpResult
- Common result type for MCP operations
- Tool
Result - Tool result type - an alias for ContentBlock to maintain backward compatibility while ensuring MCP 2025-06-18 specification compliance