Skip to main content

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 (Ready for Publishing)

# 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 git+https://github.com/AnrokX/hytopia-mcp.git

# Add to Claude Code
claude mcp add hytopia hytopia-mcp

Development Setup (Clone Repository)

  1. Clone the repository:
git clone https://github.com/AnrokX/hytopia-mcp.git
cd hytopia-mcp
  1. Run the setup script:
./setup-claude-code.sh

Or manually:

pip install -e .
cp .env.example .env  # Optional: customize settings
  1. 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"
      }
    }
  }
}
  1. 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:

  1. 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
  1. 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
  1. 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 category
  • hytopia_explore_class - Deep dive into specific classes
  • hytopia_get_methods - List and filter class methods
  • hytopia_get_method_details - Get detailed method information
  • hytopia_get_properties - List class properties
  • hytopia_get_interfaces - Browse available interfaces
  • hytopia_get_enums - List enums and their values

Pattern Analysis

  • hytopia_entity_patterns - Learn entity implementation patterns
  • hytopia_controller_patterns - Understand controller patterns
  • hytopia_world_patterns - World setup and management patterns
  • hytopia_game_patterns - Common game implementation patterns
  • hytopia_ui_patterns - UI implementation strategies
  • hytopia_best_practices - Best practices for various topics
  • hytopia_common_pitfalls - Avoid common mistakes

Concept Explanation

  • hytopia_explain_concept - Understand core concepts (server-authoritative, entity-system, etc.)
  • hytopia_explain_architecture - Learn about architectural components
  • hytopia_explain_lifecycle - Understand various lifecycles
  • hytopia_compare_approaches - Compare implementation approaches

Example Analysis

  • hytopia_find_example_patterns - Find examples by pattern
  • hytopia_analyze_example - Analyze specific examples
  • hytopia_list_examples_by_topic - Browse examples by category
  • hytopia_get_example_structure - Understand example organization

Documentation

  • hytopia_get_guide - Access specific guides
  • hytopia_search_docs - Search documentation
  • hytopia_get_tutorial - Get step-by-step tutorials
  • hytopia_get_api_docs - API reference documentation
  • hytopia_get_best_practices - Topic-specific best practices

Search

  • hytopia_search_all - Search across all resources
  • hytopia_find_related - Find related items
  • hytopia_search_by_use_case - Search by what you want to accomplish

SDK Management

  • hytopia_check_updates - Check for SDK updates
  • hytopia_update_sdk - Update local SDK cache
  • hytopia_get_changelog - View recent changes
  • hytopia_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

  1. Create new tool file in hytopia_mcp/tools/
  2. Register tools using @mcp.tool() decorator
  3. Import in server.py
  4. Document in README

Troubleshooting

MCP Not Appearing in Claude Code

  • Run claude mcp list to check if configured
  • Check MCP status with /mcp command 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.sh to 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

  1. Fork the repository
  2. Create feature branch
  3. Follow knowledge-first philosophy
  4. Add tests for new features
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hytopia_mcp-1.0.0.tar.gz (57.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hytopia_mcp-1.0.0-py3-none-any.whl (66.6 kB view details)

Uploaded Python 3

File details

Details for the file hytopia_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: hytopia_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hytopia_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f9fd0ee8e69468608ef96ff229b4de6aa0415e144d750f63ea131230079b93a
MD5 92eb37a34c9309316bcb0d827e756588
BLAKE2b-256 3095fbfb5f1716e12f9b87e1162e670e00e8ac99bcb7babba8707be778d40ea0

See more details on using hashes here.

File details

Details for the file hytopia_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hytopia_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 66.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hytopia_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c53560aba6ecfa03bd6d66f669f7e0577d8e944c4b075c53c4658ed008039f
MD5 3d78e97728141d6f6d6c7947dd8e2bf7
BLAKE2b-256 03ac107a90c8ed065e2a357c9505ce10d3bf3a290dacd9a4968b218d95ba76d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page