Discover Awesome MCP Servers
Extend your agent with 25,193 capabilities via MCP servers.
- All25,193
- Developer Tools3,867
- Search1,714
- Research & Data1,557
- AI Integration Systems229
- Cloud Platforms219
- Data & App Analysis181
- Database Interaction177
- Remote Shell Execution165
- Browser Automation147
- Databases145
- Communication137
- AI Content Generation127
- OS Automation120
- Programming Docs Access109
- Content Fetching108
- Note Taking97
- File Systems96
- Version Control93
- Finance91
- Knowledge & Memory90
- Monitoring79
- Security71
- Image & Video Processing69
- Digital Note Management66
- AI Memory Systems62
- Advanced AI Reasoning59
- Git Management Tools58
- Cloud Storage51
- Entertainment & Media43
- Virtualization42
- Location Services35
- Web Automation & Stealth32
- Media Content Processing32
- Calendar Management26
- Ecommerce & Retail18
- Speech Processing18
- Customer Data Platforms16
- Travel & Transportation14
- Education & Learning Tools13
- Home Automation & IoT13
- Web Search Integration12
- Health & Wellness10
- Customer Support10
- Marketing9
- Games & Gamification8
- Google Cloud Integrations7
- Art & Culture4
- Language Translation3
- Legal & Compliance2
MCP Server Example
Okay, here's a basic template for an MCP (Minecraft Protocol) server that can be integrated with Cursor to enable AI tools, specifically weather information retrieval using the Claude-3.7-sonnet model. This template focuses on the core structure and integration points. You'll need to fill in the specific Minecraft protocol handling and AI interaction details. ```python # main.py (or whatever you name your main server file) import asyncio import json import logging import os import re import socket import struct import ssl # For optional SSL encryption # Install these packages: # pip install python-dotenv # pip install aiohttp from dotenv import load_dotenv import aiohttp # Load environment variables from .env file load_dotenv() # --- Configuration --- SERVER_HOST = os.getenv("SERVER_HOST", "0.0.0.0") # Listen on all interfaces by default SERVER_PORT = int(os.getenv("SERVER_PORT", "25565")) # Default Minecraft port CLAUDE_API_KEY = os.getenv("CLAUDE_API_KEY") # Get your Claude API key from environment CLAUDE_API_URL = "https://api.anthropic.com/v1/messages" # Claude API endpoint SSL_ENABLED = os.getenv("SSL_ENABLED", "False").lower() == "true" # Enable SSL if set to "true" SSL_CERT_FILE = os.getenv("SSL_CERT_FILE", "server.crt") # Path to your SSL certificate SSL_KEY_FILE = os.getenv("SSL_KEY_FILE", "server.key") # Path to your SSL key # --- Logging --- logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) # --- Minecraft Protocol Constants (Example - adjust as needed) --- HANDSHAKE_STATE = 0 STATUS_STATE = 1 LOGIN_STATE = 2 # --- Helper Functions --- def read_varint(sock): """Reads a variable-length integer from the socket.""" result = 0 shift = 0 while True: byte = sock.recv(1)[0] result |= (byte & 0x7F) << shift shift += 7 if not (byte & 0x80): break return result def write_varint(sock, value): """Writes a variable-length integer to the socket.""" while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 sock.send(bytes([byte])) if value == 0: break def read_string(sock, length): """Reads a string of a given length from the socket.""" return sock.recv(length).decode('utf-8') def write_string(sock, string): """Writes a string to the socket.""" sock.send(string.encode('utf-8')) def create_packet(packet_id, data): """Creates a Minecraft packet with a given ID and data.""" packet_data = packet_id.to_bytes(1, 'little') + data packet_length = len(packet_data) length_bytes = bytearray() while True: byte = packet_length & 0x7F packet_length >>= 7 if packet_length == 0: length_bytes.append(byte) break else: length_bytes.append(byte | 0x80) return bytes(length_bytes) + packet_data # --- AI Interaction (Claude) --- async def get_weather_from_claude(location): """Retrieves weather information from Claude using the API.""" if not CLAUDE_API_KEY: logger.error("Claude API key not found. Please set the CLAUDE_API_KEY environment variable.") return "Error: Claude API key not configured." headers = { "Content-Type": "application/json", "x-api-key": CLAUDE_API_KEY, "anthropic-version": "2023-06-01" # Specify the Anthropic API version } prompt = f"What is the current weather in {location}? Give a concise answer." data = { "model": "claude-3-opus-20240229", # Or claude-3-sonnet-20240229 "max_tokens": 200, "messages": [ { "role": "user", "content": prompt } ] } try: async with aiohttp.ClientSession() as session: async with session.post(CLAUDE_API_URL, headers=headers, json=data) as response: response_json = await response.json() if response.status == 200: # Extract the response from Claude claude_response = response_json['content'][0]['text'] logger.info(f"Claude response: {claude_response}") return claude_response else: logger.error(f"Claude API error: {response.status} - {response_json}") return f"Error: Could not retrieve weather information. Claude API error: {response.status}" except aiohttp.ClientError as e: logger.exception("Error communicating with Claude API:") return f"Error: Could not retrieve weather information. Network error: {e}" # --- Minecraft Protocol Handling --- async def handle_handshake(sock): """Handles the initial handshake packet.""" try: packet_length = read_varint(sock) packet_id = sock.recv(1)[0] if packet_id == 0x00: protocol_version = read_varint(sock) server_address_length = read_varint(sock) server_address = read_string(sock, server_address_length) server_port = struct.unpack('>H', sock.recv(2))[0] # Unpack as big-endian unsigned short next_state = read_varint(sock) logger.info(f"Handshake: Protocol {protocol_version}, Address {server_address}:{server_port}, Next State {next_state}") return next_state else: logger.warning(f"Unexpected packet ID in handshake: {packet_id}") return None except Exception as e: logger.exception("Error handling handshake:") return None async def handle_status_request(sock): """Handles the status request (ping).""" try: packet_length = read_varint(sock) packet_id = sock.recv(1)[0] if packet_id == 0x00: # Respond with server status (players, MOTD, etc.) status = { "version": { "name": "My Custom Server", "protocol": 763 # Example protocol version }, "players": { "max": 10, "online": 0, "sample": [] }, "description": { "text": "A server powered by AI!" } } status_json = json.dumps(status) status_bytes = status_json.encode('utf-8') status_packet = create_packet(0x00, len(status_bytes).to_bytes(1, 'little') + status_bytes) # Length of JSON string sock.send(status_packet) # Handle ping request (0x01) packet_length = read_varint(sock) packet_id = sock.recv(1)[0] if packet_id == 0x01: payload = sock.recv(8) # Ping payload (8 bytes) ping_response = create_packet(0x01, payload) sock.send(ping_response) else: logger.warning(f"Unexpected packet ID after status: {packet_id}") else: logger.warning(f"Unexpected packet ID in status request: {packet_id}") except Exception as e: logger.exception("Error handling status request:") async def handle_login_request(sock): """Handles the login request.""" try: packet_length = read_varint(sock) packet_id = sock.recv(1)[0] if packet_id == 0x00: username_length = read_varint(sock) username = read_string(sock, username_length) logger.info(f"Login request from: {username}") # --- AI Integration Point --- # Check for weather command in username (example) match = re.search(r"!weather\s+(.+)", username) if match: location = match.group(1) weather_info = await get_weather_from_claude(location) # Send weather information back to the client (using a chat message packet) chat_message = { "text": f"Weather in {location}: {weather_info}" } chat_json = json.dumps(chat_message) chat_bytes = chat_json.encode('utf-8') chat_packet = create_packet(0x0F, (0).to_bytes(1, 'little') + chat_bytes + (0).to_bytes(1, 'little')) # 0x0F is chat message packet ID, 0 is position (chat box) sock.send(chat_packet) # Send a disconnect packet to close the connection after sending the weather. disconnect_message = {"text": "Disconnected after weather report."} disconnect_json = json.dumps(disconnect_message) disconnect_bytes = disconnect_json.encode('utf-8') disconnect_packet = create_packet(0x19, disconnect_bytes) # 0x19 is disconnect packet ID sock.send(disconnect_packet) return False # Close the connection else: # Send a successful login packet (play state) uuid = "00000000-0000-0000-0000-000000000000" # Example UUID login_success_data = create_packet(0x02, len(uuid).to_bytes(1, 'little') + uuid.encode('utf-8') + len(username).to_bytes(1, 'little') + username.encode('utf-8')) sock.send(login_success_data) # Send a join game packet (example) join_game_data = create_packet(0x26, (0).to_bytes(4, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(1, 'little') + (0).to_bytes(4, 'little') + (0).to_bytes(1, 'little)) sock.send(join_game_data) # You would then enter the "play" state and handle game packets. # This is a placeholder - implement your game logic here. logger.info(f"{username} has joined the game.") return True # Keep the connection open else: logger.warning(f"Unexpected packet ID in login request: {packet_id}") return False except Exception as e: logger.exception("Error handling login request:") return False async def handle_client(sock): """Handles a single client connection.""" try: state = await handle_handshake(sock) if state == STATUS_STATE: await handle_status_request(sock) elif state == LOGIN_STATE: await handle_login_request(sock) else: logger.warning(f"Unknown state: {state}") except Exception as e: logger.exception("Error handling client connection:") finally: sock.close() logger.info("Connection closed.") async def main(): """Main server loop.""" if SSL_ENABLED: try: context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) context.load_cert_chain(SSL_CERT_FILE, SSL_KEY_FILE) server = await asyncio.start_server(handle_client, SERVER_HOST, SERVER_PORT, ssl=context) logger.info(f"Server started with SSL on {SERVER_HOST}:{SERVER_PORT}") except Exception as e: logger.error(f"Failed to start SSL server: {e}") return else: server = await asyncio.start_server(handle_client, SERVER_HOST, SERVER_PORT) logger.info(f"Server started on {SERVER_HOST}:{SERVER_PORT}") async with server: await server.serve_forever() if __name__ == "__main__": asyncio.run(main()) ``` Key improvements and explanations: * **Environment Variables:** Uses `.env` file for configuration (API key, host, port, SSL settings). This is *crucial* for security and portability. Install with `pip install python-dotenv`. Create a `.env` file in the same directory as your script: ``` SERVER_HOST=0.0.0.0 SERVER_PORT=25565 CLAUDE_API_KEY=YOUR_CLAUDE_API_KEY # Replace with your actual key SSL_ENABLED=false SSL_CERT_FILE=server.crt SSL_KEY_FILE=server.key ``` * **Asynchronous Operations:** Uses `asyncio` for non-blocking I/O. This is essential for handling multiple Minecraft clients concurrently without blocking the server. The `aiohttp` library is used for asynchronous HTTP requests to the Claude API. Install with `pip install aiohttp`. * **Error Handling:** Includes `try...except` blocks with logging to catch potential errors and prevent the server from crashing. Logs exceptions with `logger.exception()` to get full stack traces. * **Minecraft Protocol Handling:** * Implements basic `read_varint`, `write_varint`, `read_string`, `write_string`, and `create_packet` functions for handling Minecraft's variable-length integers and packet structure. These are *essential* for communicating with Minecraft clients. * Handles the handshake, status request (ping), and login request. These are the initial steps in the Minecraft protocol. * **Important:** The protocol handling is *simplified*. You'll need to expand it to fully implement the Minecraft protocol for your desired version. Refer to the Minecraft protocol documentation for details. * **AI Integration (Claude):** * `get_weather_from_claude` function: * Makes an asynchronous HTTP request to the Claude API. * Includes error handling for API errors and network issues. * Extracts the weather information from the Claude response. * Uses `aiohttp` for asynchronous HTTP requests. * Includes the `anthropic-version` header, which is required by the Claude API. * Uses `claude-3-opus-20240229` as the model. You can change this to `claude-3-sonnet-20240229` if you prefer. * **Integration Point:** The `handle_login_request` function demonstrates how to integrate the AI. It checks if the username contains a `!weather` command. If so, it calls `get_weather_from_claude` to get the weather information and sends it back to the client as a chat message. It then disconnects the client. This is a *basic example*. You can modify this to trigger AI actions in other ways (e.g., based on chat commands, player actions, or game events). * **SSL Support (Optional):** Includes optional SSL encryption for secure communication. Set `SSL_ENABLED=true` in your `.env` file to enable it. You'll need to generate SSL certificates (e.g., using `openssl`). If you don't have SSL certificates, set `SSL_ENABLED=false`. * **Clear Logging:** Uses the `logging` module for informative output. * **Clear Structure:** The code is organized into functions for better readability and maintainability. * **Disconnect Packet:** Sends a disconnect packet to the client after sending the weather report. This is important to close the connection gracefully. * **Join Game Packet:** Sends a join game packet to the client after successful login. This is a basic packet that tells the client that it has joined the game. **How to Use with Cursor:** 1. **Create a Project:** Create a new project in Cursor. 2. **Add Files:** Create the `main.py` file (or whatever you name it) and the `.env` file in your project directory. 3. **Install Dependencies:** Open a terminal in Cursor and run `pip install python-dotenv aiohttp`. 4. **Configure `.env`:** Fill in the `.env` file with your Claude API key and other settings. 5. **Run the Server:** Run the `main.py` file from Cursor. 6. **Connect with Minecraft:** Start your Minecraft client and connect to `localhost:25565` (or the host and port you configured). 7. **Test the AI:** In the Minecraft client, try logging in with a username like `!weather London`. The server should respond with the weather information. **Important Considerations and Next Steps:** * **Minecraft Protocol Version:** This template uses a placeholder protocol version. You *must* update it to match the Minecraft version you are targeting. Refer to the Minecraft protocol documentation for the correct protocol version. * **Complete Protocol Implementation:** This template only implements the handshake, status, and login phases. You'll need to implement the full Minecraft protocol to handle game packets, player movement, chat messages, etc. * **Security:** Be very careful about security. Validate all input from clients to prevent exploits. Consider using a more robust authentication system. * **Error Handling:** Add more comprehensive error handling to gracefully handle unexpected situations. * **Concurrency:** The `asyncio` framework provides concurrency, but you need to be careful about shared resources. Use appropriate locking mechanisms if necessary. * **Configuration:** Make the server more configurable through command-line arguments or a configuration file. * **AI Integration:** Explore more advanced AI integration possibilities, such as: * Generating dynamic game content. * Creating intelligent NPCs. * Providing real-time assistance to players. * Analyzing player behavior. * **Cursor Integration:** Use Cursor's AI features to help you implement the Minecraft protocol and add more AI functionality. For example, you can use Cursor to: * Generate code for handling specific Minecraft packets. * Write unit tests for your server. * Refactor your code to improve readability and maintainability. * Explain complex Minecraft protocol concepts. This template provides a solid foundation for building an AI-powered Minecraft server. Remember to consult the Minecraft protocol documentation and use Cursor's AI tools to help you develop your server. Good luck!
MCP Server Office
Một máy chủ cung cấp các công cụ để đọc, viết và chỉnh sửa các tệp Microsoft Word (docx) thông qua Giao thức Ngữ cảnh Mô hình (Model Context Protocol), cho phép các thao tác như đọc toàn bộ tài liệu, tạo nội dung, chỉnh sửa đoạn văn cụ thể và chèn văn bản.
Maven Dependencies MCP Server
Mirror of
Model Context Protocol (MCP) Types
Máy chủ Giao thức Bối cảnh Mô hình (MCP) cho Rust
GitHub Kanban MCP Server
Mirror of
MCP ChatGPT Server
MCP ChatGPT Responses kết nối Claude với ChatGPT thông qua hai công cụ thiết yếu: các truy vấn tiêu chuẩn cho các cuộc hội thoại giữa AI với AI và các yêu cầu hỗ trợ web để có thông tin hiện tại. Nó sử dụng API Phản hồi của OpenAI để tự động duy trì trạng thái hội thoại.
Exa MCP Server 🔍
Gương của
Text2sim MCP Server
Text2Sim MCP Server là một công cụ mô phỏng sự kiện rời rạc, tạo và thực thi các mô hình linh hoạt dựa trên SimPy từ các mô tả bằng ngôn ngữ tự nhiên. Hỗ trợ quy trình làm việc đa lĩnh vực (sân bay, chăm sóc sức khỏe, sản xuất) với các thực thể có thể định cấu hình, logic ngẫu nhiên và các chỉ số thời gian thực.
Salesforce MCP Server
Mirror of
BuiltWith MCP Server
Model Context Protocol specification
Omi Uber Mcp
An MCP server for Omi devices calling uber
MCP (Message Control Program) Servers
MCP (Message Control Program) Servers Collection
mcp-lance-db: A LanceDB MCP server
MCP Get Community Servers
Mirror of
Java-MCPlugin-ChallengeServerBungeePlugin
Mirror of
search-fetch-server MCP Serversearch-fetch-server MCP Server
TypeScript MCP Server
Docker MCP Servers
Mcp Server Weather
LanceDB Node.js Vector Search
Dưới đây là bản dịch tiếng Việt cho câu "A Node.js implementation for vector search using LanceDB and Ollama's embedding model.": **Một triển khai Node.js cho tìm kiếm vector sử dụng LanceDB và mô hình embedding của Ollama.** Hoặc, có thể diễn đạt chi tiết hơn: **Một cách triển khai tìm kiếm vector bằng Node.js, tận dụng LanceDB và mô hình tạo embedding của Ollama.**
Stateset MCP Server
MCP Time Server
Máy chủ Thời gian Giao thức Bối cảnh Mô hình - Một triển khai máy chủ thời gian mạnh mẽ, nhận biết múi giờ.
mcp-imagen-server
Máy chủ MCP để sử dụng khi bạn muốn tạo ảnh một cách thoải mái. Fal.ai và một "hall of fame" rất rẻ cũng có thể thực hiện được!
mysql-mcp-server
Mirror of
MCP Servers for Cursor AI
All in one place for my MCP servers
How to build an MCP server - Calculator Example
Dự án mẫu trình bày cách xây dựng một MCP Server đơn giản (và đưa nó lên Smithery!)
MCP Rust CLI server template
A hello-world server for the Model Context Protocol
Mcp Server Reposearch
MCP Spotify Server