发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 23,151 个能力。
Node.js MCP Server
A comprehensive MCP server that enables file operations, mathematical calculations with unit conversions, and system information retrieval. Provides secure access to local file system, calculator functions with statistics, and system monitoring capabilities.
mcp-demo
Okay, here's a breakdown of how to approach creating an MCP (Minecraft Communications Protocol) demo for studying purposes, including both client and server components, along with considerations for Chinese translation: **Understanding the Goal** The purpose of this demo is to: 1. **Learn MCP:** Understand the underlying protocol Minecraft uses for communication between the client and server. 2. **Implement Basic Communication:** Create a simplified client and server that can exchange a few basic packets. 3. **Study Packet Structure:** Examine the format of packets, including data types, IDs, and how they are serialized/deserialized. 4. **Gain Practical Experience:** Get hands-on experience with network programming and protocol implementation. **Simplified MCP Demo Structure** We'll focus on a very basic subset of the MCP to keep the demo manageable. Here's a suggested approach: * **Language:** Python is a good choice due to its readability and ease of use for network programming. Java is also a viable option, especially if you want to be closer to the Minecraft codebase. * **Functionality:** * **Handshake:** Implement the initial handshake sequence. This is crucial for establishing a connection. * **Keep-Alive:** Implement the keep-alive packet to prevent the connection from timing out. * **Chat:** Implement a simple chat message exchange. The client can send a message, and the server broadcasts it to all connected clients (if you extend it to multiple clients). * **Packet Structure:** Define Python classes (or Java classes) to represent the packets. These classes will handle serialization (converting data to bytes) and deserialization (converting bytes to data). **Python Example (Conceptual)** ```python import socket import struct import json # For more complex data # --- Packet Definitions --- class HandshakePacket: 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 (convert data to bytes) # Use struct.pack for primitive types, and encode strings data = b"" data += struct.pack(">b", 0x00) # Packet ID (Handshake) data += self.write_varint(self.protocol_version) data += self.write_string(self.server_address) data += struct.pack(">H", self.server_port) # Unsigned short (2 bytes) data += self.write_varint(self.next_state) return data def write_varint(self, value): # Implement VarInt encoding (Minecraft uses this) data = b"" while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 data += struct.pack(">B", byte) if value == 0: break return data def write_string(self, string): encoded_string = string.encode('utf-8') length = len(encoded_string) return self.write_varint(length) + encoded_string @staticmethod def deserialize(data): # Implement deserialization logic (convert bytes to data) # Use struct.unpack and decode strings pass # Not needed for the client sending the handshake class ChatMessagePacket: def __init__(self, message): self.message = message def serialize(self): data = b"" data += struct.pack(">b", 0x03) # Packet ID (Chat Message) data += self.write_string(self.message) return data def write_varint(self, value): # Implement VarInt encoding (Minecraft uses this) data = b"" while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 data += struct.pack(">B", byte) if value == 0: break return data def write_string(self, string): encoded_string = string.encode('utf-8') length = len(encoded_string) return self.write_varint(length) + encoded_string @staticmethod def deserialize(data): # Implement deserialization logic (convert bytes to data) # Use struct.unpack and decode strings pass # Not needed for the client sending the handshake class KeepAlivePacket: def __init__(self, keep_alive_id): self.keep_alive_id = keep_alive_id def serialize(self): data = b"" data += struct.pack(">b", 0x00) # Packet ID (Keep Alive) data += struct.pack(">q", self.keep_alive_id) # Long return data @staticmethod def deserialize(data): # Implement deserialization logic (convert bytes to data) # Use struct.unpack and decode strings pass # Not needed for the client sending the handshake # --- Client --- def client(): server_address = ("127.0.0.1", 25565) # Replace with your server address sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect(server_address) print("Connected to server") # 1. Handshake handshake = HandshakePacket(protocol_version=762, server_address="127.0.0.1", server_port=25565, next_state=2) # Status = 1, Login = 2 sock.sendall(handshake.serialize()) # 2. Login Start (Send username) username = "TestClient" login_start_packet = b"" login_start_packet += struct.pack(">b", 0x00) # Packet ID login_start_packet += handshake.write_string(username) sock.sendall(login_start_packet) # 3. Chat Message chat_message = ChatMessagePacket(message="Hello from the client!") sock.sendall(chat_message.serialize()) # 4. Keep Alive keep_alive = KeepAlivePacket(keep_alive_id=12345) sock.sendall(keep_alive.serialize()) # Receive data (example - you'll need to handle this properly) data = sock.recv(1024) print(f"Received: {data}") except Exception as e: print(f"Error: {e}") finally: sock.close() print("Connection closed") # --- Server --- def server(): server_address = ("0.0.0.0", 25565) # Listen on all interfaces sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(server_address) sock.listen(1) # Allow only one connection for simplicity print("Server listening...") try: connection, client_address = sock.accept() print(f"Connection from {client_address}") while True: data = connection.recv(1024) if data: print(f"Received: {data}") # --- Packet Handling (Example) --- packet_id = struct.unpack(">b", data[:1])[0] # Get packet ID if packet_id == 0x03: # Chat Message # Deserialize the chat message #chat_message = ChatMessagePacket.deserialize(data) print("Received Chat Message") #print(f"Chat Message: {chat_message.message}") # Echo the message back (for example) connection.sendall(data) # Send back the same data elif packet_id == 0x00: # Keep Alive print("Received Keep Alive") else: print("Received Unknown Packet") else: print(f"No more data from {client_address}") break except Exception as e: print(f"Server error: {e}") finally: connection.close() sock.close() print("Server closed") if __name__ == "__main__": import threading server_thread = threading.Thread(target=server) server_thread.start() import time time.sleep(1) # Give the server time to start client() ``` Key improvements and explanations: * **Clearer Packet Definitions:** Uses classes to represent packets, making the code more organized and readable. Includes `serialize` methods to convert packet data into bytes for sending over the network. Includes `deserialize` methods to convert bytes back into packet data. * **VarInt Encoding:** Includes a `write_varint` function to handle Minecraft's variable-length integer encoding. This is *essential* for MCP. * **String Handling:** Includes a `write_string` function to handle Minecraft's string encoding (length-prefixed UTF-8). * **Handshake Example:** Shows how to construct and send a handshake packet. The handshake is *required* before any other communication. * **Login Start Example:** Shows how to send the Login Start packet with the username. * **Chat Message Example:** Shows how to send a chat message. * **Keep Alive Example:** Shows how to send a keep alive packet. * **Basic Server Logic:** The server now *attempts* to handle incoming packets based on their ID. It includes a placeholder for deserialization. * **Error Handling:** Includes `try...except...finally` blocks for basic error handling and resource cleanup. * **Threading:** Uses threading to run the server and client concurrently. This is important because the server needs to be listening while the client connects and sends data. * **Comments:** Includes comments to explain the purpose of each section of the code. * **`struct.pack` and `struct.unpack`:** Uses the `struct` module for packing and unpacking binary data. This is the standard way to handle binary data in Python. * **UTF-8 Encoding:** Uses UTF-8 encoding for strings, which is the standard encoding for Minecraft. **Important Considerations:** * **Minecraft Version:** The MCP changes between Minecraft versions. This example is a *very* simplified version and may not work with all versions. You'll need to research the specific protocol for the version you're targeting. The `protocol_version` in the `HandshakePacket` is critical. * **Packet IDs:** Packet IDs are version-dependent. The IDs used in this example are placeholders. You'll need to look up the correct IDs for your target version. * **Data Types:** Minecraft uses specific data types (VarInt, VarLong, strings, etc.). Make sure you handle these correctly. * **Encryption/Compression:** Modern Minecraft versions use encryption and compression. This demo *does not* handle these. You'll need to implement these if you want to communicate with a real Minecraft server. * **Authentication:** Real Minecraft servers require authentication. This demo *does not* handle authentication. * **Error Handling:** The error handling in this demo is very basic. You'll need to implement more robust error handling in a real application. * **State Management:** The server needs to keep track of the connection state (e.g., handshake complete, login complete). This demo doesn't explicitly manage state. **Chinese Translation Considerations** When translating this project for Chinese speakers, consider the following: 1. **Comments:** Translate all comments in the code to Chinese. Use clear and concise language. 2. **Variable Names:** While you *can* use Chinese characters in variable names in Python, it's generally *not recommended* for code that might be shared with a wider audience. Keep variable names in English, but provide explanations of their meaning in Chinese comments. 3. **Error Messages:** Translate error messages to Chinese. This will make it easier for Chinese speakers to debug their code. 4. **Documentation:** Create documentation in Chinese explaining the purpose of the demo, how it works, and how to use it. 5. **Example Chat Messages:** Include example chat messages in Chinese. 6. **Encoding:** Ensure that your code uses UTF-8 encoding for all strings, including Chinese characters. This is crucial for displaying Chinese characters correctly. 7. **Terminology:** Use consistent and accurate translations of Minecraft-related terminology. Refer to existing Chinese Minecraft resources for guidance. **Example of Translated Comments:** ```python # --- Packet Definitions --- 数据包定义 class HandshakePacket: def __init__(self, protocol_version, server_address, server_port, next_state): # self.protocol_version: Minecraft 协议版本 Minecraft 协议版本 self.protocol_version = protocol_version # self.server_address: 服务器地址 服务器地址 self.server_address = server_address # self.server_port: 服务器端口 服务器端口 self.server_port = server_port # self.next_state: 下一个状态 (1 = 状态, 2 = 登录) 下一个状态 (1 = 状态, 2 = 登录) self.next_state = next_state ``` **Chinese Translation of the Explanation:** 好的,这是一个关于如何创建一个用于学习 MCP(Minecraft 通信协议)的演示程序,包括客户端和服务器组件,以及中文翻译的注意事项的详细说明: **理解目标** 这个演示程序的目的是: 1. **学习 MCP:** 理解 Minecraft 用于客户端和服务器之间通信的底层协议。 2. **实现基本通信:** 创建一个简化的客户端和服务器,可以交换一些基本的数据包。 3. **研究数据包结构:** 检查数据包的格式,包括数据类型、ID 以及它们如何序列化/反序列化。 4. **获得实践经验:** 获得网络编程和协议实现的实践经验。 **简化的 MCP 演示程序结构** 我们将专注于 MCP 的一个非常基本的子集,以使演示程序易于管理。以下是一个建议的方法: * **语言:** Python 是一个不错的选择,因为它具有可读性,并且易于用于网络编程。 Java 也是一个可行的选择,特别是如果你想更接近 Minecraft 代码库。 * **功能:** * **握手:** 实现初始握手序列。 这对于建立连接至关重要。 * **保持活动:** 实现保持活动数据包以防止连接超时。 * **聊天:** 实现一个简单的聊天消息交换。 客户端可以发送消息,服务器将其广播给所有连接的客户端(如果将其扩展到多个客户端)。 * **数据包结构:** 定义 Python 类(或 Java 类)来表示数据包。 这些类将处理序列化(将数据转换为字节)和反序列化(将字节转换为数据)。 (The rest of the explanation would be translated similarly) **Next Steps:** 1. **Choose a Minecraft Version:** Decide which Minecraft version you want to target. 2. **Research the Protocol:** Find documentation or resources that describe the MCP for that version. The Minecraft Wiki is a good starting point, but it may not have all the details. You might need to look at decompiled Minecraft code. 3. **Implement the Code:** Start implementing the client and server code, focusing on the handshake, keep-alive, and chat message exchange. 4. **Test Thoroughly:** Test your code carefully to ensure that it works correctly. 5. **Add More Features:** Once you have a basic demo working, you can add more features, such as player movement, inventory management, or custom commands. This is a complex project, but it's a great way to learn about network programming and the inner workings of Minecraft. Good luck!
Fetch MCP Server
Enables fetching and processing web content by retrieving URLs and converting HTML to markdown format. Supports chunked reading of webpages and both local (stdio) and HTTP transport modes with optional authentication.
MCP-FREDAPI
将 FRED (联邦储备经济数据) API 与模型上下文协议 (MCP) 集成
OpenAI MCP Server
使用 MCP 协议直接从 Claude 查询 OpenAI 模型。
Frankfurter MCP
Provides access to currency exchange rates and conversion tools using the Frankfurter API, including latest rates, historical data, and time series from sources like the European Central Bank.
MCP Git Tools
用于模型上下文协议 (MCP) 的 Git 工具集成库。
NLSQL MCP Server
A Node.js package that provides a Model Context Protocol server for converting natural language questions into SQL queries using AI-powered multi-agent systems.
mcp-oda
An MCP server for programmatically interacting with the Oda grocery shopping platform. It enables users to search for products, browse results, and manage their shopping cart contents through natural language.
Claude Code + Gemini MCP Server
Connects Claude Code with Google's Gemini AI, allowing users to ask Gemini questions, get code reviews, and brainstorm ideas directly within Claude Code.
Doubao Image MCP Server
An MCP server that generates high-quality images through Volcano Engine's Doubao model, supporting bilingual prompts, multiple resolutions, and parameter controls like seed and guidance scale.
Pabal MCP
Manages App Store Connect and Google Play Console metadata, releases, and ASO workflows locally through MCP tools, enabling store management directly from AI clients without manual console navigation.
Remote MCP Server on Cloudflare
MCP Clusters API Server
一个模型上下文协议服务器实现,提供基于钱包的身份验证、集群管理和名称注册服务的端点。
cline-test
通过 MCP 服务器创建的测试仓库
Instagram MCP Server by CData
Instagram MCP Server by CData
Browserbase MCP Server
Enables cloud browser automation through Browserbase and Stagehand, allowing LLMs to navigate web pages, extract data, take screenshots, fill forms, and perform automated web interactions with multi-session support.
Cisco Catalyst Center MCP Server
A server that wraps Cisco Catalyst Center APIs into tools accessible via the Model Context Protocol, allowing AI agents to discover and execute network management operations.
Local DevOps MCP Server
Enables Docker container management through natural language conversations, including deployment, health monitoring, dependency resolution, auto-redeployment on file changes, and environment snapshots.
Mail MCP Tool
一个基于 MCP 的电子邮件工具,使 AI 模型能够通过标准化接口访问电子邮件服务,从而允许 AI 助手执行各种电子邮件操作,例如发送电子邮件、读取收件箱和处理附件。
File Analysis MCP Server
Provides tools for text file analysis, including metrics like word counts and character frequencies, alongside file reading and directory browsing capabilities. This server enables LLMs to interact with and process local file content securely through the Model Context Protocol.
Temporal Awareness MCP Server
A Model Context Protocol (MCP) server that provides AI agents with comprehensive temporal awareness and time calculation capabilities.
Code Intelligence MCP Server
Provides Cursor-like code intelligence using tools like ripgrep, ctags, and tree-sitter to help LLMs explore and understand entire codebases. It implements a structured, phase-gated workflow to ensure high-confidence code modifications and eliminate hallucinations.
Jana MCP Server
Provides natural language access to environmental data including air quality measurements, greenhouse gas emissions, and facility records. It enables users to perform geographic searches, trend analysis, and proximity-based queries using data from sources like OpenAQ and Climate TRACE.
MCP Server for Asana
镜子 (jìng zi)
alertmanager-mcp-server
alertmanager-mcp-server
MCP Athena Analytics Server
Enables secure querying of analytics data stored in AWS Athena/S3 through natural language, with multiple security layers including query validation, resource limits, and automatic PII redaction to prevent data breaches and destructive operations.
Dreamboat Rachel_MCP Server For Local
镜子 (jìng zi)
Remote MCP Server on Cloudflare
Zhipu Text-to-Image MCP Server
Enables text-to-image generation using Zhipu AI's CogView-4 API. Supports generating images from text prompts with configurable size and quality parameters through MCP-compatible clients like Claude Desktop and Cline.