Discover Awesome MCP Servers

Extend your agent with 24,100 capabilities via MCP servers.

All24,100
template-mcp-server

template-mcp-server

Okay, here's a PDM template structure and some key considerations for developing an MCP (Minecraft Protocol) server in Python, along with explanations to help you understand the choices: **Project Structure (using PDM):** ``` my_mcp_server/ ├── pyproject.toml # PDM configuration file ├── src/ │ └── my_mcp_server/ # Your actual server code │ ├── __init__.py │ ├── server.py # Main server logic │ ├── protocol/ # Handles Minecraft protocol │ │ ├── __init__.py │ │ ├── packets.py # Packet definitions (classes) │ │ ├── serialization.py # Packet serialization/deserialization │ │ ├── handshake.py # Handshake logic │ │ ├── status.py # Status ping logic │ │ ├── login.py # Login logic │ │ └── ... │ ├── player/ # Player-related logic │ │ ├── __init__.py │ │ ├── player.py # Player class │ │ ├── inventory.py # Inventory management │ │ └── ... │ ├── world/ # World generation and management │ │ ├── __init__.py │ │ ├── world.py # World class │ │ ├── chunk.py # Chunk management │ │ ├── generator.py # World generation algorithms │ │ └── ... │ ├── commands/ # Command handling │ │ ├── __init__.py │ │ ├── command_handler.py │ │ ├── ... │ ├── config.py # Configuration loading │ ├── logging_setup.py # Logging configuration │ └── ... ├── tests/ # Unit tests │ ├── __init__.py │ ├── test_server.py │ ├── test_protocol.py │ └── ... ├── README.md ├── .gitignore └── LICENSE ``` **Explanation of the Structure:** * **`my_mcp_server/` (Root Directory):** The top-level directory for your project. * **`pyproject.toml`:** This is the heart of your PDM project. It defines your project's metadata (name, version, authors), dependencies, and build system configuration. * **`src/my_mcp_server/`:** This is where your actual Python code lives. Using `src/` is a common practice to separate your source code from other project files (like tests, documentation, etc.). The inner `my_mcp_server/` creates a Python package. * **`server.py`:** This file will contain the main server loop, socket handling, and the entry point for your application. * **`protocol/`:** This is a crucial directory. It's responsible for handling the Minecraft protocol itself. * **`packets.py`:** Defines Python classes that represent Minecraft packets. Each packet type (e.g., `HandshakePacket`, `LoginStartPacket`, `ChatMessagePacket`) will have its own class. These classes will hold the data for the packet. * **`serialization.py`:** Handles the conversion of Python packet objects into byte streams (for sending over the network) and byte streams into Python packet objects (for receiving). This is where you'll implement the Minecraft protocol's data types (varints, strings, etc.). * **`handshake.py`, `status.py`, `login.py`:** These modules handle the specific stages of the Minecraft connection process. The handshake determines the protocol version, the status stage provides server information to the client, and the login stage authenticates the player. * **`player/`:** Manages player-related data and logic. * **`player.py`:** Defines the `Player` class, which will hold information about each connected player (username, UUID, position, health, inventory, etc.). * **`inventory.py`:** Handles the player's inventory. * **`world/`:** Deals with world generation and management. * **`world.py`:** Represents the game world. * **`chunk.py`:** Handles the storage and management of world chunks (16x16x256 blocks). * **`generator.py`:** Contains algorithms for generating the world (e.g., flat world, random terrain, etc.). * **`commands/`:** Handles server commands. * **`command_handler.py`:** Parses and executes commands entered by players or the server console. * **`config.py`:** Loads server configuration settings from a file (e.g., `server.properties`). * **`logging_setup.py`:** Configures the Python logging system for your server. Good logging is essential for debugging and monitoring. * **`tests/`:** Contains unit tests to ensure your code is working correctly. * **`README.md`:** A description of your project. * **`.gitignore`:** Specifies files and directories that should be ignored by Git (e.g., `.venv`, `__pycache__`). * **`LICENSE`:** The license under which your project is released. **`pyproject.toml` Example:** ```toml [project] name = "my_mcp_server" version = "0.1.0" description = "A Minecraft Protocol server in Python" authors = [ {name = "Your Name", email = "your.email@example.com"} ] license = {text = "MIT"} # Or choose another license readme = "README.md" requires-python = ">=3.8" keywords = ["minecraft", "server", "mcp"] classifiers = [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Operating System :: OS Independent", ] [project.dependencies] # Add your dependencies here. Examples: # asyncio = ">=3.4" # Already part of Python 3.7+ # aiohttp = ">=3.8" # For asynchronous HTTP requests (optional) # python-nbt = ">=1.5" # For reading/writing NBT data (world data) # pycryptodome = ">=3.11" # For encryption (optional, for online mode) # ... other dependencies ... [project.optional-dependencies] dev = [ "pytest", "pytest-asyncio", "mypy", "flake8", "black" ] [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" [tool.pdm] version = {source = "scm"} [tool.pdm.dev-dependencies] dev = ["pytest", "pytest-asyncio", "mypy", "flake8", "black"] [tool.pdm.scripts] start = "python src/my_mcp_server/server.py" test = "pytest" lint = "flake8 src/my_mcp_server" format = "black src/my_mcp_server" typecheck = "mypy src/my_mcp_server" ``` **Key Considerations and Code Snippets:** 1. **Asynchronous Programming (Crucial):** Minecraft servers are inherently concurrent. You *must* use asynchronous programming (using `asyncio` in Python) to handle multiple client connections efficiently. Blocking operations will kill your server's performance. ```python # Example (server.py): import asyncio async def handle_client(reader, writer): addr = writer.get_extra_info('peername') print(f"Connected by {addr}") try: while True: data = await reader.read(1024) # Read data asynchronously if not data: break message = data.decode() print(f"Received {message} from {addr}") writer.write(f"Echo: {message}".encode()) await writer.drain() # Ensure data is sent asynchronously except ConnectionResetError: print(f"Client {addr} disconnected abruptly.") finally: print(f"Closing connection for {addr}") writer.close() await writer.wait_closed() async def main(): server = await asyncio.start_server( handle_client, '127.0.0.1', 25565) # Standard Minecraft port addr = server.sockets[0].getsockname() print(f"Serving on {addr}") async with server: await server.serve_forever() if __name__ == "__main__": asyncio.run(main()) ``` 2. **Minecraft Protocol Implementation:** This is the most complex part. You'll need to meticulously implement the Minecraft protocol. Refer to the official Minecraft protocol documentation (search for "Minecraft Protocol" on the Minecraft Wiki or look at the wiki.vg site). Pay close attention to: * **VarInts/VarLongs:** Variable-length integers are used extensively in the protocol. You'll need functions to encode and decode them. * **Packet IDs:** Each packet type has a unique ID. * **Data Types:** Strings, integers, booleans, arrays, NBT data, etc. * **Packet Structure:** The order and types of data fields within each packet. * **Compression:** The protocol supports compression to reduce bandwidth usage. ```python # Example (protocol/packets.py): class Packet: packet_id = None # Abstract base class def serialize(self): raise NotImplementedError @classmethod def deserialize(cls, data): raise NotImplementedError class HandshakePacket(Packet): packet_id = 0x00 # Handshake packet ID def __init__(self, protocol_version, server_address, server_port, next_state): self.protocol_version = protocol_version self.server_address = server_address self.server_port = server_port self.next_state = next_state def serialize(self): # Implement serialization logic here (convert to bytes) pass @classmethod def deserialize(cls, data): # Implement deserialization logic here (convert from bytes to object) pass ``` 3. **NBT Data:** Minecraft uses the NBT (Named Binary Tag) format for storing world data, player data, and other game information. Use a library like `python-nbt` to read and write NBT data. 4. **World Generation:** Start with a simple world generator (e.g., a flat world) and gradually add more complex generation algorithms. 5. **Multiplayer Considerations:** Think about how you'll handle multiple players interacting with the world simultaneously. You'll need to implement thread-safe or process-safe data structures and synchronization mechanisms. Consider using a database (e.g., SQLite, PostgreSQL) to store world data and player data persistently. 6. **Security:** Implement proper security measures to prevent cheating and attacks. This includes: * **Authentication:** Verify player identities using the Minecraft authentication system (if you want online mode). * **Input Validation:** Validate all data received from clients to prevent exploits. * **Rate Limiting:** Limit the rate at which clients can send packets to prevent flooding. 7. **Configuration:** Use a configuration file (e.g., `server.properties`) to store server settings like port number, maximum players, world name, etc. The `config.py` module should handle loading these settings. 8. **Logging:** Use the Python `logging` module to log important events and errors. This will help you debug and monitor your server. 9. **Testing:** Write unit tests to ensure your code is working correctly. Use a testing framework like `pytest`. **How to use PDM:** 1. **Install PDM:** `pip install pdm` 2. **Create the project:** `pdm create` (Choose "standard package" or "src layout") 3. **Add dependencies:** `pdm add <package_name>` (e.g., `pdm add asyncio aiohttp python-nbt`) 4. **Install dependencies:** `pdm install` 5. **Run scripts:** `pdm run <script_name>` (e.g., `pdm run start`) **Example `server.py` (basic):** ```python import asyncio import logging from my_mcp_server.protocol.handshake import handle_handshake from my_mcp_server.protocol.status import handle_status from my_mcp_server.protocol.login import handle_login # Configure logging (you'll want to customize this) logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') async def handle_client(reader, writer): addr = writer.get_extra_info('peername') logging.info(f"New connection from {addr}") try: # Handshake protocol_version, next_state = await handle_handshake(reader, writer) if next_state == 1: # Status await handle_status(reader, writer) elif next_state == 2: # Login await handle_login(reader, writer, protocol_version) else: logging.warning(f"Invalid next_state: {next_state}") writer.close() await writer.wait_closed() return # Main game loop (not implemented in this example) # ... except ConnectionResetError: logging.info(f"Client {addr} disconnected abruptly.") except Exception as e: logging.exception(f"Error handling client {addr}: {e}") finally: logging.info(f"Closing connection for {addr}") writer.close() await writer.wait_closed() async def main(): server = await asyncio.start_server( handle_client, '127.0.0.1', 25565) # Standard Minecraft port addr = server.sockets[0].getsockname() logging.info(f"Serving on {addr}") async with server: await server.serve_forever() if __name__ == "__main__": asyncio.run(main()) ``` **Example `protocol/handshake.py`:** ```python import asyncio import logging from my_mcp_server.protocol.serialization import read_varint, read_string async def handle_handshake(reader, writer): """Handles the initial handshake with the client.""" try: # Read the packet length (VarInt) packet_length = await read_varint(reader) logging.debug(f"Handshake packet length: {packet_length}") # Read the packet ID (VarInt) packet_id = await read_varint(reader) logging.debug(f"Handshake packet ID: {packet_id}") if packet_id != 0x00: logging.warning(f"Unexpected packet ID in handshake: {packet_id}") writer.close() await writer.wait_closed() return None, None # Read protocol version (VarInt) protocol_version = await read_varint(reader) logging.debug(f"Protocol version: {protocol_version}") # Read server address (String) server_address = await read_string(reader) logging.debug(f"Server address: {server_address}") # Read server port (Unsigned Short - 2 bytes) server_port_bytes = await reader.readexactly(2) server_port = int.from_bytes(server_port_bytes, 'big') logging.debug(f"Server port: {server_port}") # Read next state (VarInt) next_state = await read_varint(reader) logging.debug(f"Next state: {next_state}") return protocol_version, next_state except asyncio.IncompleteReadError: logging.warning("Incomplete read during handshake.") writer.close() await writer.wait_closed() return None, None except Exception as e: logging.exception(f"Error during handshake: {e}") writer.close() await writer.wait_closed() return None, None ``` **Example `protocol/serialization.py`:** ```python import asyncio async def read_varint(reader): """Reads a VarInt from the given reader.""" result = 0 shift = 0 while True: byte = await reader.readexactly(1) value = byte[0] result |= (value & 0x7F) << shift shift += 7 if not (value & 0x80): break if shift > 35: # Prevent infinite loop raise ValueError("VarInt is too big") return result async def write_varint(writer, value): """Writes a VarInt to the given writer.""" while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 writer.write(bytes([byte])) if value == 0: break await writer.drain() # Ensure data is sent async def read_string(reader): """Reads a string from the given reader (prefixed with a VarInt length).""" length = await read_varint(reader) data = await reader.readexactly(length) return data.decode('utf-8') async def write_string(writer, value): """Writes a string to the given writer (prefixed with a VarInt length).""" encoded = value.encode('utf-8') await write_varint(writer, len(encoded)) writer.write(encoded) await writer.drain() ``` **Important Notes:** * **Start Small:** Don't try to implement the entire Minecraft protocol at once. Focus on the handshake, status, and login stages first. Then, gradually add more features. * **Refer to Existing Implementations:** Look at open-source Minecraft server implementations (e.g., in Java, C++) for inspiration and guidance. However, be careful not to directly copy code, as that could violate copyright. * **Debugging:** Use a debugger to step through your code and inspect variables. Logging is also essential for debugging. * **Error Handling:** Implement robust error handling to prevent your server from crashing. * **Performance:** Profile your code to identify performance bottlenecks and optimize them. * **Community:** Join the Minecraft server development community for help and support. This is a complex project, but with careful planning and a step-by-step approach, you can build your own Minecraft Protocol server in Python. Good luck! Let me know if you have more specific questions.

Reachy Claude MCP

Reachy Claude MCP

Integrates the Reachy Mini robot or its simulation with Claude Code to provide interactive physical feedback through emotions, speech, and celebratory animations. It features advanced capabilities like sentiment analysis, semantic problem search, and cross-project memory to enhance the developer experience.

MCP Greetings Server

MCP Greetings Server

Enables AI assistants to greet users in 7 different languages including English, Spanish, French, German, Japanese, Chinese, and Korean. A lightweight multilingual greeting tool for the Model Context Protocol.

nft-analytics-mcp

nft-analytics-mcp

An MCP server that delivers NFT collection analytics powered by data from Dune Analytics.

MCP Template Server

MCP Template Server

A Python starter template for building MCP servers with client connection management and Jupyter notebook integration. Provides a structured foundation for adding custom tools, prompts, and workflows to create AI-powered applications.

Blender MCP Server

Blender MCP Server

A lightweight HTTP server that exposes Blender's camera system for real-time image capture and scene interaction from external applications.

UI Flowchart Creator

UI Flowchart Creator

Permite que os usuários criem fluxogramas de interface do usuário, gerando visualizações de interfaces de usuário e interações por meio de uma API fácil de usar em sistemas compatíveis com MCP.

Supabase Notes

Supabase Notes

Um servidor MCP baseado em TypeScript para lidar com um sistema simples de notas com NextJS que suporta a criação e o resumo de notas de texto usando conceitos de MCP.

Radare2 MCP Server

Radare2 MCP Server

Servidor stdio MCP para radare2

Tello Drone MCP Server

Tello Drone MCP Server

A MCP server for controlling a drone

Security Context MCP Server

Security Context MCP Server

Provides instant access to authoritative security documentation from organizations like OWASP, NIST, and major cloud providers through natural language semantic search. It enables users to retrieve security best practices, frameworks, and vulnerability information directly from a locally cached knowledge base.

MCP Commute Assistant

MCP Commute Assistant

A smart commute assistant that monitors travel routes via the Amap API and sends automated notifications to DingTalk. It enables users to schedule daily route checks and receive real-time traffic updates using a modular MCP-based architecture.

MCP Send to Feishu Server

MCP Send to Feishu Server

Notion ReadOnly MCP Server

Notion ReadOnly MCP Server

An optimized read-only server for AI assistants to efficiently query and retrieve Notion content, featuring parallel processing and a minimized toolset of 7 essential read-only operations.

Playwright MCP Server

Playwright MCP Server

Provides browser automation capabilities using Playwright, enabling users to navigate websites, extract content, take screenshots, and interact with web pages through natural language prompts.

EcoFlow MCP Server

EcoFlow MCP Server

Enables monitoring and control of EcoFlow Power Stations and devices through the Model Context Protocol. Users can manage battery levels, toggle AC/DC outputs, and configure charging settings across the DELTA and RIVER series via the EcoFlow API.

ngspice-mcp

ngspice-mcp

Um servidor MCP para interagir com o simulador de circuitos ngspice.

Scratchpad MCP Server

Scratchpad MCP Server

Provides a 'think' tool that allows Claude and other LLMs to add dedicated thinking steps during complex tool use scenarios, creating space for structured reasoning and improving problem-solving capabilities.

MCP Calendar Server

MCP Calendar Server

Connects Claude Desktop to Google Calendar for local calendar management including adding, updating, and deleting events, checking schedules, and calculating travel time between meetings.

MCP Ahrefs

MCP Ahrefs

Enables integration with Ahrefs SEO tools and services through MCP protocol. Provides automated exception handling, comprehensive logging, and parallel processing capabilities for SEO data analysis and operations.

Devvit MCP

Devvit MCP

A companion MCP server for writing applications on Reddit's developer platform (Devvit). Provides tools and resources to assist with developing Reddit apps through natural language interactions.

Compresto MCP

Compresto MCP

A Model Context Protocol server that provides AI assistants with real-time data about Compresto's file compression app usage statistics, including total users, processed files, and total size reduced.

Developer Roadmaps MCP Server

Developer Roadmaps MCP Server

Provides access to developer roadmap content from roadmap.sh, allowing users to list available roadmaps and fetch detailed Markdown content for specific career paths.

NetSuite MCP Server

NetSuite MCP Server

A Model Context Protocol server that enables querying and analyzing NetSuite sales orders and invoices with filtering capabilities by customer, item, date range, and other parameters.

Toggl MCP Server

Toggl MCP Server

MCP Utility Tools

MCP Utility Tools

A collection of tools that enhance MCP-based workflows with caching, retry logic, batch operations, and rate limiting capabilities.

MCP Registry

MCP Registry

Um servidor MCP que pesquisa servidores MCP.

MCP Server Proto-OKN

MCP Server Proto-OKN

A Model Context Protocol server that provides tools for querying SPARQL endpoints, with specialized support for Proto-OKN knowledge graphs hosted on the FRINK platform.

MCP Server for ServiceNow

MCP Server for ServiceNow

Este Servidor MCP para ServiceNow foi projetado para ser genérico e extensível. Ele utiliza uma abordagem modular para lidar com uma ampla gama de casos de uso do ServiceNow, desde operações básicas de ITSM até gerenciamento avançado de CMDB e orquestração dinâmica de fluxo de trabalho.

School Vacation MCP Server

School Vacation MCP Server

Query school vacation calendars for Belgium, Netherlands, and Luxembourg (2019-2028). Check vacation dates, retrieve vacation periods, and list supported regions across multiple educational zones.