A demonstration MCP (Model Context Protocol) server using FastMCP 2.x with HTTP transport.
- Tools: Mathematical calculator, sequence generator, data echo
- Resources: Server config, sample data, statistics
- Prompts: Code review, data analysis, task planning templates
- HTTP Transport: Modern streamable HTTP with health checks
-
Setup environment:
source venv/bin/activate pip install -r requirements.txt
-
Start server:
python server.py
Server runs at
http://127.0.0.1:8000
-
Test with client:
python test_client.py
Use FastMCP's development mode with MCP Inspector:
fastmcp dev server.py
This provides an interactive web interface at http://localhost:8000
for testing tools, resources, and prompts.
- Full test suite:
python test_client.py
- Interactive mode:
python test_client.py --interactive
- Health check:
curl http://127.0.0.1:8000/health
calculate(expression)
- Safe math evaluationgenerate_sequence(start, end, step)
- Number sequence with progressecho_data(message, metadata)
- Echo with timestamp
config://server
- Server configurationdata://{category}
- Sample data (users, products, orders)stats://server
- Runtime statistics
code_review_prompt(code, language)
- Code review templatedata_analysis_prompt(data_description, analysis_type)
- Analysis templatetask_planning_prompt(task, complexity)
- Planning template
Connect to Claude Desktop by adding to config:
{
"mcpServers": {
"simple-http": {
"command": "python",
"args": ["/path/to/server.py"],
"env": {}
}
}
}