pokemon-mcp
Enables users to look up Pokemon, manage a party, and challenge the Pokemon league through MCP tools.
README
Pokemon MCP Workshop ⚡
Build an MCP server, teach Claude to catch 'em all, and beat the Elite Four live on the projector.
You'll clone this repo, connect a half-finished MCP server to MCP Inspector and Claude Desktop, and implement the missing tool. The moment your party is ready and you call challenge_league, your name is on the room's leaderboard.
Pre-workshop setup (do this before you arrive)
Requires Node.js 20+.
git clone <this-repo>
cd pokemon-mcp
npm install
npm run register -- "YourTrainerName" # writes your token into .env
npm run verify # ✅/❌ table — everything except trainer registration should be green
If npm run verify shows green, you're done until workshop day.
Architecture
┌────────────┐ MCP (stdio) ┌───────────────────┐ HTTPS ┌──────────────┐
│ MCP client │ ───────────────▶│ YOUR MCP SERVER │──────────▶│ PokeAPI │
│ (Inspector,│ stdin/stdout │ (this repo) │ ├──────────────┤
│ Claude) │ │ SDK │──────────▶│ League server│
└────────────┘ └───────────────────┘ Bearer │ (hosted) │
token └──────────────┘
src/server.ts— assembles theMcpServer, registers every tool, and connects it to the stdio transport. You'll live here.src/tools/— one file per tool.get_pokemonis complete (your worked example); the other three are yours.src/lib/pokeapi.ts&src/lib/league.ts— pre-written fetch helpers. You never write HTTP plumbing, only tool logic.- All your trainer state (party, badges) lives on the league server — your MCP server is stateless.
1 · Register as a trainer
npm run register -- "YourTrainerName"
This calls the league's POST /api/register and writes your token into .env. (Browser fallback: open <LEAGUE_URL>/register, copy the token, paste it into .env yourself — the classic "create an API key in the dashboard" ritual.)
2 · Connect Inspector
npm run inspect # launches Inspector, which spawns `npm run dev` over stdio
In the Inspector UI: transport STDIO should already be selected (it launched your server for you). Open Tools → List Tools and call get_pokemon with "pikachu". That round-trip — schema in, structured result out — is the whole MCP tool model.
3 · The worksheet: implement the stub
The stub in src/tools/addPokemonToParty.ts already has its zod schema, description and a TODO block with hints. Copy the get_pokemon pattern. Test it in Inspector as you go.
3a · add_pokemon_to_party — what it adds: an authed POST
- What: validate the name via
getPokemon()(from../lib/pokeapi.js), thenfetchLeague("/api/party", { method: "POST", body: { pokemon } }). - Where:
src/tools/addPokemonToParty.ts - Hints:
fetchLeaguealready attaches your Bearer token. CatchPokeApiError/LeagueErrorand return their.messagewithisError: true— the league's error messages (party full, over budget, Kanto rule) are written for the model to self-correct from, so pass them through verbatim. - Done when: Inspector shows your updated party, and adding a 4th member returns a friendly error instead of crashing.
3b · challenge_league — provided for you: interpreting a rich response
challenge_league (src/tools/challengeLeague.ts) is already implemented — read it after finishing 3a to see the second idea: turning a rich response (ChallengeResponse in src/lib/league.ts) into a battle report the model can read, instead of JSON.stringify. Once your party has 3 members, challenge — your name appears on the projector within ~3 seconds. 🎉
Stuck? git checkout solution is the escape hatch (then git checkout main to keep working).
4 · The league rules
| Elite | Types | BST |
|---|---|---|
| Gyarados | water/flying | 540 |
| Gengar | ghost/poison | 500 |
| Articuno | ice/flying | 580 |
| Snorlax | normal | 540 |
Battle rule (fully deterministic, no dice): power = BST × type multiplier — the best single-type effectiveness among your Pokémon's types against the elite's full type combo. Your Pokémon beats an elite only if its power is strictly greater both ways (ties go to the elite — Alakazam vs Gengar is an exact tie, Gengar wins). Immunities multiply to 0: Normal attackers literally cannot touch Gengar. An elite falls if any of your 3 party members beats them.
Party rules: exactly 3 to challenge · original 151 only, legendaries banned (Articuno, Zapdos, Moltres, Mewtwo, Mew) · combined BST budget of 1500 across the party. Big stats or good typing — you can't have both. Re-challenge freely: only your best result counts, and post-best attempts don't hurt your rank.
Leaderboard: badges → fewest attempts to your best → earliest. Lowest party BST among equal trainers is bragging rights ("won with the cheapest team").
5 · Beat the League with Claude 🏆
This is the punchline of the whole workshop. Connect your server to Claude Desktop and give it this prompt, verbatim:
Look up each Elite Four member's weaknesses and build me a party of 3 that sweeps them.
Watch Claude chain get_pokemon → add_pokemon_to_party → challenge_league, read the league's error messages when it busts the budget or picks a legendary, and self-correct. That loop — model + tools + good error messages — is what you just built.
Connecting Claude Desktop
npm run mcp-config
This prints a claude_desktop_config.json snippet with cwd already set to your project path — copy it in (Settings → Developer → Edit Config) instead of hand-editing a placeholder path.
Restart Claude Desktop, then ask it things like "look up snorlax" or "add gengar to my party".
Stretch goals
get_type_effectivenesstool — PokeAPI has/type/{name}; save Claude a lookup step.remove_pokemon_from_partyis already provided (src/tools/removePokemonFromParty.ts, an authed DELETE) — read it to see how the model swaps members to fix a busted budget.
Troubleshooting
- "No trainer token" →
npm run register -- "YourName", then reconnect Inspector/Claude Desktop (the server reads.envat boot). - PokeAPI slow/down on venue Wi-Fi → responses are cached in-process after first fetch; the league bundles its own battle data, so challenges still work.
- Inspector won't connect → make sure you picked transport STDIO, with command
npxand argstsx src/server.ts. mr. mime?farfetch'd? → PokeAPI naming is lowercase-hyphenated:mr-mime,farfetchd,nidoran-f.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。