A Model Context Protocol (MCP) server implementation that provides Pokemon-related tools using the PokeAPI. This project demonstrates how to create and test MCP servers using FastMCP (Python) and test them with the MCP Client Manager SDK (Node.js).
- 🔍 Get Pokemon Info: Fetch detailed information about any Pokemon by name or ID
- 🎨 Get Pokemon Type: Get information about Pokemon types and list Pokemon of that type
- 🎲 Get Random Pokemon: Discover a random Pokemon from the entire Pokedex
- ✅ Comprehensive Tests: Full test suite using Jest
- Node.js (v18 or higher)
- Python (v3.8 or higher)
- npm or yarn
- pip (Python package manager)
mcp-client-manager/
├── pokemon-mcp.py # FastMCP server with Pokemon tools
├── tests/
│ └── pokemon-mcp.test.js # Jest tests for Pokemon MCP
├── package.json # Node.js dependencies
├── .gitignore # Git ignore rules
└── README.md # This file
npm installThis will install:
@mcpjam/sdk- MCP Client Manager SDKjest- Testing framework
pip install fastmcp requestsfastmcp- Framework for building MCP serversrequests- HTTP library for API calls
Start the Pokemon MCP server:
python pokemon-mcp.pyThe server will start in STDIO transport mode by default, ready to receive MCP protocol messages.
Get detailed information about a specific Pokemon.
Parameters:
name(string): Pokemon name or ID
Example:
await manager.executeTool("pokemon_mcp", "get_pokemon", {
name: "pikachu"
});Returns:
- Pokemon name and ID
- Type(s)
- Height and weight
- Abilities
Get information about a Pokemon type and list Pokemon of that type.
Parameters:
type_name(string): Type name (e.g., "fire", "water", "electric")
Example:
await manager.executeTool("pokemon_mcp", "get_pokemon_type", {
type_name: "electric"
});Returns:
- Type name
- List of first 20 Pokemon with that type
Get information about a random Pokemon.
Parameters: None
Example:
await manager.executeTool("pokemon_mcp", "get_random_pokemon", {});Returns:
- Random Pokemon name and ID
- Type(s)
Run all tests:
npm testRun specific test file:
npm test pokemon-mcp.test.jsThe test suite includes:
- ✅ Getting Pokemon by name
- ✅ Getting Pokemon by ID
- ✅ Handling invalid Pokemon names
- ✅ Getting Pokemon type information
- ✅ Handling invalid types
- ✅ Getting random Pokemon
- ✅ Listing all available tools
- ✅ Verifying tool availability
-
Server Side (Python):
pokemon-mcp.pyuses FastMCP to create an MCP server- Defines tools using the
@mcp.tool()decorator - Each tool function includes a docstring (used as tool description)
- Server communicates via STDIO (standard input/output)
-
Client Side (Node.js):
- Tests use
MCPClientManagerfrom@mcpjam/sdk - Manager spawns the Python process and communicates via MCP protocol
getTools()retrieves available tools from the serverexecuteTool()invokes a specific tool with parameters
- Tests use
┌─────────────────┐ MCP Protocol ┌─────────────────┐
│ Jest Tests │◄─────────(STDIO)──────────────►│ FastMCP Server │
│ (Node.js) │ │ (Python) │
└─────────────────┘ └─────────────────┘
│ │
│ 1. Start server │
│ 2. Request tools list │
│ 3. Execute tool with params │
│ 4. Receive results │
│ │
└──────────────────────────────────────────────────┘
- Test calls
manager.executeTool("pokemon_mcp", "get_pokemon", { name: "pikachu" }) - MCPClientManager sends MCP message to Python server via STDIO
- FastMCP receives message and routes to
get_pokemon()function - Function calls PokeAPI:
https://pokeapi.co/api/v2/pokemon/pikachu - Function processes response and returns formatted string
- FastMCP sends result back via MCP protocol
- Test receives and validates the result
This project uses the free PokeAPI to fetch Pokemon data. No API key required!
This is expected behavior due to the persistent connection between the test client and MCP server. Jest will warn about this but tests still pass.
Make sure you've installed the required Python packages:
pip install fastmcp requestsEnsure the Python server path in tests matches your actual file location:
args: ["pokemon-mcp.py"] // Relative to project rootFeel free to add more Pokemon-related tools or improve existing ones!
- Get Pokemon evolution chain
- Get Pokemon moves
- Get Pokemon stats comparison
- Get Pokemon by generation
- Get Pokemon by habitat