Overview
Agentor includes LiteMCP, a production-ready MCP server implementation built on FastAPI. Unlike other implementations, LiteMCP is a native ASGI application that integrates seamlessly with existing FastAPI apps.What is MCP?
The Model Context Protocol is an open standard for connecting LLMs to external tools, resources, and prompts. MCP enables:- Tools - Functions the LLM can call
- Resources - Static or dynamic data sources
- Prompts - Reusable prompt templates
LiteMCP vs FastMCP
LiteMCP offers key advantages over the official FastMCP implementation:| Feature | LiteMCP | FastMCP |
|---|---|---|
| Integration | Native ASGI | Requires mounting |
| FastAPI Patterns | ✅ Standard | ⚠️ Diverges |
| Built-in CORS | ✅ | ❌ |
| Custom Methods | ✅ Full | ⚠️ Limited |
| With Existing Backend | ✅ Easy | ⚠️ Complex |
Quick Start
Create an MCP server with the decorator API (src/agentor/mcp/server.py:14):http://0.0.0.0:8000/mcp by default.
Server Configuration
Constructor Parameters
Serving Options
Serve with custom configuration (src/agentor/mcp/server.py:58):Registering Tools
Define tools with the@tool decorator (src/agentor/mcp/api_router.py:564):
Auto-generated Schemas
If noinput_schema is provided, LiteMCP generates it from function signatures (src/agentor/mcp/api_router.py:221):
Resources
Register static or dynamic resources (src/agentor/mcp/api_router.py:588):Prompts
Create reusable prompt templates (src/agentor/mcp/api_router.py:612):Authentication and Context
Access request headers and authentication (src/agentor/mcp/api_router.py:39):Token Extraction
Get bearer tokens from Authorization headers (src/agentor/mcp/api_router.py:93):Dependencies
Use FastAPI’s dependency injection (src/agentor/mcp/api_router.py:290):ASGI Application
LiteMCP is a full ASGI application (src/agentor/mcp/server.py:50):Integration with FastAPI
Embed LiteMCP into existing FastAPI applications:Custom Method Handlers
Register custom JSON-RPC methods (src/agentor/mcp/api_router.py:651):Complete Example
Fromexamples/lite_mcp_example.py: