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), PromptController, SkillController, and MCPSkillsConfig over /mcp 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(), @mcp.resource(), and @mcp.prompt() decorators with .run(transport="streamable-http") or .run(transport="stdio") and 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, and A2A 1.0 JSON-RPC + HTTP+JSON REST routes

Quick Comparison

docs/examples/snippets/configuration_minimal.py
"""Snippet: minimal LitestarMCP setup. Referenced from docs/usage/configuration.rst."""

from litestar import Litestar

from litestar_mcp import LitestarMCP


def build() -> "Litestar":
    # start-example
    app = Litestar(plugins=[LitestarMCP()])
    # end-example
    return app
docs/examples/snippets/standalone_minimal.py
# [start-setup]
from litestar_mcp import MCP

mcp = MCP("my-mcp-server", instructions="Exposes utility tools.")
# [end-setup]


@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

1. 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 →

2. 5-Minute Quickstart

Attach LitestarMCP to a Litestar app, mark a tool, resource, and prompt, inspect litestar://openapi, and test with 2026-07-28 and 2025-06-18 JSON-RPC requests.

5-Minute Quickstart →

3. 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 →

4. Core Architectural Concepts

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

Core Concepts →