Poké-Battle

by shreyahhh

217 downloads
Not rated
GitHub

Description

# Poké-Battle This is a Pokemon game built with FastAPI and Python, leveraging Anthropic's Claude AI through a custom Model Context Protocol (MCP) server and client. It features real-time battles and utilizes AI for creative battle descriptions, attack recommendations, and…

About

# Poké-Battle This is a Pokemon game built with FastAPI and Python, leveraging Anthropic's Claude AI through a custom Model Context Protocol (MCP) server and client. It features real-time battles and utilizes AI for creative battle descriptions, attack recommendations, and generating unique personalities for caught…

Details

Author
shreyahhh
Downloads
217
Categories
AI

- Catch random Pokemon to build your team.
- Turn-based battles against a random opponent Pokemon.
- AI‑generated battle descriptions via Claude.
- AI‑suggested attack moves during battle.
- Each caught Pokemon gets a unique, AI‑generated personality.
- Real‑time game state and message updates via WebSocket.
- Demonstrates a Model Context Protocol for AI model interaction.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Poké-Battle
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, create and activate a Python virtual environment, then install dependencies. Set your Anthropic API key in a .env file, run the MCP server on port 8000 (uvicorn mcp_server:app --reload --port 8000), then run the main game server on port 8080 (uvicorn server:app --reload --port 8080). Open http://localhost:8080 in your browser to play.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "pok\u00e9-battle": {
            "Pokemon-Battle-using-MCP-Server-connected-to-Claude": {
                "command": "python",
                "args": [
                    "-m",
                    "venv",
                    ".venv"
                ]
            }
        }
    }
}

McpServers

{
    "Pokemon-Battle-using-MCP-Server-connected-to-Claude": {
        "command": "python",
        "args": [
            "-m",
            "venv",
            ".venv"
        ]
    }
}

Poké-Battle

This is a Pokemon game built with FastAPI and Python, leveraging Anthropic's Claude AI through a custom Model Context Protocol (MCP) server and client. It features real-time battles and utilizes AI for creative battle descriptions, attack recommendations, and generating unique personalities for caught Pokemon.

Tech Stack

Backend: FastAPI, Uvicorn (ASGI server)
AI Integration: Anthropic's Claude API, custom Model Context Protocol (MCP) server (mcp_server.py) and client (mcp_client.py)
External API: PokeAPI
Frontend: HTML, CSS, JavaScript (served by FastAPI)
Dependencies: python-dotenv, httpx, websockets, Jinja2

Setup Instructions

1. Clone the repository:

    git clone <repository_url>
cd <repository_directory>

2. Create a virtual environment:

    python -m venv .venv

3. Activate the virtual environment:
On Windows:

        .venv\Scripts\activate

On macOS and Linux:
        source .venv/bin/activate

4. Install dependencies:

    pip install -r requirements.txt

5. Set up your Anthropic API Key:
Create a file named .env in the root directory.
Add your Anthropic API key in the following format:

        ANTHROPIC_API_KEY=your_api_key_here

Note: For security, it's recommended to manage API keys using environment variables provided by your hosting environment rather than storing them in a .env file, especially in production.

6. Run the MCP Server:
Open your terminal in the project root and run:

    uvicorn mcp_server:app --reload --port 8000

7. Run the Main Game Server:
Open a new terminal in the project root (and activate the virtual environment if necessary) and run:

    uvicorn server:app --reload --port 8080

8. Open the game in your browser:
Go to http://localhost:8080

Project Structure

server.py: Main FastAPI application handling game logic and serving the frontend.
mcp_server.py: FastAPI application acting as the Model Context Protocol server, handling communication with the Anthropic API.
mcp_client.py: Python client library used by server.py to communicate with mcp_server.py.
index.html: The main frontend HTML file.
static/: Directory for static assets (CSS, JavaScript, images - although currently only the directory is present).
requirements.txt: Lists the Python dependencies.
api.env: Environment file to load the API key (should be added to .gitignore).
.gitignore: Specifies intentionally untracked files that Git should ignore.

Features

Pokemon Catching: Catch random Pokemon to build your team.
Pokemon Battles: Turn-based battles against a random opponent Pokemon.
AI Battle Descriptions: Creative commentary for battle actions generated by Anthropic's Claude.
AI Attack Recommendations: Get AI suggestions for the best move to use in battle.
AI Pokemon Personalities: Each caught Pokemon gets a unique, AI-generated personality trait or backstory.
Real-time Updates: Game state and messages updated via WebSocket.
MCP Implementation: Demonstrates using a Model Context Protocol for AI model interaction.

  • Responsive UI: Basic UI adjustments for better display of caught Pokemon.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.