Discover Awesome MCP Servers

Extend your agent with 23,979 capabilities via MCP servers.

All23,979
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.

Zerocracy MCP Server

Zerocracy MCP Server

A server module for Claude Desktop that enables integration with Zerocracy, allowing interaction with the Zerocracy project management platform through natural language commands.

AI Workshop Guide MCP Server

AI Workshop Guide MCP Server

Enables AI educators to provide simple explanations, interactive demonstrations, and relatable analogies for complex AI concepts during workshops. Makes artificial intelligence topics accessible and engaging for participants through structured teaching tools.

TickTick MCP Server

TickTick MCP Server

A comprehensive Model Context Protocol server providing complete TickTick task management API integration (112 operations) for Claude Code users, enabling seamless task creation, project management, habit tracking, and productivity features.

Awesome MCPs

Awesome MCPs

Uma coleção incrível de ferramentas do Protocolo de Contexto de Modelo (MCP).

OpenRouter Web Search MCP Server

OpenRouter Web Search MCP Server

Um servidor MCP que fornece pesquisa na web usando openrouter :online

Dockerized MCP Server Template

Dockerized MCP Server Template

Um modelo de servidor Python Dockerizado e reutilizável que implementa o Protocolo de Contexto de Modelo (MCP) com Eventos Enviados pelo Servidor (SSE), construído usando a biblioteca FastMCP para fácil integração com Grandes Modelos de Linguagem (LLMs).

mc-server-clash-of-clans

mc-server-clash-of-clans

Servidor MCP para a API do Clash of Clans. Consegue obter informações de jogadores, clãs, analisar guerras em andamento, bem como históricos de guerra (desde que sejam públicos).

UseScraper

UseScraper

Um servidor MCP baseado em TypeScript que utiliza a API UseScraper para fornecer capacidades de web scraping, permitindo que os usuários extraiam conteúdo de páginas da web em vários formatos.

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.

Alpha ESS MCP Server

Alpha ESS MCP Server

Provides access to Alpha ESS solar inverter and battery system data, enabling monitoring of energy statistics, real-time power data, and configuration of battery charging and discharge schedules through the Alpha ESS Open API.

Meta Ads MCP

Meta Ads MCP

Enables AI-powered analysis, management, and optimization of Meta advertising campaigns across Facebook and Instagram, including performance insights, budget optimization, and creative testing.

Flomo MCP Server

Flomo MCP Server

Enables users to create and save notes in Flomo directly through AI chat interactions using natural language commands. Seamlessly integrates with AI assistants like Claude and Cursor to capture thoughts and information.

Aave Liquidation MCP Server

Aave Liquidation MCP Server

Enables AI assistants to analyze Aave V3 positions on Ethereum, monitor health factors, identify liquidation opportunities, and query protocol data including collateral positions, debt composition, and real-time asset prices.