FastMCP Webinar Demo Server

FastMCP Webinar Demo Server

An MCP server with six tools including web search, URL fetching, math calculation, and note management. Designed for a live-coding demo integrating FastMCP with LangGraph ReAct agents.

Category
访问服务器

README

FastMCP + LangGraph — Webinar Demo

A live-coding demo for the "AI Agents Are Only As Useful As the Tools They Can Reach" webinar.
Builds a real MCP server with six tools, connects it to a LangGraph ReAct agent, and lets you pick exactly which tool to call and what question to ask — all from the terminal.


What's in this repo

File Purpose
demo_mcp_server.py The MCP server — defines all six tools
demo_agent.py The interactive demo runner
requirements.txt Python dependencies
.env.example Template for your API keys

Quick start

1. Clone / download the files

Make sure demo_mcp_server.py and demo_agent.py are in the same folder.

2. Install dependencies

pip install -r requirements.txt

Python 3.10+ required.

3. Set up your API keys

cp .env.example .env

Open .env and fill in your keys (see API keys below).

4. Run the demo

python demo_agent.py

No OpenAI key yet? Run in tools-only mode — you can still test all six tools manually:

python demo_agent.py --tools-only

API keys

OpenAI (required for the agent — Section 3)

  1. Go to https://platform.openai.com/api-keys
  2. Click Create new secret key
  3. Copy the key and paste it as OPENAI_API_KEY in your .env

The demo uses gpt-4o-mini by default — the cheapest model that handles tool-calling well.
Change it by setting OPENAI_MODEL=gpt-4o in .env if you want the more powerful version.

Cost note: A full run-through of the demo costs roughly $0.01–0.05 with gpt-4o-mini.


Tavily (required for web_search tool)

  1. Go to https://app.tavily.com and sign up (free)
  2. Copy your API key from the dashboard
  3. Paste it as TAVILY_API_KEY in your .env

Free tier: 1,000 searches/month — more than enough for demos.

Without this key the web_search tool returns an error message, but all other tools work fine.


Demo walkthrough

Section 1 — Tool Discovery

Automatically connects to the MCP server and lists all available tools with their descriptions.

Section 2 — Interactive Tool Testing

You choose which tool to call and supply its arguments yourself. No LLM involved — raw tool input/output.

Available tools:
  1. web_search
  2. fetch_url
  3. save_note
  4. read_note
  5. list_notes
  6. calculate

Enter tool name or number (or 'done'): 6
  Tool : calculate
  Args : ['expression']
    expression (string): sqrt(144) + pi

Type done when you're ready to move on.

Section 3 — LangGraph Agent Demo

The agent picks its own tools based on your question. You can choose from preset questions or type your own.

Preset questions:
  1. Single tool — calculator
  2. Multi-tool — search then save
  3. Full workflow — search, fetch, calculate, save
  4. Read back a saved file
  5. Custom question

> 5
   Type your question: What is 2 to the power of 32?
  • Type quiet to toggle the verbose tool-call trace on/off
  • Type done to end this section

The six tools

Tool Description Requires
web_search Real web search via Tavily TAVILY_API_KEY
fetch_url Fetches and strips HTML from any URL
calculate Evaluates math expressions safely (sqrt, pi, log, etc.)
save_note Writes text to /tmp/mcp_notes/<filename>
read_note Reads a previously saved note
list_notes Lists all saved notes with sizes

Troubleshooting

ModuleNotFoundError
Run pip install -r requirements.txt again. If you're in a virtual environment, make sure it's activated.

OPENAI_API_KEY not set
Make sure you copied .env.example to .env (not .env.example) and filled in the key.

Server file not found
demo_agent.py and demo_mcp_server.py must be in the same directory.

web_search returns an error
Add your TAVILY_API_KEY to .env. All other tools still work without it.

Agent gives a wrong answer / tool call fails
Try adding more detail to your question. The agent uses tool descriptions to decide what to call — more specific questions get better results.


Resources

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选