发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 12,252 个能力。
Mcp Server Weather
Mcp Server Reposearch
mcp-imagen-server
用于在你想随意生成图像时使用的 mcp 服务器。使用 fal.ai 甚至可以实现非常廉价的名人堂效果!
Derisk
AI 原生风险情报系统
ClinicalTrials-MCP-Server
PostgreSQL
Frank Goortani CV MCP Server
好的,明白了。 这是一台提供关于弗兰克·古尔塔尼的简历的静态答案的 MCP 服务器。 (Zhè shì yī tái tígōng guānyú Fúlánkè Gǔ'ěrtǎní de jiǎnlì de jìngtài dá'àn de MCP fúwùqì.)
mcp-sam-experiment
尝试创建一个 MCP 服务器,以便我可以更多地了解它。
MCP-SERVER-WZH
Concept Activation Network (CAN) MCP Server
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!
MCP-FREDAPI
将 FRED (联邦储备经济数据) API 与模型上下文协议 (MCP) 集成
Download and Analyze Costco Receipts with MCP
不是好市多 (Costco) 的 MCP 服务器。
DomainGenius MCP Server
Think MCP tool
推理用的 MCP 服务器
Nessus MCP Server
PubChem MCP Server
🧪 通过一个简单的 MCP 界面,使 AI 助手能够搜索和访问化学化合物信息。
P-GitHubTestRepo
从 MCP 服务器演示创建。
China Weather MCP Server
MCP 服务器用于查询中国城市的天气。 (MCP fúwùqì yòng yú cháxún Zhōngguó chéngshì de tiānqì.) This translates to: "MCP server is used to query the weather in Chinese cities."
MCP KIPRIS
用于 KIPRIS Plus 的 MCP 服务器,用于专利检索
MarineTraffic MCP Server
MCP-Server for Data Analysis
Lyft_MCP_Server
MCP Servers Hub
镜子 (jìng zi)
mcp-md-vector-search
一个轻量级的 MCP 服务器实现,利用 PGLite 和 pgvector 对本地 Markdown 文档执行高效的相似性搜索,并使用模型上下文协议 (MCP)。
开发 SSE 类型的 MCP 服务
好的,这是对 "claude mcp sse demo with server and client(cli、web)" 的中文翻译,并附带一些解释: **翻译:** 使用 Claude MCP 实现 SSE 演示,包含服务端和客户端(命令行界面、网页)。 **解释:** * **Claude:** 指 Anthropic 公司的 Claude AI 模型。 这里可能指的是使用 Claude 的 API 或相关技术。 * **MCP:** 可能是 "Message Communication Protocol" 的缩写,或者是一个特定的项目/库的名称。 如果没有更多上下文,很难确定具体含义。 它通常指消息通信协议,用于在服务端和客户端之间传递数据。 * **SSE:** Server-Sent Events,服务器推送事件。 这是一种单向的通信协议,服务器可以主动向客户端推送数据,而客户端不需要频繁地发起请求。 * **Demo:** 演示程序,用于展示某个技术或功能的用法。 * **Server:** 服务端,负责处理请求、生成数据并推送给客户端。 * **Client:** 客户端,接收并显示服务端推送的数据。 * **CLI:** Command-Line Interface,命令行界面。 用户通过命令行输入指令与程序交互。 * **Web:** 网页,指通过浏览器访问的客户端界面。 **总的来说,这句话描述了一个使用 Claude (可能涉及其 API 或相关技术) 实现的 SSE 演示程序。 这个程序包含一个服务端和一个客户端。 客户端有两种形式:一种是命令行界面 (CLI),另一种是网页 (Web)。 服务端通过 SSE 协议向客户端推送数据。** 为了更准确地翻译和理解,需要更多关于 "MCP" 的信息。 如果能提供更多上下文,我可以给出更精确的翻译和解释。

Coco App
Coco AI 应用 - 搜索、连接、协作,你专属的 AI 搜索和助手,尽在一个空间。
medRxiv MCP Server
镜子 (jìng zi)
MongoDB MCP Server
镜子 (jìng zi)
YouTube Transcript Server
镜子 (jìng zi)