FastAPI MCP Streamable HTTP Starter
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
FastAPI MCP Streamable HTTP Starter 🚀
A minimal, production-ready starter template for building Model Context Protocol (MCP) servers in Python with FastAPI over Streamable HTTP.
Implements the official MCP Specification version 2025-11-25, handling standard JSON-RPC 2.0 requests:
initialize(protocol handshake and capability negotiation)tools/list(dynamic tool discovery)tools/call(tool execution)
âš¡ Quickstart
1. Clone the repository
git clone https://github.com/kshitijkumrawat20/fastapi-mcp-streamable-http-starter.git
cd fastapi-mcp-streamable-http-starter2. Install dependencies
Using uv:
uv pip install -r requirements.txtOr standard pip:
pip install -r requirements.txt3. Run the MCP server
uvicorn main:app --host 127.0.0.1 --port 8000 --reloadRelated MCP server: MCP Template
🧪 Testing with cURL
1. Protocol Handshake (initialize)
curl -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-11-25",
"capabilities": {},
"clientInfo": {"name": "curl-client", "version": "1.0.0"}
}
}'2. Discover Tools (tools/list)
curl -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}'3. Execute a Tool (tools/call)
curl -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "echo",
"arguments": {
"message": "Hello from MCP Streamable HTTP!"
}
}
}'🛠Adding Custom Tools
Subclass MCPTool and register it in mcp_server.py:
from mcp_server import MCPTool
class WeatherTool(MCPTool):
@property
def name(self) -> str:
return "get_weather"
@property
def description(self) -> str:
return "Returns current weather for a city."
@property
def input_schema(self) -> dict:
return {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
async def execute(self, arguments: dict) -> dict:
city = arguments["city"]
return {"city": city, "temperature": "72°F", "condition": "Sunny"}
# Register in ToolRegistry:
server.registry.register(WeatherTool())📄 License
MIT License. Feel free to use this template for your hackathons and production MCP servers!
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Python template for building Model Context Protocol (MCP) servers that expose tools via JSON-RPC, enabling secure and scalable context and tool invocation for language models.MIT
- AlicenseBqualityDmaintenanceA template repository for building Model Context Protocol (MCP) servers that enable LLM clients to interact with custom tools and services through standardized JSON-RPC communication.3MIT
- AlicenseNot gradedqualityDmaintenanceA bare-bones FastMCP server template designed to serve as a starting point for building custom Model Context Protocol servers. It provides a foundational structure for implementing tools over HTTP and includes a built-in health check utility.GPL 3.0
- AlicenseNot gradedqualityDmaintenanceA template MCP server implementing the 2026-07-28 spec with dynamic tool loading, API key authentication, and sample calculator and timestamp tools.MIT