litestar-mcp

Exposes Litestar route handlers as MCP tools and resources over JSON-RPC 2.0.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/renjianguo666/litecms --skill litestar-mcp-renjianguo666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: litestar-mcp
Source: https://github.com/renjianguo666/litecms/tree/main/.agents/skills/litestar-mcp
Command: npx skills add https://github.com/renjianguo666/litecms --skill litestar-mcp-renjianguo666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires litestar-mcp.

What problem does it solve? AI agents cannot call your Litestar API endpoints out of the box. This Skill guides you through exposing existing Litestar route handlers as Model Context Protocol (MCP) tools and resources over JSON-RPC 2.0, so MCP clients can discover and invoke your API without writing a separate server. ## Core Features & Use Cases - Automatic route discovery: GET handlers become MCP resources and POST/PUT/PATCH/DELETE handlers become MCP tools, discovered via the Litestar OpenAPI schema. - Per-route control: Override names and types with @mcp_tool, @mcp_resource, or opt dicts, and filter exposure with include/exclude tags and operations. - Auth and validation: Protect the MCP endpoint with OAuth 2.1 (PKCE) or Litestar guards, with tool arguments validated against OpenAPI request schemas. - Use Case: You have an e-commerce Litestar API and want an AI assistant to list products and add items to carts. Add LitestarMCP with include_tags=["public"], and the agent can call tools/list and tools/call at POST /mcp/ while internal metrics routes stay hidden. ## Quick Start Ask the AI to add the LitestarMCP plugin with an MCPConfig to your Litestar app and expose only your public-tagged routes as MCP tools and resources.

Frequently Asked Questions about litestar-mcp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose Litestar routes as MCP tools?

Install litestar-mcp and add LitestarMCP(MCPConfig(name="My API")) to your Litestar app's plugins list. GET handlers become MCP resources and POST/PUT/PATCH/DELETE handlers become tools automatically, served at POST /mcp/.

How do I rename or exclude specific routes from MCP exposure?

Use the @mcp_tool("name") or @mcp_resource("name") decorators to set explicit names, or set opt={"mcp_exclude": True} on a route to hide it. You can also filter globally with include_tags, exclude_tags, include_operations, and exclude_operations in MCPConfig.

Does litestar-mcp support authentication for MCP endpoints?

Yes, MCPConfig supports OAuth 2.1 via OAuthConfig with PKCE enforcement and JWKS-based token validation. For simpler setups, you can pass Litestar guards through the guards option to protect the MCP controller.

Can I use litestar-mcp with FastAPI or Django?

No, litestar-mcp only works with Litestar applications because it discovers routes through the Litestar OpenAPI schema and plugin system. FastAPI or Django projects need their own framework-specific MCP integrations.

Why should I use include_tags instead of exclude_operations?

Allowlists like include_tags are safer because newly added routes are not exposed by default. With blocklists, any new route you forget to exclude becomes callable by AI agents, which risks leaking admin or internal endpoints.