jayantsharma12/MCP_servers_pokemon_battle
If you are the rightful owner of MCP_servers_pokemon_battle and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides Pokemon data resources and battle simulation tools for AI models.
Pokemon MCP Server
A Model Context Protocol (MCP) server that provides Pokemon data resources and battle simulation tools for AI models.
Features
šÆ Pokemon Data Resource
- Complete Pokemon database with base stats (HP, Attack, Defense, etc.)
- Type information (Fire, Water, Electric, etc.)
- Abilities and movesets
- Evolution information
- Type effectiveness chart
āļø Battle Simulation Tool
- Real-time Pokemon battle simulation
- Type effectiveness calculations
- Status effects (Burn, Poison, Paralysis, Sleep)
- Turn-based battle system with detailed logs
- Damage calculation based on Pokemon stats
File Structure
pokemon-mcp-server/
āāā pokemon_server.py # Main MCP server file
āāā requirements.txt # Python dependencies
āāā setup.py # Package setup
āāā config.json # MCP configuration
āāā README.md # This file
āāā tests/ # Test files
ā āāā test_pokemon.py
āāā examples/ # Usage examples
āāā example_usage.py
VS Code Setup
1. Create Project Directory
mkdir pokemon-mcp-server
cd pokemon-mcp-server
2. Create Virtual Environment
python -m venv pokemon-env
# Windows
pokemon-env\Scripts\activate
# macOS/Linux
source pokemon-env/bin/activate
3. Install Dependencies
pip install -r requirements.txt
4. Environment Variables (Optional)
Create a .env
file:
OPENAI_API_KEY=your_openai_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here
GOOGLE_API_KEY=your_google_key_here
Available Pokemon
Current Pokemon in database:
- Pikachu (Electric)
- Charizard (Fire/Flying)
- Blastoise (Water)
- Venusaur (Grass/Poison)
- Gengar (Ghost/Poison)
- Alakazam (Psychic)
MCP Resources
1. pokemon://database/all
Complete Pokemon database with all stats and information.
2. pokemon://database/moves
All available moves with power, accuracy, and effects.
3. pokemon://types/effectiveness
Type effectiveness multipliers for battle calculations.
4. Public dataset-backed resources (PokeAPI)
pokemon://public/pokemon/{name}
: Raw PokeAPIpokemon
entity (stats, types, abilities, moves)pokemon://public/move/{name}
: Raw PokeAPImove
entity (power, accuracy, effects)pokemon://public/species/{name}
: Raw PokeAPIpokemon-species
entity (evolution chain metadata)
Notes:
- These endpoints fetch live data from
https://pokeapi.co/api/v2
with a lightweight in-memory cache. - They are optional and do not affect offline tests; if network is unavailable, core resources still work.
MCP Tools
1. get_pokemon_info
Get detailed information about a specific Pokemon.
{
"name": "pikachu"
}
2. battle_simulation
Simulate a battle between two Pokemon.
{
"pokemon1": "pikachu",
"pokemon2": "charizard"
}
3. compare_pokemon
Compare stats between two Pokemon.
{
"pokemon1": "pikachu",
"pokemon2": "alakazam"
}
How LLMs can query the resource (MCP examples)
List resources
resources = await server.list_resources()
print([r.uri for r in resources])
Read local database (structured for LLM consumption)
data = await server.read_resource("pokemon://database/all")
pokemon_list = json.loads(data)
Read public dataset (PokeAPI)
raw = await server.read_resource("pokemon://public/pokemon/pikachu")
payload = json.loads(raw)
Running the Server
Method 1: Direct Python
python pokemon_server.py
Method 2: Using MCP Client
# Install MCP client first
pip install mcp
# Run server
mcp run config.json
Method 3: Development Mode
# Install in development mode
pip install -e .
# Run server
pokemon-mcp-server
Battle System Features
ā” Status Effects
- Burn: Deals 1/16 HP damage each turn
- Poison: Deals 1/8 HP damage each turn
- Paralysis: 25% chance to skip turn
- Sleep: Pokemon can't move until it wakes up
šÆ Type Effectiveness
- Super Effective (2x damage)
- Normal Effective (1x damage)
- Not Very Effective (0.5x damage)
- No Effect (0x damage)
š Damage Calculation
- Based on Pokemon level, stats, and move power
- Includes STAB (Same Type Attack Bonus)
- Random damage variance (85%-100%)
- Critical hit chance
Example Usage
import asyncio
import json
from pokemon_server import pokemon_data, battle_simulator
# Get Pokemon info
pikachu = pokemon_data.get_pokemon("pikachu")
print(f"Pikachu HP: {pikachu.hp}")
# Simulate battle
result = battle_simulator.simulate_battle("pikachu", "charizard")
print(f"Winner: {result['winner']}")
print("Battle Log:")
for log in result['battle_log']:
print(log)
VS Code Extensions Recommended
- Python - Python language support
- Python Docstring Generator - Auto-generate docstrings
- GitLens - Git supercharged
- Thunder Client - API testing
- JSON - JSON file support
Development Commands
# Format code
black pokemon_server.py
# Lint code
flake8 pokemon_server.py
# Run tests
pytest tests/
# Type checking
mypy pokemon_server.py
Extending the Server
Adding New Pokemon
new_pokemon = Pokemon(
name="Snorlax",
hp=160, attack=110, defense=65,
sp_attack=65, sp_defense=110, speed=30,
type1="Normal",
abilities=["Immunity", "Thick Fat"],
moves=["Body Slam", "Rest", "Sleep Talk", "Earthquake"]
)
pokemon_data.pokemon_db["snorlax"] = new_pokemon
Adding New Moves
new_move = Move(
name="Thunder",
type="Electric",
power=110,
accuracy=70,
pp=10,
status_effect="paralysis"
)
pokemon_data.moves_db["thunder"] = new_move
API Integration (Optional)
If you want to add AI-powered features:
import openai
import anthropic
import google.generativeai as genai
# Configure APIs
openai.api_key = "your-openai-key"
anthropic_client = anthropic.Anthropic(api_key="your-anthropic-key")
genai.configure(api_key="your-google-key")
Troubleshooting
Common Issues
- Import Error: Make sure all dependencies are installed
pip install -r requirements.txt
- Pokemon Not Found: Check available Pokemon list
available = [p.name for p in pokemon_data.get_all_pokemon()]
print(available)
- MCP Connection Issues: Verify config.json is properly formatted
Debug Mode
export DEBUG=1
python pokemon_server.py
Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
Your Name - your.email@example.com
Project Link: https://github.com/yourusername/pokemon-mcp-server