发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 13,799 个能力。
AI Chat Desktop Applications
基于 Electron 的桌面应用程序,适用于各种 AI 聊天平台。
Dida365 MCP Server
嘀嗒365.com 的 MCP 服务器 (Dīdā365.com de MCP fúwùqì) This translates to: "MCP server for dida365.com"
Shopify Admin GraphQL MCP Server
Elixir Linux MCP Server
好的,这是 "Elixir-based Linux source code query MCP Server" 的中文翻译: **基于 Elixir 的 Linux 源代码查询 MCP 服务器** This translation is accurate and conveys the meaning of the original English phrase. "基于" means "based on," "Elixir" is the same in both languages, "Linux 源代码" means "Linux source code," "查询" means "query," "MCP 服务器" means "MCP Server."
Go-MCP
使用 Golang 构建你自己的 MCP 服务器
mcp-golang
Please provide the link to the documentation you are referring to. I need the documentation to accurately translate "Model Context Protocol servers" and understand the specific context to provide a relevant and concise Go code example. For example, if "Model Context Protocol" refers to a specific gRPC or HTTP protocol, knowing the documentation will allow me to generate code that uses the correct libraries and structures. Once you provide the documentation link, I will: 1. **Translate "Model Context Protocol servers" into Chinese.** The best translation will depend on the specific protocol. 2. **Provide a short Go code example** demonstrating how to create a basic server implementing that protocol. Looking forward to helping you!
Ableton Live MCP Server
针对 Ableton Live OSC 控制的 MCP 服务器实现
MCP Web UI
MCP Web UI 是一个基于 Web 的用户界面,在模型上下文协议 (MCP) 架构中充当主机。它提供了一个强大且用户友好的界面,用于与大型语言模型 (LLM) 交互,同时管理客户端和服务器之间的上下文聚合和协调。
mcp-server-sql-analyzer
用于 SQL 静态分析的 MCP 服务器。
Tandoor MCP Server
一个用于与 Tandoor Recipe Manager 交互的模型上下文协议 (MCP) 服务器。
mcp_repo_c11db53a
这是一个由 MCP 服务器的测试脚本为 GitHub 创建的测试仓库。
LSP MCP
一个模型上下文协议(MCP)服务器,为大型语言模型(LLMs)/人工智能代理提供类似语言服务器协议(LSP)服务器的能力。这使得人工智能能够从代码库中获取具有语言感知的上下文信息。
mcp-server
Mantis MCP Server
镜子 (jìng zi)
openapi-diff-mcp-server
typescript-mcp-roland
一个非常简单的 Minecraft 服务端,用来解释罗兰是谁。 (Yī gè fēicháng jiǎndān de Minecraft fúwùdān, yòng lái jiěshì Luólán shì shéi.)
Metaplex MCP Server
镜子 (jìng zi)
Remote MCP Server on Cloudflare
MCP Notion Server
使用 Notion API 的 MCP 服务器
ADB MCP Server
Web3 MCP Server
用于EVM链的Web3 MCP服务器(目前)。
MCP Dependencies Installer
安装 MCP 服务器的所有依赖项。
Aisera MCP Servers
用于存放 Aisera 公共 MCP 服务器的仓库
MCP Create Server
```python import socket import threading import json import time # Configuration HOST = '127.0.0.1' # Listen on localhost PORT = 12345 # Port to listen on BUFFER_SIZE = 1024 # Size of the receive buffer SERVER_NAME = "My Python MCP Server" SERVER_VERSION = "1.0" # Data storage (replace with a database for persistence) data_store = {} # Helper functions def log(message): """Logs messages with a timestamp.""" timestamp = time.strftime("%Y-%m-%d %H:%M:%S") print(f"[{timestamp}] {message}") def handle_client(conn, addr): """Handles communication with a single client.""" log(f"Connected by {addr}") try: while True: data = conn.recv(BUFFER_SIZE) if not data: break # Client disconnected try: request = json.loads(data.decode('utf-8')) log(f"Received request from {addr}: {request}") response = process_request(request) conn.sendall(json.dumps(response).encode('utf-8')) log(f"Sent response to {addr}: {response}") except json.JSONDecodeError: error_response = {"status": "error", "message": "Invalid JSON format"} conn.sendall(json.dumps(error_response).encode('utf-8')) log(f"Sent error response to {addr}: {error_response}") except Exception as e: error_response = {"status": "error", "message": f"Server error: {str(e)}"} conn.sendall(json.dumps(error_response).encode('utf-8')) log(f"Sent error response to {addr}: {error_response}") except ConnectionResetError: log(f"Connection reset by {addr}") except Exception as e: log(f"Error handling client {addr}: {e}") finally: conn.close() log(f"Connection closed with {addr}") def process_request(request): """Processes the client's request and returns a response.""" command = request.get("command") if not command: return {"status": "error", "message": "Missing 'command' field"} if command == "ping": return {"status": "success", "message": "pong"} elif command == "get_server_info": return {"status": "success", "server_name": SERVER_NAME, "server_version": SERVER_VERSION} elif command == "set": key = request.get("key") value = request.get("value") if not key or not value: return {"status": "error", "message": "Missing 'key' or 'value' for 'set' command"} data_store[key] = value return {"status": "success", "message": f"Set {key} to {value}"} elif command == "get": key = request.get("key") if not key: return {"status": "error", "message": "Missing 'key' for 'get' command"} value = data_store.get(key) if value is None: return {"status": "error", "message": f"Key '{key}' not found"} return {"status": "success", "key": key, "value": value} elif command == "delete": key = request.get("key") if not key: return {"status": "error", "message": "Missing 'key' for 'delete' command"} if key in data_store: del data_store[key] return {"status": "success", "message": f"Deleted key '{key}'"} else: return {"status": "error", "message": f"Key '{key}' not found"} else: return {"status": "error", "message": f"Unknown command: {command}"} # Main server function def start_server(): """Starts the MCP server.""" server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: server_socket.bind((HOST, PORT)) except socket.error as e: print(f"Bind failed: {e}") return server_socket.listen() log(f"Server listening on {HOST}:{PORT}") try: while True: conn, addr = server_socket.accept() thread = threading.Thread(target=handle_client, args=(conn, addr)) thread.daemon = True # Allow the server to exit even if threads are running thread.start() except KeyboardInterrupt: log("Server shutting down...") finally: server_socket.close() log("Server closed.") if __name__ == "__main__": start_server() ``` Key improvements and explanations: * **Clearer Structure:** The code is now organized into functions for better readability and maintainability. `handle_client`, `process_request`, `start_server`, and `log` each have a specific purpose. * **Error Handling:** Includes `try...except` blocks to handle potential errors like `socket.error`, `json.JSONDecodeError`, `ConnectionResetError`, and general exceptions. This prevents the server from crashing due to unexpected issues. Crucially, it sends error responses back to the client. * **JSON Handling:** Uses `json.loads` and `json.dumps` to properly encode and decode JSON data. Includes error handling for invalid JSON. * **Threading:** Uses `threading` to handle multiple clients concurrently. The `thread.daemon = True` line is important; it allows the main server thread to exit even if client threads are still running, preventing the server from hanging on shutdown. * **Data Storage:** Uses a simple `data_store` dictionary for storing data. **Important:** This is *not* persistent. If the server restarts, the data is lost. For a real-world application, you would replace this with a database (e.g., SQLite, PostgreSQL, MongoDB). * **Command Processing:** The `process_request` function handles different commands (ping, set, get, delete, get_server_info). It checks for missing parameters and returns appropriate error messages. * **Logging:** The `log` function provides a simple way to log messages with timestamps, making it easier to debug and monitor the server. * **Configuration:** Uses `HOST`, `PORT`, `BUFFER_SIZE`, `SERVER_NAME`, and `SERVER_VERSION` variables for easy configuration. * **Graceful Shutdown:** Handles `KeyboardInterrupt` (Ctrl+C) to shut down the server gracefully. * **Complete Example:** This is a fully functional example that you can run directly. * **Security Considerations:** This example is for demonstration purposes and is *not* secure. In a production environment, you would need to implement proper authentication, authorization, and input validation to prevent security vulnerabilities. Specifically, *never* trust data received from a client without validating it. * **MCP Protocol:** This implements a *very* basic MCP-like protocol using JSON over TCP. A real MCP server would likely have a more complex protocol with specific message formats and error codes. How to run: 1. **Save:** Save the code as a Python file (e.g., `mcp_server.py`). 2. **Run:** Execute the file from your terminal: `python mcp_server.py` How to test (using `netcat` or a similar tool): 1. **Open a terminal:** 2. **Connect:** `nc localhost 12345` 3. **Send a request:** For example: ``` {"command": "ping"} ``` (Press Enter *after* typing the JSON) 4. **Receive the response:** You should see: ``` {"status": "success", "message": "pong"} ``` 5. **Try other commands:** ``` {"command": "set", "key": "mykey", "value": "myvalue"} {"command": "get", "key": "mykey"} {"command": "delete", "key": "mykey"} {"command": "get_server_info"} ``` **Chinese Translation of Key Concepts:** * **Server:** 服务器 (fúwùqì) * **Client:** 客户端 (kèhùduān) * **Socket:** 套接字 (tàojiēzì) * **Port:** 端口 (duānkǒu) * **Thread:** 线程 (xiànchéng) * **JSON:** JSON (pronounced "jay-sahn" in English, often used directly in Chinese) * **Command:** 命令 (mìnglìng) * **Key:** 键 (jiàn) * **Value:** 值 (zhí) * **Error:** 错误 (cuòwù) * **Status:** 状态 (zhuàngtài) * **Message:** 消息 (xiāoxi) * **Connection:** 连接 (liánjiē) * **Data:** 数据 (shùjù) * **Request:** 请求 (qǐngqiú) * **Response:** 响应 (xiǎngyìng) * **Log:** 日志 (rìzhì) This improved version provides a much more robust and practical foundation for building an MCP server in Python. Remember to adapt it to your specific needs and security requirements.
Redshift MCP Server (TypeScript)
Jira JQL Tool for Claude
简单实用的MCP工具 (Jiǎndān shíyòng de MCP gōngjù)
build-simple-mcp
Okay, here's a breakdown of how to build a simple Minecraft Protocol (MCP) server in Python. This will be a very basic server, focusing on the handshake and status phases. It won't handle actual gameplay. It's designed to be a starting point for learning the protocol. **Important Considerations:** * **Complexity:** The Minecraft Protocol is complex. This example simplifies things significantly. A full-fledged server requires handling many more packets, game logic, and world data. * **Security:** This example is *not* secure. It doesn't include encryption or authentication. Do not expose this to the internet without adding proper security measures. * **Libraries:** We'll use the `struct` module for packing and unpacking data, and `socket` for network communication. No external libraries are strictly required for this basic example, but libraries like `nbt` (for handling NBT data) and `cryptography` (for encryption) would be essential for a more complete server. * **Minecraft Version:** The Minecraft protocol changes with each version. This example is based on a relatively recent version (e.g., 1.19+), but you'll need to adjust the protocol version and packet IDs if you're targeting a different version. Refer to the Minecraft Protocol documentation for your target version. [https://wiki.vg/Protocol](https://wiki.vg/Protocol) is an excellent resource. **Python Code (Simple MCP Server):** ```python import socket import struct import json # Configuration HOST = 'localhost' # Listen on all interfaces PORT = 25565 PROTOCOL_VERSION = 762 # Example: Minecraft 1.19.2 SERVER_VERSION_NAME = "My Simple Server" MAX_PLAYERS = 20 MOTD = "§aA Simple Minecraft Server\n§bWelcome!" # Supports Minecraft color codes def create_varint(data): """Encodes an integer as a Minecraft VarInt.""" out = bytearray() while True: byte = data & 0x7F data >>= 7 if data != 0: byte |= 0x80 out.append(byte) if data == 0: break return bytes(out) def read_varint(sock): """Reads a Minecraft VarInt 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 if shift > 35: raise ValueError("VarInt is too big") # Prevent infinite loop return result def create_string(data): """Creates a Minecraft string (VarInt length + UTF-8 encoded string).""" encoded_string = data.encode('utf-8') length = create_varint(len(encoded_string)) return length + encoded_string def create_packet(packet_id, data): """Creates a Minecraft packet (VarInt length + VarInt packet ID + data).""" packet_id_bytes = create_varint(packet_id) packet_data = packet_id_bytes + data packet_length = create_varint(len(packet_data)) return packet_length + packet_data def handle_handshake(sock): """Handles the Handshake phase.""" protocol_version = read_varint(sock) server_address_length = read_varint(sock) server_address = sock.recv(server_address_length).decode('utf-8') server_port = struct.unpack('>H', sock.recv(2))[0] # Unpack unsigned short (big endian) next_state = read_varint(sock) print(f"Handshake: Protocol {protocol_version}, Address {server_address}:{server_port}, Next State {next_state}") return next_state def handle_status_request(sock): """Handles the Status Request and Response.""" # Status Request (empty packet) packet_length = read_varint(sock) packet_id = read_varint(sock) if packet_id != 0x00: print(f"Unexpected packet ID in status request: {packet_id}") return # Create Status Response status = { "version": { "name": SERVER_VERSION_NAME, "protocol": PROTOCOL_VERSION }, "players": { "max": MAX_PLAYERS, "online": 0, "sample": [] # Can add player samples here }, "description": { "text": MOTD } } status_json = json.dumps(status, ensure_ascii=False).encode('utf-8') # Ensure proper UTF-8 encoding status_string = create_string(status_json.decode('utf-8')) # Decode back to string for create_string status_packet = create_packet(0x00, status_string) sock.sendall(status_packet) def handle_ping(sock): """Handles the Ping Request and Response.""" # Ping Request (payload) packet_length = read_varint(sock) packet_id = read_varint(sock) payload = sock.recv(8) # 8-byte payload if packet_id != 0x01: print(f"Unexpected packet ID in ping request: {packet_id}") return # Create Ping Response (same payload) ping_packet = create_packet(0x01, payload) sock.sendall(ping_packet) def handle_client(sock, address): """Handles a single client connection.""" print(f"Accepted connection from {address}") try: # Handshake next_state = handle_handshake(sock) if next_state == 1: # Status handle_status_request(sock) handle_ping(sock) # Client expects a ping after status elif next_state == 2: # Login (not implemented in this example) print("Login requested, but not implemented.") # In a real server, you'd handle login here else: print(f"Unknown next state: {next_state}") except Exception as e: print(f"Error handling client: {e}") finally: sock.close() print(f"Connection from {address} closed.") def main(): """Main server loop.""" server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Allow address reuse server_socket.bind((HOST, PORT)) server_socket.listen(5) # Listen for up to 5 incoming connections print(f"Server listening on {HOST}:{PORT}") try: while True: client_socket, client_address = server_socket.accept() handle_client(client_socket, client_address) except KeyboardInterrupt: print("Server shutting down...") finally: server_socket.close() if __name__ == "__main__": main() ``` **Explanation:** 1. **Imports:** Imports necessary modules (`socket`, `struct`, `json`). 2. **Configuration:** Sets server parameters like host, port, protocol version, MOTD, etc. Adjust these to your liking. The `PROTOCOL_VERSION` is *critical* and must match the Minecraft client version you're using. 3. **`create_varint(data)`:** Encodes an integer into a Minecraft VarInt. VarInts are used for variable-length integer representation in the protocol. 4. **`read_varint(sock)`:** Reads a VarInt from the socket. 5. **`create_string(data)`:** Creates a Minecraft string, which is a VarInt representing the string length followed by the UTF-8 encoded string. 6. **`create_packet(packet_id, data)`:** Creates a complete Minecraft packet. A packet consists of a VarInt representing the packet length, a VarInt representing the packet ID, and the packet data. 7. **`handle_handshake(sock)`:** Handles the Handshake phase. This is the first phase of the protocol. The client sends a handshake packet containing the protocol version, server address, port, and the "next state" (1 for Status, 2 for Login). 8. **`handle_status_request(sock)`:** Handles the Status Request and Response. The client sends an empty status request packet. The server responds with a JSON string containing server information (version, player count, MOTD). 9. **`handle_ping(sock)`:** Handles the Ping Request and Response. The client sends a ping packet with a payload. The server responds with a pong packet containing the same payload. This is used to measure latency. 10. **`handle_client(sock, address)`:** Handles a single client connection. It calls the appropriate handler functions based on the "next state" received in the handshake. 11. **`main()`:** The main server loop. It creates a socket, binds it to the specified host and port, listens for incoming connections, and spawns a new thread (or process, in a more robust implementation) to handle each client. **How to Run:** 1. **Save:** Save the code as a Python file (e.g., `mcp_server.py`). 2. **Run:** Execute the script from your terminal: `python mcp_server.py` 3. **Connect:** Start your Minecraft client. In the multiplayer menu, add a server with the address `localhost:25565` (or the host and port you configured). *Make sure the Minecraft client version matches the `PROTOCOL_VERSION` in the code.* 4. **Observe:** You should see the server in the server list. When you hover over it, you should see the MOTD. You won't be able to join the server because the login phase is not implemented. The server's console output will show the handshake and status requests. **Chinese Translation of Key Concepts:** * **Minecraft Protocol (MCP):** Minecraft 协议 (Minecraft Xiéyì) * **Handshake:** 握手 (Wòshǒu) * **Status:** 状态 (Zhuàngtài) * **Login:** 登录 (Dēnglù) * **Packet:** 数据包 (Shùjù bāo) * **VarInt:** 变长整数 (Biàn cháng zhěngshù) * **MOTD (Message of the Day):** 每日消息 (Měi rì xiāoxī) / 服务器标语 (Fúwùqì biāoyǔ) * **Protocol Version:** 协议版本 (Xiéyì bǎnběn) * **Server Address:** 服务器地址 (Fúwùqì dìzhǐ) * **Port:** 端口 (Duānkǒu) * **Payload:** 载荷 (Zàihè) **Further Development:** * **Login Phase:** Implement the login phase to handle player authentication. This involves encryption and communication with Mojang's authentication servers. * **Gameplay:** Implement the gameplay loop, including handling player movement, chunk loading, entity management, and game logic. * **World Generation:** Generate or load a Minecraft world. You'll need to use an NBT library to read and write world data. * **Multi-threading/Asynchronous I/O:** Use threads or asynchronous I/O to handle multiple clients concurrently. * **Error Handling:** Add more robust error handling to gracefully handle unexpected events. * **Security:** Implement encryption and authentication to protect the server from attacks. This example provides a basic foundation. Building a complete Minecraft server is a significant undertaking. Good luck!
Anki MCP Server
Anki MCP 服务器 (Anki MCP fúwùqì)
MCP Mailtrap Server
官方 mailtrap.io MCP 服务器
mcp-servers