Poke MCP Production Server

Poke MCP Production Server

A production-ready Pokémon MCP server that enables users to get comprehensive Pokémon information and simulate realistic turn-based battles. Features enterprise-grade authentication, monitoring, rate limiting, and serverless deployment capabilities.

Category
访问服务器

README

Poke MCP Production Server

Deploy with Vercel

A production-ready Pokémon MCP (Model Context Protocol) server with enterprise features:

  • FastMCP with HTTP Transport - RESTful API access to MCP tools
  • 🔒 Authentication - API key-based security
  • 📈 Monitoring - Prometheus metrics and health checks
  • 📝 Structured Logging - JSON-formatted logs with structlog
  • Rate Limiting - Protect against abuse
  • 🚀 Vercel Deployment - Serverless deployment with continuous integration
  • 🔐 SSH Tunneling - Secure remote access configuration

Features

MCP Tools

  1. get_pokemon_info - Comprehensive Pokémon information

    • Base stats, types, abilities (with descriptions)
    • Moves with effects (first 10)
    • Full evolution chain
  2. simulate_battle - Realistic Pokémon battle simulation

    • Core battle mechanics (type effectiveness, status effects)
    • Turn-based combat with detailed battle log
    • Winner determination

Production Features

  • Authentication: Bearer token API key authentication
  • Rate Limiting: Configurable request limits per time window
  • Monitoring: Prometheus metrics for requests, latency, and tool calls
  • Logging: Structured JSON logs with request tracing
  • CORS: Configurable cross-origin resource sharing
  • Health Checks: /health endpoint for monitoring
  • Environment Configuration: Flexible environment-based settings

Quick Start

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip
  • Vercel account (for deployment)

Local Development

  1. Clone the repository
git clone https://github.com/patrickcarmichael/poke-mcp-production.git
cd poke-mcp-production
  1. Install dependencies
# Using uv (recommended)
uv sync

# Or using pip
pip install -r requirements.txt
  1. Configure environment
cp .env.example .env
# Edit .env with your settings
  1. Run the server
# For MCP stdio mode (local testing)
python server.py

# For HTTP mode (production)
uvicorn api.index:app --reload --host 0.0.0.0 --port 8000
  1. Test the server
# Health check
curl http://localhost:8000/health

# Protected endpoint (requires API key)
curl -H "Authorization: Bearer your-api-key" http://localhost:8000/status

Deployment

See DEPLOYMENT.md for comprehensive deployment instructions including:

  • Vercel deployment
  • Environment variable configuration
  • SSH tunnel setup for remote access
  • Continuous deployment setup
  • Production monitoring

Configuration

All configuration is managed through environment variables. See .env.example for all available options.

Key Configuration Options

Variable Description Default
API_KEY Authentication key (required)
ALLOWED_ORIGINS CORS allowed origins http://localhost:*
LOG_LEVEL Logging level INFO
RATE_LIMIT_REQUESTS Max requests per window 100
RATE_LIMIT_WINDOW Time window in seconds 60
ENABLE_METRICS Enable Prometheus metrics true

API Endpoints

Public Endpoints

  • GET / - Server information
  • GET /health - Health check
  • GET /metrics - Prometheus metrics (if enabled)

Protected Endpoints (Require API Key)

  • POST /mcp - MCP tool execution endpoint
  • GET /status - Detailed server status

Authentication

All protected endpoints require a Bearer token:

curl -H "Authorization: Bearer YOUR_API_KEY" https://your-server.vercel.app/status

Monitoring

Prometheus Metrics

The server exposes Prometheus-compatible metrics at /metrics:

  • http_requests_total - Total HTTP requests by method, endpoint, and status
  • http_request_duration_seconds - Request latency histogram
  • mcp_tool_calls_total - MCP tool invocations by tool name and status
  • mcp_tool_duration_seconds - Tool execution duration
  • pokeapi_requests_total - PokeAPI requests by endpoint and status
  • active_connections - Current active connections

Logging

Structured JSON logs include:

  • Request/response details
  • Tool execution tracking
  • Error tracking with stack traces
  • Performance metrics

SSH Tunneling for Remote Access

See SSH_TUNNELING.md for detailed instructions on:

  • Setting up SSH tunnels to access your deployed server
  • Configuring Claude Desktop and other MCP clients
  • Security best practices
  • Troubleshooting

Architecture

poke-mcp-production/
├── api/
│   └── index.py          # Vercel serverless handler
├── src/
│   ├── __init__.py
│   ├── auth.py           # Authentication logic
│   ├── battle_utils.py   # Battle simulation utilities
│   ├── config.py         # Configuration management
│   ├── constants.py      # Type effectiveness, constants
│   ├── logger.py         # Structured logging setup
│   ├── middleware.py     # CORS, rate limiting, logging
│   ├── monitoring.py     # Prometheus metrics
│   └── pokeapi_client.py # PokeAPI integration
├── server.py            # Main MCP server (stdio mode)
├── vercel.json          # Vercel configuration
├── pyproject.toml       # Project metadata
├── requirements.txt     # Python dependencies
└── .env.example         # Environment template

Development

Testing

# Install dev dependencies
uv sync --extra dev

# Run tests (when implemented)
pytest

# Code formatting
black .

# Linting
ruff check .

# Type checking
mypy src/

Adding New Tools

  1. Add tool function to server.py:
@mcp.tool()
async def my_new_tool(param: str) -> Dict[str, Any]:
    """Tool description."""
    # Implementation
    return {"result": "data"}
  1. Add monitoring and logging as needed
  2. Update documentation

Security Considerations

  1. API Keys: Always use strong, randomly generated API keys
  2. CORS: Configure ALLOWED_ORIGINS for production
  3. Rate Limiting: Adjust limits based on expected usage
  4. HTTPS: Always use HTTPS in production (Vercel provides this)
  5. SSH Tunnels: Use key-based authentication, not passwords
  6. Secrets: Never commit .env files or secrets to git

Troubleshooting

Server Won't Start

  • Check Python version: python --version (must be 3.11+)
  • Verify all dependencies are installed
  • Check .env file configuration

Authentication Failures

  • Verify API key is set in environment
  • Check Authorization header format: Bearer YOUR_KEY
  • Ensure CORS settings allow your origin

Rate Limiting Issues

  • Adjust RATE_LIMIT_REQUESTS and RATE_LIMIT_WINDOW
  • Check client IP address handling
  • Review logs for rate limit events

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Acknowledgments

Support

For issues, questions, or contributions:

Roadmap

  • [ ] Full MCP protocol integration in Vercel endpoint
  • [ ] WebSocket support for real-time updates
  • [ ] Caching layer for PokeAPI responses
  • [ ] Additional battle mechanics
  • [ ] Team management tools
  • [ ] Database integration for persistent data
  • [ ] GraphQL API option
  • [ ] Docker deployment option

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选