MCP server for HYTOPIA SDK - Optimized for Claude Code development
Project description
HYTOPIA MCP - Knowledge Assistant for HYTOPIA SDK Development
A Model Context Protocol (MCP) server that provides intelligent knowledge assistance for HYTOPIA SDK game development. This MCP helps Claude Code understand the HYTOPIA SDK deeply without generating code, following the MCP philosophy of being a context provider.
Overview
HYTOPIA MCP is designed to help developers navigate the complex HYTOPIA SDK by providing:
- ๐ API Exploration - Browse and understand SDK classes, methods, and properties
- ๐ Pattern Analysis - Learn common patterns and best practices
- ๐ก Concept Explanation - Understand core HYTOPIA concepts and architecture
- ๐ Documentation Access - Search and retrieve SDK documentation
- ๐ Unified Search - Find information across all resources
- ๐ฆ Example Analysis - Study SDK examples and their implementations
Philosophy
This MCP follows the principle: "Teach Claude Code how to fish, don't give it fish"
Instead of generating code, it provides:
- Understanding of SDK structure and patterns
- Knowledge about best practices and common pitfalls
- Context about how different parts work together
- Guidance on implementation approaches
Installation
Prerequisites
- Python 3.10 or higher
- Claude Code (Terminal version)
Quick Install (No Download Required)
Option 1: Install from PyPI
# Install the package
pip install hytopia-mcp
# Add to Claude Code
claude mcp add hytopia hytopia-mcp
# Or with custom configuration
claude mcp add hytopia hytopia-mcp \
-e CACHE_DIR=~/.cache/hytopia-mcp \
-e SDK_AUTO_UPDATE=true \
-e DEBUG=false
Option 2: Install from GitHub
# Install directly from GitHub
pip install git+https://github.com/AnrokX/hytopia-mcp.git
# Add to Claude Code
claude mcp add hytopia hytopia-mcp
Option 3: Using pipx (Recommended for isolation)
# Install pipx if you don't have it
python -m pip install --user pipx
python -m pipx ensurepath
# Install hytopia-mcp
pipx install hytopia-mcp
# Add to Claude Code
claude mcp add hytopia hytopia-mcp
Development Setup (Clone Repository)
- Clone the repository:
git clone https://github.com/AnrokX/hytopia-mcp.git
cd hytopia-mcp
- Run the setup script:
./setup-claude-code.sh
Or manually:
pip install -e .
cp .env.example .env # Optional: customize settings
- Add to Claude Code:
Option A: Using Claude CLI (Recommended)
# Add the MCP server to Claude Code
claude mcp add hytopia python -m hytopia_mcp.server
# Or with custom Python path
claude mcp add hytopia /usr/bin/python3 -m hytopia_mcp.server
# Or with environment variables
claude mcp add hytopia python -m hytopia_mcp.server \
-e CACHE_DIR=~/.cache/hytopia-mcp \
-e SDK_AUTO_UPDATE=true
Option B: Project-specific configuration
Create .mcp.json in your project root:
{
"mcpServers": {
"hytopia": {
"type": "stdio",
"command": "python",
"args": ["-m", "hytopia_mcp.server"],
"env": {
"PYTHONPATH": "/path/to/hytopia-mcp"
}
}
}
}
Option C: Global configuration
Edit ~/.claude.json and add under mcpServers:
{
"mcpServers": {
"hytopia": {
"type": "stdio",
"command": "python",
"args": ["-m", "hytopia_mcp.server"],
"env": {
"PYTHONPATH": "/path/to/hytopia-mcp"
}
}
}
}
- Verify installation:
# List configured MCP servers
claude mcp list
# Check MCP status in Claude Code
/mcp
Configuration
Environment Variables
The HYTOPIA MCP can be configured using environment variables. When installed via pip, you can:
- Pass variables directly to Claude Code:
claude mcp add hytopia hytopia-mcp \
-e CACHE_DIR=~/.cache/hytopia-mcp \
-e SDK_AUTO_UPDATE=true \
-e DEBUG=false
- Create a global configuration file:
Create
~/.hytopia-mcp.env:
# Cache Configuration
CACHE_DIR=~/.cache/hytopia-mcp
CACHE_MAX_SIZE_MB=500
CACHE_TTL_HOURS=24
# SDK Configuration
SDK_AUTO_UPDATE=false
SDK_UPDATE_CHECK_INTERVAL_HOURS=6
# Development
DEBUG=false
LOG_LEVEL=info
- Get help with configuration:
# Show setup instructions
hytopia-mcp help
# Check version
hytopia-mcp --version
Available Settings
See .env.example for all available configuration options:
- Cache: Directory, size limits, TTL
- SDK Updates: Auto-update, check intervals
- Performance: Search limits, caching behavior
- Development: Debug mode, logging
Available Tools
API Navigation
hytopia_list_modules- Browse SDK modules by categoryhytopia_explore_class- Deep dive into specific classeshytopia_get_methods- List and filter class methodshytopia_get_method_details- Get detailed method informationhytopia_get_properties- List class propertieshytopia_get_interfaces- Browse available interfaceshytopia_get_enums- List enums and their values
Pattern Analysis
hytopia_entity_patterns- Learn entity implementation patternshytopia_controller_patterns- Understand controller patternshytopia_world_patterns- World setup and management patternshytopia_game_patterns- Common game implementation patternshytopia_ui_patterns- UI implementation strategieshytopia_best_practices- Best practices for various topicshytopia_common_pitfalls- Avoid common mistakes
Concept Explanation
hytopia_explain_concept- Understand core concepts (server-authoritative, entity-system, etc.)hytopia_explain_architecture- Learn about architectural componentshytopia_explain_lifecycle- Understand various lifecycleshytopia_compare_approaches- Compare implementation approaches
Example Analysis
hytopia_find_example_patterns- Find examples by patternhytopia_analyze_example- Analyze specific exampleshytopia_list_examples_by_topic- Browse examples by categoryhytopia_get_example_structure- Understand example organization
Documentation
hytopia_get_guide- Access specific guideshytopia_search_docs- Search documentationhytopia_get_tutorial- Get step-by-step tutorialshytopia_get_api_docs- API reference documentationhytopia_get_best_practices- Topic-specific best practices
Search
hytopia_search_all- Search across all resourceshytopia_find_related- Find related itemshytopia_search_by_use_case- Search by what you want to accomplish
SDK Management
hytopia_check_updates- Check for SDK updateshytopia_update_sdk- Update local SDK cachehytopia_get_changelog- View recent changeshytopia_sdk_status- Check cache and system status
Usage Examples
Getting Started
User: How do I create an NPC in HYTOPIA?
Claude will use:
1. hytopia_explain_concept("entity-system")
2. hytopia_entity_patterns("npc")
3. hytopia_find_example_patterns("npc")
4. hytopia_explore_class("ModelEntity")
Then provide a comprehensive explanation of NPC creation patterns.
Understanding Concepts
User: Explain server-authoritative architecture
Claude will use:
1. hytopia_explain_concept("server-authoritative")
2. hytopia_find_related("concept", "server-authoritative")
3. hytopia_best_practices("networking")
Then explain the concept with context and implications.
Finding Examples
User: Show me physics examples
Claude will use:
1. hytopia_find_example_patterns("physics")
2. hytopia_analyze_example("physics-basic")
3. hytopia_controller_patterns("physics")
Then explain the physics patterns found in examples.
Architecture
hytopia-mcp/
โโโ hytopia_mcp/
โ โโโ server.py # Main MCP server
โ โโโ tools/ # Knowledge tools
โ โ โโโ api_explorer.py
โ โ โโโ pattern_analyzer.py
โ โ โโโ concept_explainer.py
โ โ โโโ example_analyzer.py
โ โ โโโ documentation.py
โ โ โโโ search_tools.py
โ โ โโโ sdk_updater.py
โ โโโ resources/ # Static resources
โ โ โโโ api_resources.py
โ โโโ utils/ # Helper utilities
โ โโโ cache_manager.py
โ โโโ sdk_analyzer.py
Key Features
๐ง Knowledge-First Approach
- Provides understanding, not code generation
- Explains patterns and best practices
- Teaches concepts and architecture
๐ Performance Optimized
- Local caching for fast responses
- Efficient search algorithms
- Minimal network requests
๐ Comprehensive Coverage
- Complete API exploration
- Pattern documentation
- Concept explanations
- Example analysis
๐ Always Up-to-Date
- SDK update checking
- Cache refresh capabilities
- Version tracking
Scripts
Setup Scripts
./setup-claude-code.sh- Automated setup for Claude Code./run-mcp-server.sh- Run the MCP server directly (for testing)./uninstall-claude-code.sh- Remove from Claude Code
Managing the MCP
# Check if installed
claude mcp list
# Remove from Claude Code
claude mcp remove hytopia
# Re-add with different settings
claude mcp add hytopia python -m hytopia_mcp.server \
-e SDK_AUTO_UPDATE=false \
-e CACHE_DIR=/custom/cache/path
Development
Running Locally
# Using the helper script
./run-mcp-server.sh
# Or directly
python -m hytopia_mcp.server
Running Tests
pytest tests/
Adding New Tools
- Create new tool file in
hytopia_mcp/tools/ - Register tools using
@mcp.tool()decorator - Import in
server.py - Document in README
Troubleshooting
MCP Not Appearing in Claude Code
- Run
claude mcp listto check if configured - Check MCP status with
/mcpcommand in Claude Code - Ensure Python is in PATH:
which python - Try with full Python path:
claude mcp add hytopia /usr/bin/python3 -m hytopia_mcp.server
Common Issues
"Module not found" error
- Ensure PYTHONPATH includes the project directory
- Use the setup script which handles this automatically
- Or manually:
claude mcp add hytopia python -m hytopia_mcp.server -e PYTHONPATH=/path/to/hytopia-mcp
MCP server fails to start
- Check Python version:
python --version(needs 3.10+) - Install dependencies:
pip install -e . - Check logs: Run
./run-mcp-server.shto see errors
Permission denied
- Make scripts executable:
chmod +x *.sh - Use
pip install --user -e .if pip install fails
Cache Issues
- Clear cache: Delete
~/.cache/hytopia-mcp/ - Force update: Use
hytopia_update_sdk(force=True) - Check cache status:
hytopia_sdk_status
Performance Issues
- Disable cache preloading in .env:
CACHE_PRELOAD=false - Reduce cache size:
CACHE_MAX_SIZE_MB=200 - Check memory usage with
hytopia_sdk_status
Contributing
- Fork the repository
- Create feature branch
- Follow knowledge-first philosophy
- Add tests for new features
- Submit pull request
License
MIT License - See LICENSE file for details
Acknowledgments
- HYTOPIA team for the amazing SDK
- Anthropic for the MCP specification
- FastMCP for the excellent framework
Support
- GitHub Issues: [Report bugs or request features]
- Documentation: HYTOPIA Docs
- Community: [HYTOPIA Discord]
Built with โค๏ธ for the HYTOPIA developer community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hytopia_mcp-1.0.1.tar.gz.
File metadata
- Download URL: hytopia_mcp-1.0.1.tar.gz
- Upload date:
- Size: 57.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72343b2afcd872b6ef195a22c0834d96c2c7586346b5040637c383330d4c50e5
|
|
| MD5 |
e4c91f9ba8fc8aa109f9d699676abc9f
|
|
| BLAKE2b-256 |
0899c8e51173dcfd635d46d9be703bbdbaed4e8ddd7249a56e5843c84d7279b6
|
File details
Details for the file hytopia_mcp-1.0.1-py3-none-any.whl.
File metadata
- Download URL: hytopia_mcp-1.0.1-py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd30b7c85facfad10e767767c93d52b1acd31927720190e2a3229485c5d6bdb
|
|
| MD5 |
eb22bcfa7ec8b477b4f1b0e898f3501e
|
|
| BLAKE2b-256 |
d97fdfd4dc538a03442dc8206eef92fe20bac2eb82d2e55255a01073e4abc42c
|