经 AI Skill Hub 精选评估,Litestar MCP 获评「强烈推荐」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。
Litestar MCP 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
Litestar MCP 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/cofin/litestar-mcp
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"litestar-mcp": {
"command": "npx",
"args": ["-y", "litestar-mcp"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 Litestar MCP 执行以下任务... Claude: [自动调用 Litestar MCP MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"litestar_mcp": {
"command": "npx",
"args": ["-y", "litestar-mcp"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
This plugin automatically discovers Litestar routes marked for MCP and exposes them through an MCP-native transport surface. Pass mcp_tool="name" or mcp_resource="name" straight through to @get / @post / etc. — Litestar funnels unknown kwargs into handler.opt, so no second decorator or opt={...} wrapper is needed.
mcp_tool / mcp_resource kwargs straight through to Litestar's route decorators.mcp_resource_template="app://…/{var}" dispatches concrete URIs to handlers with extracted vars.mcp_description, mcp_agent_instructions, mcp_when_to_use, mcp_returns kwargs.msgspec-powered tool-argument validation.MCPAuthBackend or a composable create_oidc_validator() factory; injectable JWKSCache protocol for shared document caches.uv sync --all-extras --dev
```bash pip install litestar-mcp
```python from litestar import Litestar, get, post from litestar.openapi.config import OpenAPIConfig from litestar_mcp import LitestarMCP
```python from litestar import Litestar, get, post, delete from litestar.openapi.config import OpenAPIConfig from litestar_mcp import LitestarMCP, MCPConfig
uv run python docs/examples/hello_world/main.py ```
from litestar_mcp import LitestarMCP, MCPConfig
config = MCPConfig(
base_path="/api/mcp", # Change the base path
name="Custom Server Name", # Override server name
include_in_schema=True, # Include MCP routes in OpenAPI schema
)
app = Litestar(
route_handlers=[get_users, analyze_data, get_app_config],
plugins=[LitestarMCP(config)],
openapi_config=OpenAPIConfig(title="My API", version="1.0.0"),
)
Configure the plugin using MCPConfig:
from litestar_mcp import MCPConfig
config = MCPConfig()
Configuration Options:
| Option | Type | Default | Description |
|---|---|---|---|
base_path | str | "/mcp" | Base path for the MCP Streamable HTTP endpoint |
include_in_schema | bool | False | Whether to include MCP routes in OpenAPI schema |
name | str \| None | None | Override server name. If None, uses OpenAPI title |
guards | list[Any] \| None | None | Litestar guards applied to the MCP router |
allowed_origins | list[str] \| None | None | Restrict accepted Origin header values |
include_operations | list[str] \| None | None | Only expose matching operation names |
exclude_operations | list[str] \| None | None | Exclude matching operation names |
include_tags | list[str] \| None | None | Only expose routes with matching OpenAPI tags |
exclude_tags | list[str] \| None | None | Exclude routes with matching OpenAPI tags |
auth | MCPAuthConfig \| None | None | Metadata for /.well-known/oauth-protected-resource discovery |
tasks | bool \| MCPTaskConfig | False | Enable experimental in-memory MCP task support |
mcp_config = MCPConfig( name="User Management API", base_path="/mcp" )
Once configured, your application exposes these MCP-compatible endpoints:
GET /mcp - Server-Sent Events stream when Accept: text/event-stream is providedPOST /mcp - JSON-RPC endpoint for initialize, ping, tools/*, resources/*, and optional task methodsGET /.well-known/mcp-server.json - MCP server manifestGET /.well-known/agent-card.json - Agent metadata cardGET /.well-known/oauth-protected-resource - OAuth protected resource metadata when auth is configuredBuilt-in Resources:
litestar://openapi - Your application's OpenAPI schema (always available via resources/read)@get("/users/schema", mcp_resource="user_schema") async def get_user_schema() -> dict: """User data model schema.""" return { "type": "object", "properties": { "id": {"type": "integer"}, "name": {"type": "string"}, "email": {"type": "string"} } }
@get("/api/info", mcp_resource="api_info") async def get_api_info() -> dict: """API capabilities and information.""" return { "version": "2.0.0", "features": ["user_management", "data_analysis"], "rate_limits": {"requests_per_minute": 1000} }
A lightweight plugin that integrates Litestar web applications with the Model Context Protocol (MCP) by exposing marked routes as MCP tools and resources over MCP Streamable HTTP and JSON-RPC.
app = Litestar( route_handlers=[get_users, analyze_data, get_app_config], plugins=[LitestarMCP()], openapi_config=OpenAPIConfig(title="My API", version="1.0.0"), ) ```
高质量的MCP工具,易于集成
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:Litestar MCP 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | litestar-mcp |
| Topics | mcpaiasgijson-rpclitestar |
| GitHub | https://github.com/cofin/litestar-mcp |
| License | MIT |
| 语言 | Python |
收录时间:2026-06-04 · 更新时间:2026-06-04 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端