Simple MCP Server
A calculator MCP server providing add and subtract tools, along with file resources and a code review prompt, supporting in-memory, HTTP, and STDIO transports. It also includes a LangGraph ReAct agent example that uses the tools.
README
š§® Simple MCP Server (built with FastMCP)
A "Hello World" MCP (Model Context Protocol) server built with FastMCP ā a small calculator server you can talk to over in-memory, HTTP, and STDIO transports, plus a LangGraph ReAct agent that uses its tools.
It exposes:
| Type | Name | Description |
|---|---|---|
| š ļø Tool | add(a, b) |
Add two integers |
| š ļø Tool | subtract(a, b) |
Subtract b from a |
| š Resource | file:///endpoint/{name} |
Returns a template message |
| š Resource | file://endpoint2/{name} |
Reads a real file from ./path/ |
| š¬ Prompt | review_code(code) |
A reusable "review this code" template |
Project structure
simple-MCP-server-built-with-FastMCP/
āāā server.py # the FastMCP server (tools + resources + prompt)
āāā client_inmemory.py # test in the same process (no network)
āāā client_http.py # connect over HTTP
āāā client_stdio.py # spawn the server as a subprocess (STDIO)
āāā agent_example.py # LangGraph ReAct agent that uses the tools
āāā path/ # files served by the file resource
ā āāā README.txt
ā āāā examples.txt
āāā requirements.txt
āāā .env.example # API key template (for the agent only)
āāā README.md
Setup
cd simple-MCP-server-built-with-FastMCP
python -m venv .venv
# Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
# macOS / Linux:
source .venv/bin/activate
pip install -r requirements.txt
Run it
1. Quick test ā in-memory (no network, no API key)
python client_inmemory.py
Calls the tools, lists them, reads both resources, and renders the prompt.
2. HTTP transport
Terminal A (start the server):
python server.py http # serves http://127.0.0.1:8000/mcp
Terminal B (run the client):
python client_http.py
3. STDIO transport
python client_stdio.py # spawns server.py itself ā nothing to start first
4. ReAct agent (needs an API key)
# one-time: copy the template and add a key
Copy-Item .env.example .env # then edit .env (GROQ_API_KEY is free)
python agent_example.py
The agent loads the MCP tools, then answers "What is 8 + 7? Use the tools." by
actually calling the add tool.
š” Groq is free ā get a key at console.groq.com. The agent uses Groq if
GROQ_API_KEYis set, otherwise OpenAI.
How MCP transports differ
- In-memory ā client and server share one Python process (simplest; for testing).
- HTTP ā server runs as a web service; clients connect by URL (good for remote/shared).
- STDIO ā client launches the server as a child process and talks over stdin/stdout (good for local tools).
The same tools/resources/prompt work over all three ā only the "wire" changes.
Credits
Based on the IBM Skills Network lab "Hello World of MCP Servers." Built with FastMCP, LangGraph, and langchain-mcp-adapters.
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.