MCPy is a high-performance Minecraft server engine based on Python and Cython. It integrates scientific computing libraries and advanced optimization techniques, aiming to provide excellent performance and scalability. The project is currently in the development stage and includes core modules such as the server engine, world generation, network processing, entity system, and data persistence.
2 points
10.4K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

๐Ÿš€ MCPy: High-Performance Minecraft Server Engine

MCPy is a next - generation, ultra - optimized Minecraft server engine. It is powered by Python, Cython, and advanced scientific computing libraries. It aims to deliver exceptional performance and flexibility, making Minecraft server development accessible and future - proof.

License: MIT Python 3.9+ Cython

โš ๏ธ Important Note

MCPy is under active development and is not yet feature - complete. The codebase contains known errors and is unstable. We welcome your bug reports and contributions to help us reach our goals faster!

๐Ÿš€ Quick Start

To quickly start using MCPy, you can follow the installation steps and running commands provided below.

โœจ Features

  • Cython - Accelerated Core: An event - driven server engine approaching C - level performance.
  • Scientific Computing Backbone: Integrates NumPy, SciPy, and Polars for high - efficiency operations.
  • Zero - Overhead Networking: Asynchronous, non - blocking, protocol - optimized networking.
  • Sophisticated Entity System: Efficient, extensible entity management with advanced AI support.
  • Robust Persistence Layer: Powered by PostgreSQL and SQLAlchemy ORM for reliable data storage.
  • Comprehensive Benchmarking: Built - in performance analytics and profiling tools.
  • Extensible Plugin Framework: Easily add server modifications.
  • Real - Time Monitoring: Prometheus & Grafana integration for live metrics.

๐Ÿ“ฆ Installation

Prerequisites

Property Details
Python 3.9+ (3.11+ recommended)
C++ Compiler Modern C++ compiler (VS 2019+ / GCC 9+)
Database PostgreSQL 13+ (for production)
Memory Minimum 8 GB RAM (16 GB recommended)

Quick Setup

git clone https://github.com/magi8101/mcpy.git
cd mcpy
# Windows
setup.bat
# Linux/macOS
chmod +x setup.sh
./setup.sh

Manual Installation

git clone https://github.com/magi8101/mcpy.git
cd mcpy
python -m venv .venv
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate
pip install -r _requirements.txt
pip install -e ".[dev]"
pip install -e ".[ai]"  # Optional: Enable AI features
python check_dependencies.py
python setup.py build_ext --inplace

๐Ÿ’ป Usage Examples

Basic Usage

# Using setup scripts
# Windows:
setup.bat run
# Linux/macOS:
./setup.sh run

# Directly from the command line
python -m mcpy.server
python -m mcpy.server --config custom_config.toml --world my_world
python -m mcpy.server --performance-mode --max-players 100
python -m mcpy.server --debug --log-level debug

Advanced Usage

Here are some advanced usage examples with command - line options:

Option Description
--config PATH Path to TOML config file
--world PATH World directory
--port NUMBER Network port (default: 25565)
--max-players NUMBER Max players (default: 20)
--view-distance NUMBER Chunk view distance (default: 10)
--performance-mode Extra performance optimizations
--debug Enable debug mode
--log-level LEVEL Set log level (default: info)
--backup Enable automatic backups

๐Ÿ“š Documentation

Architecture Overview

MCPy is modular, with five high - performance core components:

  1. server_core.pyx

    • Event - driven request handling
    • Adaptive, high - precision tick system
    • Dynamic worker thread pool management
    • Real - time performance profiling
  2. world_engine.pyx

    • Procedural terrain generation with multi - octave noise and advanced biomes
    • Multi - threaded chunk generation & memory - efficient terrain storage
  3. network_core.pyx

    • Zero - copy packet serialization and protocol - level compression
    • Robust connection pooling & DDoS mitigation
  4. entity_system.pyx

    • Spatial hash - based entity tracking and multi - threaded physics
    • Modular AI behavior trees
  5. persistence

    • SQLAlchemy ORM for PostgreSQL/SQLite
    • Efficient chunk serialization and transactional world state

Performance Goals

Metric Target Value
Scalability 20 TPS with 100+ concurrent players
Memory Usage <2 GB for 10,000 chunks
Latency <50 ms per player action
Reliability 100% test coverage for core modules
Throughput 10,000+ entity updates per tick

Database Configuration

SQLite (Default)

[database]
type = "sqlite"
path = "world/mcpy.db"
journal_mode = "WAL"
synchronous = "NORMAL"

PostgreSQL (Production)

[database]
type = "postgresql"
host = "localhost"
port = 5432
dbname = "mcpy"
user = "postgres"
password = "your_password"
pool_size = 10
max_overflow = 20
echo = false

Persistence Features

  • Transactional World Saving
with session.begin():
    for chunk in dirty_chunks:
        session.add(ChunkModel.from_chunk(chunk))
  • Efficient Chunk Serialization
chunk_data = np.savez_compressed(io_buffer,
                                blocks=chunk.blocks,
                                heightmap=chunk.heightmap,
                                biomes=chunk.biomes)
  • Player Data Management
player_model = PlayerModel(
    uuid=player.uuid,
    username=player.username,
    position=json.dumps([player.x, player.y, player.z]),
    inventory=pickle.dumps(player.inventory, protocol=5),
    stats=json.dumps(player.stats)
)
  • Intelligent Auto - saving: Only modified chunks/entities are saved
  • Automated Backups: Configurable intervals & retention

Development & Testing

pytest                                # Run full test suite
pytest tests/test_entity_system.py     # Entity system tests
python -m benchmarks.benchmark        # Benchmarks
python -m mcpy.profiling.profile_module world_engine  # Profile module
pytest --cov=mcpy --cov-report=html   # Test coverage report

Performance Tuning Examples

Entity System

entity_spatial_hash = {(int(e.x/16), int(e.z/16)): [] for e in entities}
for entity in entities:
    entity_spatial_hash[(int(entity.x/16), int(entity.z/16))].append(entity)

World Engine

with ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
    futures = [executor.submit(generate_chunk, x, z) for x, z in chunk_coords]
    chunks = [f.result() for f in futures]

Network Optimization

cdef char* buffer = <char*>malloc(packet_size)
memcpy(buffer, &packet_header, sizeof(packet_header))
memcpy(buffer + sizeof(packet_header), packet_data, packet_data_size)

Advanced Features

Plugin System

from mcpy.plugins import Plugin, event

class TeleportPlugin(Plugin):
    @event("player.command")
    def on_command(self, player, command, args):
        if command == "tp" and len(args) >= 1:
            target = self.server.get_player_by_name(args[0])
            if target:
                player.teleport(target.x, target.y, target.z)
                return True
        return False

Real - Time Monitoring

[monitoring]
enabled = true
prometheus_port = 9090
metrics = ["tps", "memory_usage", "players_online", "chunks_loaded"]

AI Entity Behaviors

class ZombieAI(MobAI):
    def setup_behaviors(self):
        self.behaviors = BehaviorTree(
            Selector([
                Sequence([
                    CheckPlayerNearby(radius=16),
                    PathfindToPlayer(),
                    AttackPlayer()
                ]),
                Sequence([
                    Wait(random.randint(20, 100)),
                    MoveToRandomPosition(radius=10)
                ])
            ])
        )

Roadmap

Short - Term

  • [ ] Entity collision system
  • [ ] Crafting & inventory management
  • [ ] Basic combat mechanics
  • [ ] World generation optimization

Medium - Term

  • [ ] Multi - world support & portals
  • [ ] Custom block behaviors
  • [ ] Enhanced mob AI
  • [ ] In - game scripting API

Long - Term

  • [ ] Distributed server architecture
  • [ ] Machine learning - driven mob AI
  • [ ] Real - time ray - traced lighting
  • [ ] Custom physics engine

๐Ÿ”ง Technical Details

Cython & Performance

  • Static typing (cdef) and aggressive compiler directives
  • Direct NumPy buffer access and pointer arithmetic
  • Multi - threaded parallelism via thread pools

Entity System

  • Hierarchical, component - based design
  • O(1) spatial partitioning via custom memory pools
  • Adaptive Level - of - Detail (LOD) entity management

World Generation

  • Multi - octave Perlin/Simplex noise
  • Voronoi - based biome transitions
  • Erosion, cave, and structure algorithms
  • 10x chunk compression for storage efficiency

๐Ÿค Contributing

We welcome your contributions! Please see our Contributing Guide to get started:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing - feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to your branch (git push origin feature/amazing - feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

Alternatives

V
Vestige
Vestige is an AI memory engine based on cognitive science. By implementing 29 neuroscience modules such as prediction error gating, FSRS - 6 spaced repetition, and memory dreaming, it provides long - term memory capabilities for AI. It includes a 3D visualization dashboard and 21 MCP tools, runs completely locally, and does not require the cloud.
Rust
10.5K
4.5 points
M
Moltbrain
MoltBrain is a long-term memory layer plugin designed for OpenClaw, MoltBook, and Claude Code, capable of automatically learning and recalling project context, providing intelligent search, observation recording, analysis statistics, and persistent storage functions.
TypeScript
10.1K
4.5 points
B
Bm.md
A feature-rich Markdown typesetting tool that supports multiple style themes and platform adaptation, providing real-time editing preview, image export, and API integration capabilities
TypeScript
15.9K
5 points
S
Security Detections MCP
Security Detections MCP is a server based on the Model Context Protocol that allows LLMs to query a unified security detection rule database covering Sigma, Splunk ESCU, Elastic, and KQL formats. The latest version 3.0 is upgraded to an autonomous detection engineering platform that can automatically extract TTPs from threat intelligence, analyze coverage gaps, generate SIEM-native format detection rules, run tests, and verify. The project includes over 71 tools, 11 pre-built workflow prompts, and a knowledge graph system, supporting multiple SIEM platforms.
TypeScript
6.7K
4 points
P
Paperbanana
Python
8.9K
5 points
B
Better Icons
An MCP server and CLI tool that provides search and retrieval of over 200,000 icons, supports more than 150 icon libraries, and helps AI assistants and developers quickly obtain and use icons.
TypeScript
8.7K
4.5 points
A
Assistant Ui
assistant - ui is an open - source TypeScript/React library for quickly building production - grade AI chat interfaces, providing composable UI components, streaming responses, accessibility, etc., and supporting multiple AI backends and models.
TypeScript
10.0K
5 points
A
Apify MCP Server
The Apify MCP Server is a tool based on the Model Context Protocol (MCP) that allows AI assistants to extract data from websites such as social media, search engines, and e-commerce through thousands of ready-to-use crawlers, scrapers, and automation tools (Apify Actors). It supports OAuth and Skyfire proxy payment and can be integrated into MCP clients such as Claude and VS Code through HTTPS endpoints or local stdio.
TypeScript
8.9K
5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
38.1K
5 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
80.3K
4.3 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
28.5K
4.3 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
23.8K
4.5 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
37.4K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
70.7K
4.5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
24.0K
4.5 points
C
Context7
Context7 MCP is a service that provides real-time, version-specific documentation and code examples for AI programming assistants. It is directly integrated into prompts through the Model Context Protocol to solve the problem of LLMs using outdated information.
TypeScript
106.2K
4.7 points