Skip to content

Getting Started with Litestar MCP

litestar-mcp provides three composable entry points depending on whether you are augmenting an existing Litestar API, authoring a standalone MCP server, or orchestrating multi-agent workflows and A2A 1.0 services.


Entry-Point Decision Matrix

Entry Point Primary Class Best For Key Capabilities
Litestar Plugin LitestarMCP(MCPConfig(...)) Existing Litestar applications and REST APIs Exposes marked routes (mcp_tool, mcp_resource, mcp_prompt), opt-in outputSchema and automatic structuredContent, SEP-1865 MCP Apps (io.modelcontextprotocol/ui), PromptController, SkillController, and SkillCatalog (MCPSkillsConfig) over dual-mode /mcp (2026-07-28 and 2025-11-25 with Mcp-Session-Id and GET /mcp SSE) and litestar mcp stdio while sharing middleware, guards, and DI
Standalone Wrapper MCP("server-name") Dedicated MCP servers and local stdio utilities Declarative @mcp.tool(output_schema=...), @mcp.resource("ui://...") (io.modelcontextprotocol/ui), and @mcp.prompt() decorators serving 2026-07-28 and 2025-11-25 via .run(transport="streamable-http") or .run(transport="stdio") with full access to .app
Agent & A2A Runtime AgentRuntime & LitestarA2A Multi-agent orchestration, durable DAGs, and A2A 1.0 endpoints Agent, AgentGroup, TurnBudget, GoogleGenAIClient (gemini-3.8-flash), DurableWorkflowEngine, visibility-aware mcp_to_tools, and A2A 1.0 JSON-RPC + HTTP+JSON REST routes

Quick Comparison

docs/examples/snippets/configuration_minimal.py
from litestar import Litestar

from litestar_mcp import LitestarMCP

app = Litestar(plugins=[LitestarMCP()])
docs/examples/snippets/standalone_minimal.py
from litestar_mcp import MCP

mcp = MCP("my-mcp-server", instructions="Exposes utility tools.")


@mcp.tool(name="calculate_sum", description="Calculate the sum of two integers.")
def add(a: int, b: int) -> int:
    return a + b

Guided Learning Tracks

Installation & Extras

Install base litestar-mcp or enable optional extras for queues, a2a, google-genai, and opentelemetry with uv, pip, pdm, or poetry.

Installation & Extras →

5-Minute Quickstart

Attach LitestarMCP to a Litestar app, expose typed tools (outputSchema and structuredContent), ui:// MCP Apps, prompts, and litestar://openapi, inspect skills from the CLI, and test with 2026-07-28 and 2025-11-25 (Mcp-Session-Id, GET /mcp SSE, resources/subscribe, logging/setLevel) requests.

5-Minute Quickstart →

Standalone MCP Application

Build a declarative MCP server with @mcp.tool(), @mcp.resource(), and @mcp.prompt() and run it over Streamable HTTP or in-process stdio with MCPStdioContext.

Standalone MCP App →

Core Architectural Concepts

Understand internal ASGI dispatch, plugin ordering, universal dependency injection (Provide, Dependency, FromDishka[T], ToolContext), and tag filtering.

Core Concepts →