Sponsored by Deepsite.site

Poké-Battle

Created By
shreyahhh6 months ago
Content

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.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
Amap Maps高德地图官方 MCP Server
Playwright McpPlaywright MCP server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop