Demo MCP Server
A demonstration server designed to showcase core Model Context Protocol (MCP) primitives including tools, resources, and prompts for presentations. It provides functional examples like text analysis and financial calculations to illustrate how AI models interact with external functions and data.
README
Demo MCP Server
A simple but complete MCP (Model Context Protocol) server built for presentations and demonstrations. This server showcases all three core MCP primitives: Tools, Resources, and Prompts in under 240 lines of Python code.
For Presenters: See DEMO_CHEATSHEET.md for a detailed 5-minute presentation script with timing guide.
What This Demonstrates
This demo server showcases:
-
Tools (Model-controlled functions)
calculate_tip- Financial calculationsanalyze_text- Text analysis and statisticsconvert_temperature- Temperature conversion
-
Resources (Application-controlled data)
demo://server-info- Server metadata and capabilitiesdemo://example-data- Sample data for testingdemo://statistics- Usage statistics
-
Prompts (User-controlled templates)
demo_workflow- Guided walkthrough of all capabilitiesquick_demo- 2-minute quick demonstration
Quick Start
Prerequisites
pip install fastmcp
For MCP Inspector (requires Node.js):
npm install -g @modelcontextprotocol/inspector
Option 1: Interactive Demo with MCP Inspector (Recommended)
Linux/Mac:
cd mcp-demo
./demo.sh
# Choose option 1 for interactive demo
Windows/Direct:
npx @modelcontextprotocol/inspector python demo_server.py
This opens a web UI where you can:
- Browse available tools, resources, and prompts
- Test tools with custom inputs
- See real-time JSON responses
- Perfect for live presentation demos
Option 2: Use with Claude Desktop
- Add to your Claude Desktop config:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Mac:
{
"mcpServers": {
"demo-server": {
"command": "python",
"args": ["D:\\Demo\\mcp-demo\\demo_server.py"]
}
}
}
- Restart Claude Desktop completely
- Look for the hammer icon - server tools will be available in conversations
- The server should auto-start when Claude Desktop launches
Option 3: Standalone Server
python demo_server.py
The server will start and display:
- 3 available tools
- 3 resources
- 2 prompts
Connect via any MCP-compatible client (Claude Desktop, Cursor, VS Code with MCP extension).
Demo Script for Presentation
Setup (30 seconds before demo)
cd mcp-demo
npx @modelcontextprotocol/inspector python3 demo_server.py
Demo Flow (5 minutes)
1. Introduction (30 seconds)
Show the code:
- Open
demo_server.py - Highlight the decorators:
@mcp.tool(),@mcp.resource(),@mcp.prompt() - Point out: "150 lines of Python, zero boilerplate"
Say:
"This is a complete MCP server. Notice how simple it is - just Python functions with decorators. Type hints automatically generate schemas, docstrings become descriptions for the LLM."
2. Tools Demo (2 minutes)
In MCP Inspector:
- Click on "Tools" tab
- Show the three available tools
Live Demo - calculate_tip:
{
"bill_amount": 100,
"tip_percentage": 20
}
Say:
"Tools are model-controlled - the LLM decides when to invoke them based on user requests. Here we calculate a 20% tip on $100. See the structured JSON response."
Live Demo - analyze_text:
{
"text": "The Model Context Protocol enables AI applications to seamlessly connect with external tools and data sources."
}
Say:
"Same pattern - clean input, structured output. The LLM can use this data to provide intelligent responses."
3. Resources Demo (1 minute)
In MCP Inspector:
- Click on "Resources" tab
- Fetch
demo://server-info
Say:
"Resources are application-controlled data sources. Unlike tools where the LLM decides, here the client application determines when to fetch data. Think of them like REST GET endpoints - they provide context to the AI."
Show the JSON response with server capabilities
4. Prompts Demo (1 minute)
In MCP Inspector:
- Click on "Prompts" tab
- Show
demo_workflowandquick_demo
Say:
"Prompts are user-controlled templates. In a real application, these would appear as slash commands or menu items. They help users accomplish common tasks without remembering exact phrasing."
Trigger the quick_demo prompt and show how it structures the interaction
5. Wrap Up (30 seconds)
Say:
"From concept to working server: minutes, not hours. This same server works with Claude Desktop, Cursor, VS Code - any MCP-compatible client. Build once, use everywhere. That's the power of MCP."
Key Talking Points
During Code Review
- "Type hints auto-generate JSON schemas"
- "Docstrings become LLM-readable descriptions"
- "Zero configuration - just decorators and functions"
During Tool Demo
- "LLM autonomously decides when to call these"
- "Structured inputs and outputs"
- "Error handling built into the protocol"
During Resources Demo
- "Application controls when to fetch"
- "Real-time data without tool invocation overhead"
- "Perfect for context that changes frequently"
During Prompts Demo
- "User initiates via UI or commands"
- "Reusable templates for common workflows"
- "Guides users through complex interactions"
Closing
- "Three primitives cover all integration needs"
- "Build once, deploy everywhere"
- "10,000+ servers in the ecosystem already"
Testing the Demo
Test calculate_tip
# In MCP Inspector or programmatically
calculate_tip(85.50, 18)
# Expected output:
{
"bill_amount": 85.5,
"tip_percentage": 18,
"tip_amount": 15.39,
"total": 100.89,
"split_2_people": 50.45
}
Test analyze_text
analyze_text("Building MCP servers is straightforward with official SDKs.")
# Expected output:
{
"word_count": 8,
"character_count": 60,
"character_count_no_spaces": 52,
"estimated_reading_time_minutes": 0.0,
"analyzed_at": "2025-01-23T..."
}
Test convert_temperature
convert_temperature(25, "C", "F")
# Expected output:
{
"original_value": 25,
"original_unit": "C",
"converted_value": 77.0,
"converted_unit": "F",
"formula_used": "C → C → F"
}
Supports conversion between Celsius (C), Fahrenheit (F), and Kelvin (K) in any direction.
Requirements
Python Dependencies:
pip install fastmcp
For MCP Inspector (Optional):
- Node.js 16+ required
- Install:
npm install -g @modelcontextprotocol/inspector - Or use directly:
npx @modelcontextprotocol/inspector
Tested with:
- Python 3.10+
- FastMCP 0.2.0+
- Claude Desktop (latest)
Learning Points for Audience
After this demo, your audience will understand:
- How simple MCP servers are to build - Less than 200 lines for a full-featured server
- The three core primitives - Tools, Resources, Prompts and when to use each
- Type-driven development - Python types become API contracts
- Instant testing - MCP Inspector provides immediate feedback
- Portability - Same server works across all MCP clients
Troubleshooting
"ModuleNotFoundError: No module named 'fastmcp'"
pip install fastmcp
"npx command not found"
Install Node.js from https://nodejs.org/
Server not appearing in Claude Desktop
- Check config path:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Mac:
- Verify Python path: Use absolute path to
demo_server.py - Check Python command: Use
pythonorpython3depending on your system - Restart Claude Desktop: Completely quit and relaunch
- Check logs: Look for errors in Claude Desktop developer console
Server starts but tools not available
- Look for the hammer icon in Claude Desktop chat interface
- Server must successfully connect (check for errors in terminal)
- Try manually running:
python demo_server.pyto see startup messages
Notes for Presenter
- Timing: Practice to keep it under 5 minutes
- Backup: Have screenshots ready if live demo has issues
- Questions: Be ready to show the source code on request
- Transition: After demo, move to CV-Forge as "more complex real-world example"
Additional Resources
- Official MCP Documentation: https://modelcontextprotocol.io
- FastMCP GitHub: https://github.com/jlowin/fastmcp
- MCP Specification: https://spec.modelcontextprotocol.io
- MCP Servers Registry: https://github.com/modelcontextprotocol/servers
- Claude Desktop: https://claude.ai/download
Project Structure
mcp-demo/
├── demo_server.py # Main MCP server implementation
├── requirements.txt # Python dependencies
├── demo.sh # Interactive demo launcher (Linux/Mac)
├── claude_desktop_config.json # Example Claude Desktop config
├── README.md # This file
├── DEMO_CHEATSHEET.md # Presentation script with timing
└── .groupcode/ # Code organization metadata
License
MIT License - Feel free to use this as a template for your own MCP servers.
Demo Server Version: 1.0.0
Built with: FastMCP + Python 3.10+
Created for: MCP Presentations and Learning
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。