LiteMCP
LiteMCP is an ASGI-compatible Model Context Protocol (MCP) server built on FastAPI. It provides a decorator-based API for registering tools, prompts, and resources.
Class Definition
MCPAPIRouter and adds ASGI compatibility with FastAPI.
Constructor
dict
Additional arguments passed to
MCPAPIRouter. Common options:name(str): Server name (default: “agentor-mcp-server”)version(str): Server version (default: “0.1.0”)instructions(str): Instructions for using the serverprefix(str): URL prefix for MCP endpoints (default: “/mcp”)website_url(str): Server website URLicons(List[Icon]): Server iconsdependencies(List[Callable]): FastAPI dependencies
Methods
serve()
Run the server with uvicorn.str
default:"0.0.0.0"
Host to bind the server to
int
default:"8000"
Port to bind the server to
bool
default:"true"
Whether to enable CORS middleware with permissive settings
dict
Additional arguments passed to
uvicorn.run(), such as:reload(bool): Enable auto-reloadlog_level(str): Logging level (“debug”, “info”, “warning”, “error”)workers(int): Number of worker processes
run()
Deprecated. Useserve() instead.
Decorators
LiteMCP inherits all decorators fromMCPAPIRouter:
@app.tool()- Register a tool@app.prompt()- Register a prompt@app.resource()- Register a resource@app.method()- Register a custom MCP method handler
ASGI Interface
LiteMCP implements the ASGI interface via __call__, making it compatible with any ASGI server:
Example Usage
Basic Server
Running with Different Methods
Custom Configuration
See Also
- MCPAPIRouter - Base router class with decorator API
- CelestoMCPHub - Client for connecting to Celesto AI MCP Hub
