PokéBattle AI Strategist
An intelligent Pokémon battle strategy assistant that provides strategic recommendations, type effectiveness analysis, and competitive insights through conversational AI powered by Algolia search.
README
PokéBattle AI Strategist
An intelligent Pokémon battle strategy assistant powered by Algolia search and natural language processing. This application provides strategic recommendations, type effectiveness analysis, and competitive insights through conversational AI.
Features
Natural Language Battle Planning
- Conversational Queries: Ask complex questions like "What's the best counter to a Charizard with Solar Beam?" or "Build me a team that can handle Dragon-types"
- AI-Powered Recommendations: Get strategic advice with detailed reasoning for team building and battle scenarios
- Context-Aware Analysis: Understands competitive formats, tiers, and battle contexts
Advanced Search Capabilities
- Multi-Index Search: Simultaneously searches across Pokémon, moves, abilities, and competitive data
- Type Effectiveness Engine: Complete type matchup calculations with resistance and immunity analysis
- Competitive Intelligence: Usage statistics, tier analysis, and meta trend insights
- Faceted Filtering: Filter by stats, types, generations, tiers, and battle roles
Interactive Battle Analysis
- Real-time Strategy: Get optimal move suggestions and switch recommendations
- Matchup Scoring: AI calculates and explains matchup advantages with numerical ratings
- Team Synergy Analysis: Identifies type coverage gaps and strategic synergies
- Counter Discovery: Find the best Pokémon to counter specific threats
System Features
- Connection Status: Real-time Algolia connection monitoring with available indices display
- Hybrid Search: Seamless switching between instant search and AI-powered analysis
- Responsive Design: Grid-based results layout optimized for all screen sizes
- Error Handling: Comprehensive error boundaries and fallback states
- Animation Effects: GSAP-powered smooth transitions and hover effects
Architecture
Technology Stack
- Frontend: React 19 + TypeScript + Vite
- Styling: Tailwind CSS v3 with glassmorphism effects
- Search Engine: Algolia v5 with custom search integration
- State Management: Custom React hooks with centralized battle logic
- AI Integration: Natural language processing for query interpretation
- Animations: GSAP for smooth transitions and effects
- Icons: Lucide React for consistent iconography
Project Architecture
pokemon_algolia_mcp/
├── frontend/ # React TypeScript application
│ ├── src/
│ │ ├── components/ # UI components
│ │ │ ├── HybridSearch.tsx # Main search interface
│ │ │ ├── AlgoliaStatus.tsx # Connection status display
│ │ │ ├── SearchResults.tsx # Pokemon grid results
│ │ │ ├── PokemonAnalysis.tsx # Battle analysis
│ │ │ ├── CustomInstantSearchResults.tsx # Custom search results
│ │ │ ├── SearchResultItem.tsx # Individual result card
│ │ │ ├── Header.tsx # App header
│ │ │ └── ErrorBoundary.tsx # Error handling
│ │ ├── services/ # Business logic
│ │ │ ├── algolia-enhanced.ts # Advanced Algolia integration
│ │ │ └── naturalLanguageSearchEnhanced.ts # Enhanced NLP search
│ │ ├── hooks/ # Custom React hooks
│ │ │ ├── useAlgoliaSearch.ts # Search integration
│ │ │ └── useGSAPAnimations.ts # Animation effects
│ │ ├── types/ # TypeScript interfaces
│ │ │ └── pokemon.ts # Data models
│ │ ├── utils/ # Utility functions
│ │ │ └── pokemon.ts # Pokemon helper functions
│ │ └── data/ # Static data
│ │ └── mockPokemon.ts # Demo data
│ └── package.json
├── backend/ # Express.js server
│ ├── src/
│ │ ├── server.ts # Main server file
│ │ ├── mcpClient.ts # MCP integration
│ │ ├── routes/ # API routes
│ │ └── utils/ # Server utilities
│ └── package.json
├── mcp-node/ # Algolia MCP server
│ ├── src/
│ │ ├── app.ts # MCP server implementation
│ │ ├── tools/ # MCP tools
│ │ └── data/ # Algolia API definitions
│ └── package.json
└── package.json # Root workspace configuration
Data Model
The application uses comprehensive TypeScript interfaces covering:
- PokemonData: Complete stats, abilities, movesets, type effectiveness
- MoveData: Power, accuracy, descriptions, competitive viability
- AbilityData: Effects, competitive ratings, Pokémon associations
- CompetitiveStatsData: Usage percentages, tier distributions, team synergies
- RecommendationData: AI-generated battle suggestions with reasoning
Getting Started
Prerequisites
- Node.js 18+
- npm package manager
Installation
# Clone the repository
git clone [repository-url]
cd pokemon_algolia_mcp
# Install all dependencies (frontend, backend, and mcp-node)
npm run install:all
# Or install manually
npm install
cd frontend && npm install
cd ../backend && npm install
cd ../mcp-node && npm install
Environment Setup
- Copy the environment example file:
cp .env.example .env
- Configure your environment variables in
.env:
# Algolia Configuration (get from Algolia dashboard)
ALGOLIA_APP_ID=your_algolia_app_id
ALGOLIA_API_KEY=your_algolia_search_key
# Anthropic API Key (required for AI features)
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# or
CLAUDE_API_KEY=your_claude_api_key_here
# Server Configuration
PORT=3000
Running the Application
# Start both frontend and backend concurrently
npm run dev
# Or start individually
npm run dev:frontend # Frontend only (http://localhost:5173)
npm run dev:backend # Backend only (http://localhost:3000)
Development Commands
npm run dev # Start both frontend and backend
npm run dev:frontend # Start frontend only (Vite dev server)
npm run dev:backend # Start backend only (Express server)
npm run build # Build both frontend and backend
npm run build:frontend # Build frontend only
npm run build:backend # Build backend only
npm run test # Run linting and type checking
npm run clean # Clean all node_modules
Project Structure
This is a monorepo with three main packages:
- frontend/: React + TypeScript + Vite application
- backend/: Express.js server with MCP integration
- mcp-node/: Algolia MCP server implementation
Environment Configuration
The application requires Algolia search configuration:
Setting up Algolia:
- Create a free account at algolia.com
- Create a new application
- Get your App ID from the dashboard
- Generate a search-only API key (API Keys section)
- Set up a
pokemonindex with your Pokemon data
Required Environment Variables:
- App ID: Get from your Algolia dashboard
- Search-Only API Key: Generate a search-only key in Algolia dashboard
- Anthropic API Key: Required for AI features (set in .env)
Usage Examples
Natural Language Queries
"What counters Charizard?"
→ Returns type-advantaged Pokémon with reasoning
"Best Water types for competitive play"
→ Filters by type and competitive viability
"Pokemon that can learn Ice Beam and have high speed"
→ Cross-references movesets and stats
"Build a rain team for OU tier"
→ Suggests team compositions with synergy analysis
Search Features
- Counter Analysis: Identifies type advantages, speed tiers, and defensive matchups
- Team Building: Analyzes type coverage, role distribution, and strategic synergies
- Move Search: Finds Pokémon that learn specific moves with competitive context
- Type Filtering: Advanced filtering by single/dual types with stat requirements
🏆 Competitive Features
Tier Integration
- OU (OverUsed): Standard competitive tier analysis
- UU/RU/NU: Lower tier viability assessments
- Ubers: Legendary/restricted format support
- LC (Little Cup): Pre-evolution competitive analysis
Battle Intelligence
- Matchup Scoring: Numerical ratings (0-100) for battle advantages
- Speed Tier Analysis: Critical speed benchmark comparisons
- Type Coverage: Complete offensive and defensive type analysis
- Meta Awareness: Current usage trends and team archetype recognition
Configuration
TypeScript Setup
The project uses strict TypeScript with verbatimModuleSyntax:
- Type-only imports:
import type { Pokemon } from '../types/pokemon' - Value imports:
import { charizardData } from '../data/pokemon'
Algolia Configuration
The application connects to a pre-configured Algolia index with Pokemon data:
- Index Name:
pokemon - Search Features: Instant search, faceting, highlighting
- Data Structure: Pokemon stats, types, moves, competitive info
Troubleshooting
Common Issues
1. Dependencies Installation
# If npm install fails, try clearing cache
npm cache clean --force
npm run clean
npm run install:all
2. Port Conflicts
- Frontend runs on port 5173 (Vite default)
- Backend runs on port 3000 (or PORT env variable)
- Check if ports are available or modify in package.json
3. Environment Variables
# Ensure .env file exists in root directory
cp .env.example .env
# Add your Anthropic API key for AI features
4. TypeScript Errors
# Run type checking
npm run test
# Check individual packages
cd frontend && npm run lint
cd backend && npm run type-check
5. Search Not Working
- Verify Algolia credentials in .env
- Check browser console for API errors
- Try demo mode if instant search fails
Development Tips
- Use browser dev tools to debug Algolia API calls
- Check network tab for MCP server communication
- Enable verbose logging in development mode
Design System
Visual Theme
- Dark Gradient Background: Blue → Purple → Indigo progression
- Glassmorphism Effects:
backdrop-blur-lgwith transparency - Typography: Clean hierarchy with gradient accent colors
- Interactive Elements: Smooth transitions with hover states
Responsive Design
- Mobile-First: Optimized for all screen sizes
- Grid Layouts: Adaptive column counts (1/2/3/4/5 columns)
- Touch-Friendly: Large tap targets and gesture support
Development
Codebase Cleanup (Latest)
The project recently underwent a major cleanup to reduce technical debt:
Removed Files (26 total):
- Deprecated services (algolia.ts, naturalLanguageSearch.ts, instantSearchClient.ts)
- Unused components (13 files including SearchInterface, FeatureShowcase, etc.)
- Unused hooks (useBattleStrategy.ts, useNaturalLanguageBattle.ts)
- Test/utility files and backup directories
- Unused dependencies (react-instantsearch package)
Current Architecture Benefits:
- Cleaner, focused codebase with only active functionality
- Reduced bundle size and improved performance
- Better maintainability and developer experience
- Streamlined component hierarchy
Adding New Features
- New Search Types: Extend interfaces in
naturalLanguageSearchEnhanced.ts - Additional Data: Update TypeScript interfaces in
types/pokemon.ts - UI Components: Follow existing patterns with Tailwind styling
- Search Logic: Implement in
algolia-enhanced.tswith proper error handling
Code Quality
- ESLint: Configured with React and TypeScript rules
- Type Safety: Strict TypeScript with comprehensive interfaces
- Component Design: Atomic components with clear prop interfaces
- State Management: Custom hooks for business logic separation
Performance
Optimization Features
- Vite Build System: Fast development and optimized production builds
- Code Splitting: Automatic chunking for optimal loading
- Search Optimization: Algolia's sub-50ms search performance
- Caching: Intelligent result caching for repeated queries
Future Roadmap
Planned Features
- MCP Server Integration: Claude Desktop workflow automation
- Team Export: Pokemon Showdown format compatibility
- Battle Simulator: Real-time battle scenario testing
- Community Features: Team sharing and rating system
- Advanced Analytics: Win rate predictions and meta tracking
Technical Enhancements
- Real-time Data: Live competitive usage updates
- Machine Learning: Enhanced recommendation algorithms
- Performance: Advanced caching and CDN integration
- Mobile App: React Native companion application
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please see our contributing guidelines for more information.
Built for the Pokémon competitive community
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。