Skip to main content
Glama

mcp-examples

Reference implementations of MCP servers using:

  • FastAPI + fastapi-mcp

  • FastMCP (STDIO and HTTP transports)

  • FastMCP + feedparser for 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_parser

    • fcc_youtube_parser

    • fcc_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:

Original reference video

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/psyll0n/mcp-examples'

If you have feedback or need assistance with the MCP directory API, please join our Discord server