🔴 Pokédex MCP服务器+聊天机器人
作为MCP服务器的实时Pokédex——查找Pokémon、注册训练师和管理收藏。配备多提供商AI聊天机器人前端。
______________________________________________________________________
里面有什么
| 文件 | 目的 |
|---|---|
server.py | MCP服务器(FastMCP,5个工具) |
backend.py | MCP客户端+LLM路由(OpenAI、Groq、Gemini、Anthropic) |
app.py | Streamlit聊天机器人前端 |
test_server.py | 服务器逻辑单元测试 |
test_stdio.py | 协议级MCP标准测试 |
usage_example.py | 端到端使用演示(无需LLM) |
______________________________________________________________________
MCP工具
| 工具 | 它做什么 |
|---|---|
lookup_pokemon | 查找任何口袋妖怪——类型、统计数据、描述(来自PokeAPI直播) |
register_trainer | 按姓名注册新培训师 |
get_trainer | 查看教练的个人资料和口袋妖怪系列 |
add_pokemon | 将口袋妖怪添加到训练师收藏中 |
remove_pokemon | 从训练师收藏中删除口袋妖怪 |
______________________________________________________________________
聊天机器人设置
1.安装依赖项
pip install streamlit fastmcp requests langchain langchain-core langgraph
# Install the SDK for your chosen provider:
pip install langchain-openai # OpenAI
pip install langchain-groq # Groq
pip install langchain-anthropic # Anthropic
pip install langchain-google-genai # Google Gemini2.运行聊天机器人
cd app
streamlit run frontend.py3.在侧边栏中
- 选择您的 LLM提供者 (OpenAI/Groq/Google Gemini/Autopic)
- 选择一个 模型
- 输入你的 API密钥 (仅用于会话,从不存储)
- 点击 启动MCP服务器
- 开始聊天!
______________________________________________________________________
为什么 uvx 对于MCP客户?
uvx 是的一部分 uv Python工具链。它允许MCP客户端(Claude Desktop、Cursor等)运行您的服务器 直接从GitHub下载,无需任何手动安装步骤:
uvx --from git+https://github.com/MeetRVyas/pokedex-mcp-server.git pokedex-mcp-server这个:
- 自动从GitHub中提取代码
- 创建隔离的虚拟环境
- 运行
pokedex-mcp-server入口点定义于pyproject.toml - 在任何机器上都可以相同地工作——不需要路径配置
安装 uv 第一
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"______________________________________________________________________
Claude桌面配置
添加到您的 claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json\ 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"pokedex": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/MeetRVyas/pokedex-mcp-server.git",
"pokedex-mcp-server"
]
}
}
}重新启动Claude Desktop——工具将自动显示。
______________________________________________________________________
本地开发
# Run server directly
python server.py
# Run tests
python test_server.py
python test_stdio.py
# Run usage demo (hits PokeAPI live)
python usage_example.py______________________________________________________________________
示例提示
“将我注册为名为Ash的教练”\ “抬头看看Gengar”\ “将皮卡丘添加到阿什的收藏中”\ “给我看看Ash的Pokédex”\ “从阿什的收藏中删除皮卡丘”\ “Charizard的基本数据是什么?”
