Path of Exile 2 Build Optimizer MCP
Enables AI-powered Path of Exile 2 character optimization through natural language queries, providing intelligent build recommendations, gear upgrades, and passive tree optimization using the official PoE API and comprehensive game database.
README
Path of Exile 2 Build Optimizer MCP
A comprehensive Model Context Protocol (MCP) server and web application for Path of Exile 2 character optimization, featuring AI-powered build recommendations, local game database, and intelligent upgrade suggestions.
Overview
This project combines the power of MCP servers, AI analysis, and comprehensive PoE2 game knowledge to provide players with intelligent, personalized build recommendations through natural language interaction.
Key Features
MCP Server
- Character Data Fetcher: Pulls character information via official PoE API
- Natural Language Interface: Ask questions like "How can I increase my lightning damage?"
- Build Optimization: AI-powered recommendations for gear, passives, and skills
- Rate-Limited API: Respectful API usage with intelligent caching
Local Game Database
- Complete item database (bases, modifiers, uniques)
- Passive skill tree data (nodes, connections, keystones)
- Skill gems and support interactions
- Ascendancy classes and notables
- Crafting bench options and influenced modifiers
AI-Powered Features
- Natural language build queries
- Goal-based optimization (DPS, survivability, boss killing, clear speed)
- Trade-off analysis
- Budget-aware recommendations (low/medium/high/unlimited)
- Meta comparison and trends
Build Calculator
- Accurate DPS calculations with all modifiers
- Defense analysis (EHP, mitigation, avoidance)
- Damage breakdown by type
- Skill interaction calculations
- Curse and aura effectiveness
Web Interface
- Character import via account/character name
- Visual passive tree with optimization highlights
- Gear slot recommendations with trade links
- Build sharing and saving
- Real-time calculation updates
Path of Building Integration
- Import PoB build codes
- Export optimized builds to PoB format
- Sync with PoB's calculation engine
- Support for PoB Community Fork features
Quick Start
Prerequisites
- Python 3.9+
- Node.js 18+ (for web interface)
- Git
Installation
# Clone the repository
cd ClaudesPathOfExile2EnhancementService
# Install Python dependencies
pip install -r requirements.txt
# Install Node dependencies for web interface
cd web
npm install
cd ..
# Initialize the database
python scripts/init_database.py
# Seed with game data from poe2db.tw
python scripts/seed_game_data.py
# Set up trade API authentication (required for item search)
pip install playwright
playwright install chromium
python scripts/setup_trade_auth.py
Running the Server
# Start the MCP server
python src/mcp_server.py
# In a separate terminal, start the web interface
cd web
npm run dev
Access the web interface at http://localhost:3000
Trade API Authentication
The MCP server can search the official Path of Exile trade site to recommend gear upgrades. This requires authentication to prevent bot abuse.
Automated Setup (Recommended - 2 Minutes)
# Install Playwright (one-time setup)
pip install playwright
playwright install chromium
# Run the authentication helper
python scripts/setup_trade_auth.py
What happens:
- Browser opens to pathofexile.com/trade
- You log in with your account (supports 2FA)
- Script automatically detects login and extracts your session cookie
- Cookie is saved to
.envfile - Done! Trade search now works
See TRADE_AUTH_SETUP_GUIDE.md for:
- Detailed step-by-step guide
- Troubleshooting common issues
- Security information
- Cookie expiration details
Manual Setup (Fallback)
If the automated method doesn't work:
- Visit https://www.pathofexile.com/trade in your browser
- Log in to your account
- Press F12 to open DevTools
- Go to Application → Cookies → pathofexile.com
- Find the
POESESSIDcookie - Copy its value (32-character string)
- Add to your
.envfile:POESESSID=your_cookie_value_here
Usage
Via Web Interface
- Navigate to
http://localhost:3000 - Enter your account name and character name
- Click "Analyze Character"
- Review recommendations and optimization suggestions
Via MCP Protocol
from mcp_client import PoE2MCPClient
async with PoE2MCPClient() as client:
# Analyze character
analysis = await client.analyze_character(
account="YourAccount",
character="YourCharacter"
)
# Get natural language recommendations
response = await client.query(
"How can I improve my boss damage while staying tanky?"
)
print(response)
Via Command Line
# Quick character analysis
python cli.py analyze --account YourAccount --character YourCharacter
# Natural language query
python cli.py query "What gear upgrades should I prioritize?"
# Build comparison
python cli.py compare build1.json build2.json
# Export to Path of Building
python cli.py export --account YourAccount --character YourCharacter --output build.pob
Architecture
Core Components
src/
├── mcp_server.py # Main MCP server
├── api/
│ ├── poe_api.py # Official PoE API client
│ ├── poe2db_scraper.py # poe2db.tw data scraper
│ ├── rate_limiter.py # API rate limiting
│ └── cache_manager.py # Multi-tier caching
├── database/
│ ├── models.py # SQLAlchemy models
│ ├── manager.py # Database manager
│ └── migrations/ # Alembic migrations
├── calculator/
│ ├── damage_calc.py # DPS calculations
│ ├── defense_calc.py # Defense calculations
│ ├── modifier_calc.py # Modifier calculations
│ └── build_scorer.py # Build quality scoring
├── optimizer/
│ ├── gear_optimizer.py # Gear optimization
│ ├── passive_optimizer.py # Passive tree optimization
│ ├── skill_optimizer.py # Skill setup optimization
│ └── trade_advisor.py # Trade recommendations
├── ai/
│ ├── query_handler.py # Natural language processing
│ ├── recommendation_engine.py # AI recommendations
│ └── context_manager.py # Conversation context
└── pob/
├── importer.py # PoB import
├── exporter.py # PoB export
└── xml_parser.py # PoB XML handling
Web Interface
web/
├── src/
│ ├── components/
│ │ ├── CharacterImporter.tsx
│ │ ├── PassiveTree.tsx
│ │ ├── GearRecommendations.tsx
│ │ ├── BuildComparison.tsx
│ │ └── NLQueryInterface.tsx
│ ├── api/
│ │ └── client.ts # API client
│ ├── state/
│ │ └── store.ts # State management
│ └── utils/
│ └── calculations.ts # Client-side calcs
├── public/
│ └── assets/ # Static assets
└── package.json
Database Schema
Core Tables
- items: All item bases and types
- modifiers: Item modifiers and their values
- passive_nodes: Passive tree nodes
- passive_connections: Tree node connections
- skills: Skill gems data
- supports: Support gem data
- uniques: Unique item data
- ascendancies: Ascendancy classes
- crafting: Crafting bench recipes
User Tables
- saved_builds: User-saved builds
- build_snapshots: Historical build versions
- optimization_history: Past optimizations
API Integration
Official PoE API
- Character data retrieval
- Account information
- Ladder rankings (with rate limiting)
- Stash tab data (optional)
Rate Limiting Strategy
# Configurable rate limits
RATE_LIMITS = {
'official_api': {
'requests_per_minute': 10,
'burst': 3,
'backoff': 'exponential'
},
'poe2db': {
'requests_per_minute': 30,
'cache_duration': 3600 # 1 hour
}
}
Caching Strategy
- L1 Cache: In-memory (5 minutes)
- L2 Cache: Redis (1 hour)
- L3 Cache: SQLite (persistent)
AI Integration
Natural Language Queries
# Example queries
queries = [
"How can I increase my lightning damage?",
"What's the best chest armor for my budget?",
"Should I respec for more defense?",
"Which passive nodes give the most DPS?",
"How do I transition to CI?",
"What uniques work well with my build?"
]
Context-Aware Responses
The AI maintains context about:
- Current character state
- Previous questions
- Build goals
- Budget constraints
- Playstyle preferences
Development
Running Tests
# Run all tests
pytest
# Run specific test suite
pytest tests/test_calculator.py
# Run with coverage
pytest --cov=src tests/
Code Quality
# Format code
black src/ tests/
# Lint
flake8 src/ tests/
# Type checking
mypy src/
Database Migrations
# Create migration
alembic revision --autogenerate -m "description"
# Apply migrations
alembic upgrade head
# Rollback
alembic downgrade -1
Configuration
Configuration is managed via environment variables and config.yaml:
# config.yaml
server:
host: 127.0.0.1
port: 8080
workers: 4
database:
url: sqlite:///data/poe2_optimizer.db
pool_size: 10
api:
poe_api_rate_limit: 10
poe2db_rate_limit: 30
enable_caching: true
ai:
provider: anthropic # or openai
model: claude-sonnet-4-20250514
max_tokens: 4096
temperature: 0.7
web:
port: 3000
enable_build_sharing: true
max_saved_builds_per_user: 50
features:
enable_trade_integration: true
enable_pob_export: true
enable_ai_insights: true
Security & Privacy
- No Credential Storage: Uses OAuth flow for PoE account access
- Local-First: All character data cached locally
- Optional Cloud Sync: Encrypted cloud backup (opt-in)
- Rate Limit Enforcement: Prevents API abuse
- Data Encryption: All saved builds encrypted at rest
Performance
- Sub-second Analysis: Most character analyses complete in <500ms
- Parallel Calculations: Multi-threaded build calculations
- Intelligent Caching: Reduces API calls by 90%+
- WebSocket Updates: Real-time updates without polling
- CDN Assets: Static assets served via CDN
Contributing
This is a personal project, but contributions are welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Roadmap
Phase 1 (Current)
- [x] MCP server foundation
- [x] Basic character analysis
- [x] Local database setup
- [x] API integration with rate limiting
Phase 2
- [ ] Build calculator engine
- [ ] Gear optimization
- [ ] Passive tree optimization
- [ ] Web interface MVP
Phase 3
- [ ] AI natural language queries
- [ ] Path of Building integration
- [ ] Trade integration
- [ ] Build sharing
Phase 4
- [ ] Advanced AI insights
- [ ] Meta trend analysis
- [ ] Build version tracking
- [ ] Mobile app
License
Private project for personal use.
Credits
Built with data from:
- poe2db.tw - Comprehensive PoE2 game data
- poe.ninja - Meta builds and economy data
- Path of Exile 2 by Grinding Gear Games
Built for the PoE2 community | Report Issues
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Neon Database
MCP server for interacting with Neon Management API and databases