Skip to main content

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:

Quick Start

Create an MCP server with the decorator API (src/agentor/mcp/server.py:14):
The server runs at 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 no input_schema is provided, LiteMCP generates it from function signatures (src/agentor/mcp/api_router.py:221):
Generated schema:

Resources

Register static or dynamic resources (src/agentor/mcp/api_router.py:588):
Clients can read resources using the MCP protocol:

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):
LiteMCP automatically resolves dependencies before calling tools.

ASGI Application

LiteMCP is a full ASGI application (src/agentor/mcp/server.py:50):
Or deploy with Gunicorn:

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

From examples/lite_mcp_example.py:

Using MCP Servers with Agents

Connect agents to external MCP servers:

Celesto MCP Hub

Connect to Celesto’s hosted MCP servers (src/agentor/core/agent.py:676):

Protocol Details

LiteMCP implements MCP JSON-RPC 2.0:

Initialize Handshake

Response includes server capabilities (src/agentor/mcp/api_router.py:371):

Next Steps

Tools

Learn about the tool system

A2A Protocol

Enable agent-to-agent communication

Deployment

Deploy MCP servers to production
Last modified on May 5, 2026