Skip to content

API Reference

This reference documents the public Python API, CLI subcommands, and contributor workflow for litestar-mcp. Every class, protocol, struct, decorator, and function listed in these chapters is rendered directly from static AST and PEP 257 attribute docstrings.

Package Boundaries & Import Surface

litestar-mcp is organized into focused subpackages so optional integrations (litestar-queues, a2a-sdk, google-genai, opentelemetry-api, dishka, litestar-security) are never imported unless configured by your application.

Package Namespace Optional Extra Responsibilities & Primary Exports
litestar_mcp Base package Top-level convenience re-exports (LitestarMCP, MCP, SUPPORTED_PROTOCOL_VERSIONS, MCPConfig, MCPOptKeys, MCPTaskConfig, MCPSkillsConfig, MCPController, PromptController, SkillController, @mcp_tool, @mcp_resource, @mcp_prompt, @tool, @prompt, Skill, SkillFile, SkillSource, FilesystemSkillSource, SkillCatalog, SkillIntegrityError, PromptMessage, MCPToolResult, MCPResourceLink, MCPBlobResource, MCPInputRequiredResult, MCPRequestContext, get_mcp_request_context, MCPStdioContext) and lazy resolution for LitestarA2A, A2AConfig, and litestar_mcp.agent.
litestar_mcp.core Base package (opentelemetry optional) Protocol-agnostic primitives: Tool, ToolCall, ToolResult, ToolArgumentError, @tool, ToolContext, JSON-RPC 2.0 models (JSONRPCRequest, JSONRPCError, JSONRPCErrorException), SSE SubscriptionManager and RFC 5424 logging helpers (MCPLogLevel, MCP_LOG_LEVELS, validate_log_level, log_level_allows), structured output schema synthesis (type_to_output_schema, unwrap_root_object_schema, generate_output_schema_for_handler, typed_dict_to_json_schema), OpenTelemetry TelemetryConfig and SpanManager, JSON serialization helpers (encode_json, decode_json, to_json, from_json), and core exceptions (LitestarMCPError, MissingDependencyError, BridgeConnectionError, BridgeMessageTooLargeError).
litestar_mcp.mcp Base package MCP server runtime, route discovery, Registry, MCPHandlerService, MCPSession and MCPSessionStore, SEP-1865 UI constants (UI_EXTENSION, UI_MIME_TYPE), internal ASGI execution (execute_tool, execute_handler_response, blank_http_scope), MCPTaskStore and MCPTaskRuntime, Agent Skills (SkillCatalog, SkillIntegrityError), stdio transport (ASGIStreamingTransport, run_stdio, run_stdio_async), Streamable HTTP bridge (run_bridge, run_stdio_streamable_http_bridge), MCPStreamableHTTPClient, and CLI group (litestar mcp stdio, bridge, export-tool-spec, list-tools, list-resources, list-skills, run).
litestar_mcp.queues litestar-mcp[queues] Distributed execution on litestar-queues: QueueTaskExecutor, run_mcp_tool_task, DurableWorkflowEngine, WorkflowStore, WorkflowRun, NodeRecord, TaskDependencyChain, QueuedAgentChatController, QueuedTurnManager, QueuedTurn, AgentRegistry, PrincipalSnapshot, and run_agent_turn.
litestar_mcp.agent Base package (google-genai / a2a optional) Multi-agent orchestration and in-process workflows: Agent, AgentGroup, AgentMessage, AgentRuntime, TurnRequest, TurnResponse, TurnBudget, BudgetExceededError, AgentChatController, SessionStore (ANONYMOUS_OWNER, MemorySessionStore, LitestarStoreSessionStore), ModelClient (GoogleGenAIClient, MockModelClient), AgentStreamFrame, DynamicWorkflow, WorkflowNode, WorkflowEngine, and litestar_mcp.agent.bridges.
litestar_mcp.a2a litestar-mcp[a2a] Agent-to-Agent (A2A 1.0) protocol plugin (LitestarA2A, A2AConfig) mounting JSON-RPC 2.0 (POST /a2a), optional HTTP+JSON REST routes, and /.well-known/agent-card.json discovery around a2a-sdk.
litestar_mcp.utils Base package Route and function decorators (mcp_tool, mcp_resource, mcp_prompt), schema description bounds validation (validate_tool_descriptions), and handler signature introspection helpers.

Reference Chapters

Plugin & Configuration

LitestarMCP plugin lifecycle, standalone MCP wrapper, MCPConfig (auto_output_schema, filter_app_only_tools, ui_mime_types, enable_get_sse, session_ttl_seconds, logging, default_log_level, subscription_authorizer), MCPOptKeys descriptor and schema keys, MCPTaskConfig, MCPSkillsConfig (expose_as_prompts, list_changed), tool-call hooks, MCPController, MCPSession, and MCPSessionStore.

Plugin & Config API →

Primitives, Controllers & Skills

@mcp_tool (output_schema), @mcp_resource, @mcp_prompt, SEP-1865 title / icons / _meta (meta), PromptController, SkillController, Agent Skills (SkillSource, FilesystemSkillSource, top-level SkillCatalog), get_mcp_request_context(default=...), MCPRequestContext.log() / ui_capabilities / session_id, content blocks, and Registry.

Primitives & Skills API →

Tasks, Queues & Durable Workflows

MCPTaskExecutor, MCPTaskRuntime, MCPTaskStore, TaskRecord, ToolTaskCall (progress_token, session_id, log_level), QueueTaskExecutor, DurableWorkflowEngine, WorkflowStore, TaskDependencyChain, QueuedAgentChatController, and QueuedTurnManager.

Tasks & Queues API →

Agents, Sessions & Workflows

Agent, AgentGroup, AgentRuntime, TurnBudget, AgentChatController, SessionStore backends, GoogleGenAIClient, AgentStreamFrame, DynamicWorkflow, and WorkflowEngine.

Agents & Workflows API →

A2A 1.0, Bridges & Transports

LitestarA2A, A2AConfig, bidirectional MCP and A2A bridges (agent_to_mcp, mcp_to_tools(..., include_app_only=...), discover_mcp_tools, agent_to_a2a), MCPStdioContext, HTTP bridge runners, and MCPStreamableHTTPClient (2025-11-25 sessions, logging, subscriptions, list_skills, get_skill, read_skill_directory).

A2A & Bridges API →

Core Primitives & Observability

Core Tool and @tool, ToolContext, TelemetryConfig, SpanManager, RFC 5424 logging helpers (MCPLogLevel, validate_log_level, log_level_allows), scoped SubscriptionManager streams, output schema synthesis, JSON-RPC 2.0 structures, exception hierarchy, and internal ASGI executors.

Core & Observability API →

CLI Reference

Auto-generated reference and practical recipes for litestar mcp stdio, litestar mcp bridge, litestar mcp export-tool-spec, list-tools, list-resources, list-skills, and run.

CLI Reference →

Contributing Guide

Local workspace setup, running unit and protocol conformance suites, type-checking and linting gates, and the documentation verification pipeline.

Contributing Guide →

Release History

See the Changelog for release notes, new capabilities, and migration notes across versions v0.1.0 through v0.20.0.