Path of Exile 2 Build Optimizer MCP

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.

Category
访问服务器

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:

  1. Browser opens to pathofexile.com/trade
  2. You log in with your account (supports 2FA)
  3. Script automatically detects login and extracts your session cookie
  4. Cookie is saved to .env file
  5. 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:

  1. Visit https://www.pathofexile.com/trade in your browser
  2. Log in to your account
  3. Press F12 to open DevTools
  4. Go to Application → Cookies → pathofexile.com
  5. Find the POESESSID cookie
  6. Copy its value (32-character string)
  7. Add to your .env file: POESESSID=your_cookie_value_here

Usage

Via Web Interface

  1. Navigate to http://localhost:3000
  2. Enter your account name and character name
  3. Click "Analyze Character"
  4. 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

  1. L1 Cache: In-memory (5 minutes)
  2. L2 Cache: Redis (1 hour)
  3. 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!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. 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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选