mcp-examples
Provides reference implementations of MCP servers using FastAPI and FastMCP, including calculator and RSS/Atom feed parser tools.
README
mcp-examples
Reference implementations of MCP servers using:
- FastAPI +
fastapi-mcp - FastMCP (STDIO and HTTP transports)
- FastMCP +
feedparserfor RSS/Atom querying
These examples are intentionally small and are useful as starter templates.
Repository layout
.
├── .env-template
├── fastapi-mcp/
│ └── fastapi-mcp-calculator.py
├── fastmcp/
│ ├── fastmcp-calculator.py
│ └── fastmcp-calculator-v2.py
├── mcp-feed-parser/
│ └── mcp-feed-parser.py
└── requirements.txt
Prerequisites
- Python 3.10+
- uv (Python package manager and runner)
- Node.js (optional, only for MCP Inspector)
Environment setup
Create a local environment file from the template:
cp .env-template .env
Then edit .env with your local values.
The provided .env-template includes starter defaults. The current examples do
not require environment variables unless you wire these values into the scripts.
Install dependencies (uv)
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
Examples
1) FastAPI + FastAPI-MCP calculator
File: fastapi-mcp/fastapi-mcp-calculator.py
What it demonstrates:
- Building a basic FastAPI calculator API (
add,subtract,multiply,divide) - Mounting MCP over the same app using
FastApiMCP(app).mount_http() - Running with Uvicorn on
0.0.0.0:8000
Run:
uv run python fastapi-mcp/fastapi-mcp-calculator.py
2) FastMCP calculator (STDIO transport)
File: fastmcp/fastmcp-calculator.py
What it demonstrates:
- Registering tools with
@mcp.tool() - Naming/tagging tools for better discoverability
- Running an MCP server over STDIO (useful for local client subprocess integration)
Run:
uv run python fastmcp/fastmcp-calculator.py
3) FastMCP calculator (HTTP transport)
File: fastmcp/fastmcp-calculator-v2.py
What it demonstrates:
- The same calculator tools as above
- Running FastMCP with HTTP transport on
localhost:8080
Run:
uv run python fastmcp/fastmcp-calculator-v2.py
4) FastMCP feed parser
File: mcp-feed-parser/mcp-feed-parser.py
What it demonstrates:
- Querying RSS/Atom feeds using
feedparser - Reusing a shared feed-search helper
- Exposing feed lookup as MCP tools:
fcc_news_parserfcc_youtube_parserfcc_secret_message
Run:
uv run python mcp-feed-parser/mcp-feed-parser.py
Inspecting/debugging with MCP Inspector
The MCP Inspector is the easiest way to test tools and inspect schemas.
npx @modelcontextprotocol/inspector <your-server-command>
For example (local Python server):
npx @modelcontextprotocol/inspector uv run python fastmcp/fastmcp-calculator.py
Notes
- The FastAPI sample filename is intentionally kept as-is (
calcularor) to match repository history. - Calculator division tools guard against division by zero.
- The feed parser returns a fallback message when no matches are found.
References:
- MCP documentation and specification: https://modelcontextprotocol.io/
- MCP Inspector guide: https://modelcontextprotocol.io/docs/tools/inspector
@modelcontextprotocol/inspectorpackage: https://www.npmjs.com/package/@modelcontextprotocol/inspector- FastMCP docs: https://gofastmcp.com/getting-started/welcome
- FastMCP repository: https://github.com/prefecthq/fastmcp
- FastAPI-MCP docs: https://fastapi-mcp.tadata.com/
- FastAPI docs: https://fastapi.tiangolo.com/
- feedparser docs: https://feedparser.readthedocs.io/en/latest/
Original reference video
- https://youtu.be/DosHnyq78xY?si=V4DSGMHX4kE3BYMh
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.