What is LiteMCP?
LiteMCP is a FastAPI-native MCP server implementation. Unlike other solutions, it integrates directly with FastAPI using standard ASGI patterns, making it easy to add to existing applications.LiteMCP vs FastMCP
Quick Start
Create a basic MCP server:http://localhost:8000/mcp!
Server Components
Tools
Tools are functions that agents can call:Prompts
Prompts are reusable templates for common tasks:Resources
Resources provide access to data or content:Authentication & Context
Access request headers, cookies, and authentication tokens:Integration Patterns
Standalone Server
Run LiteMCP as a standalone application:With Existing FastAPI App
Integrate MCP into your existing FastAPI application:/mcp alongside your existing API.
With ASGI Servers
LiteMCP is a native ASGI application:Using MCP Servers with Agents
Connect to an HTTP MCP Server
Hand the agent anMCPServer alongside its other tools. Agentor connects to it when a run starts, turns its remote tools into ordinary tools, and closes the connection when the run ends — including when the run raises.
agent.run(...) works the same way — you do not need to manage the connection yourself.
str
required
The server’s streamable-HTTP MCP endpoint, usually ending in
/mcp.dict[str, str]
default:"None"
Headers sent on every request, typically for authentication.
float
default:"30.0"
Request timeout in seconds.
str
default:"the url"
A label used in logs and warnings.
str
default:"None"
Prepended to every tool name from this server. Use it when two servers expose the same tool name — otherwise the second one is skipped with a warning.
Inspect a server directly
MCPServer is also an async context manager, which is handy for checking what a server offers:
Migrating from MCPServerStreamableHttp
The old constructor still works and emits a DeprecationWarning. Options it accepted that the client no longer needs, such as cache_tools_list and max_retry_attempts, are ignored.
Connect to Celesto MCP Hub
Access shared MCP servers via Celesto:Complete Example
Here’s a full-featured MCP server:Best Practices
Deployment
LiteMCP is a FastAPI app, so host it like any other ASGI service - see Serve agents as an API. The MCP endpoint is served relative to wherever you mount it:Next Steps
- Learn about agent-to-agent communication using A2A protocol
- Set up observability for your MCP servers
- Serve your MCP server behind your own infrastructure
