Discover Awesome MCP Servers

Extend your agent with 14,499 capabilities via MCP servers.

All14,499
mermaid-preview-mcp

mermaid-preview-mcp

用于预览 Mermaid 图表并处理语法错误的 MCP 服务器。支持 GitHub 仓库可视化。

Debug MCP Server in VSCode

Debug MCP Server in VSCode

Okay, here's a basic example of a Minecraft Protocol (MCP) server in Python, along with instructions on how to set it up for debugging in VS Code. This is a *very* simplified example and doesn't implement the full Minecraft protocol. It's designed to be a starting point for learning and debugging. **Important Disclaimer:** Building a full Minecraft server is a complex undertaking. This example is a minimal starting point. You'll need to study the Minecraft protocol documentation to implement more features. **1. Install Necessary Libraries** First, you'll need the `nbt` library for handling NBT data (used in Minecraft data structures) and `struct` for packing and unpacking data. ```bash pip install nbt ``` **2. Python Code (mcp_server.py)** ```python import socket import struct import nbt import logging # Configure logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') def handle_client(conn, addr): """Handles a single client connection.""" try: logging.info(f"Connected by {addr}") # Handshake (Simplified) data = conn.recv(256) # Adjust buffer size as needed if not data: logging.warning(f"Client {addr} disconnected before handshake.") return # Example: Read packet length and ID (very basic) packet_length = data[0] packet_id = data[1] logging.debug(f"Received packet length: {packet_length}, packet ID: {packet_id}") # Respond to Handshake (Simplified) if packet_id == 0x00: # Assuming 0x00 is the handshake packet ID # Example response: A simple string response_string = "Hello, Minecraft client!" response_bytes = response_string.encode('utf-8') response_length = len(response_bytes) # Pack the length and the response response = struct.pack('>b', response_length) + response_bytes # >b is big endian unsigned byte conn.sendall(response) logging.info(f"Sent response to {addr}: {response_string}") else: logging.warning(f"Unknown packet ID: {packet_id}") except Exception as e: logging.exception(f"Error handling client {addr}: {e}") finally: conn.close() logging.info(f"Connection with {addr} closed.") def start_server(host, port): """Starts the MCP server.""" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Allow address reuse s.bind((host, port)) s.listen() logging.info(f"Server listening on {host}:{port}") while True: conn, addr = s.accept() handle_client(conn, addr) if __name__ == "__main__": HOST = "127.0.0.1" # Standard loopback interface address (localhost) PORT = 25565 # Minecraft default port start_server(HOST, PORT) ``` **3. VS Code Debug Configuration (launch.json)** Create a `.vscode` folder in the same directory as your `mcp_server.py` file. Inside `.vscode`, create a file named `launch.json`. Paste the following configuration into `launch.json`: ```json { "version": "0.2.0", "configurations": [ { "name": "Python: MCP Server", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": false // Set to false to debug library code if needed } ] } ``` **Explanation of `launch.json`:** * `"name"`: A descriptive name for your debug configuration. * `"type"`: Specifies the debugger type (Python). * `"request"`: `"launch"` means you're starting the program from VS Code. * `"program"`: `${file}` tells VS Code to run the currently open file (i.e., `mcp_server.py`). * `"console"`: `"integratedTerminal"` uses VS Code's built-in terminal for output. * `"justMyCode"`: `false` allows you to step into library code (like `nbt` or `socket`) if you need to debug issues there. Set to `true` to only debug your own code. **4. How to Debug** 1. **Open `mcp_server.py` in VS Code.** 2. **Set Breakpoints:** Click in the left margin of the editor next to the line numbers where you want to pause execution. Red dots will appear, indicating breakpoints. Good places to start are: * Inside the `handle_client` function, before and after `conn.recv(256)`. * Before `conn.sendall(response)`. 3. **Start Debugging:** Go to the "Run and Debug" view in VS Code (usually the icon looks like a play button with a bug). Select "Python: MCP Server" from the dropdown menu at the top, and click the green "Start Debugging" button (or press F5). 4. **Connect a Minecraft Client (Modified):** You can't connect a standard Minecraft client directly to this server because it doesn't implement the full protocol. You'll need a *very* simple client that just sends a basic handshake packet. Here's a Python example: ```python # simple_client.py import socket import struct HOST = "127.0.0.1" PORT = 25565 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) # Create a minimal handshake packet (length, packet ID) packet_length = 2 # Length of the packet (1 byte for length, 1 for ID) packet_id = 0x00 # Handshake packet ID (example) handshake_packet = struct.pack('>bb', packet_length, packet_id) # >bb is big endian unsigned byte s.sendall(handshake_packet) data = s.recv(1024) print(f"Received: {data.decode('utf-8')}") ``` 5. **Observe in VS Code:** When the client connects and sends data, the server will hit your breakpoints. You can then: * **Inspect Variables:** See the values of variables in the "Variables" pane. * **Step Through Code:** Use the "Step Over" (F10), "Step Into" (F11), and "Step Out" (Shift+F11) buttons to move through the code line by line. * **Evaluate Expressions:** Type expressions in the "Debug Console" to see their values. **Important Considerations and Next Steps:** * **Minecraft Protocol:** This is a *very* basic example. The real Minecraft protocol is complex. You *must* consult the official Minecraft protocol documentation (search for "Minecraft Protocol Documentation") to understand the packet formats, data types, and handshake process. There are also community-maintained resources. * **Packet Structure:** Minecraft packets have a specific structure: `[Length][Packet ID][Data]`. The `Length` field indicates the size of the rest of the packet. The `Packet ID` identifies the type of packet. The `Data` field contains the actual information. * **Data Types:** Minecraft uses specific data types like VarInt, VarLong, strings, and NBT data. You'll need to handle these correctly. The `nbt` library helps with NBT data. * **Handshake:** The handshake is the first step in the connection process. It involves the client sending information about the protocol version, server address, and port. The server must respond appropriately. * **State Management:** The server needs to keep track of the client's state (e.g., login status, game mode, position). * **Error Handling:** Robust error handling is crucial. Handle exceptions gracefully and log errors for debugging. * **Asynchronous Programming:** For a real-world server, you'll likely want to use asynchronous programming (e.g., `asyncio` in Python) to handle multiple clients concurrently without blocking. * **Security:** Consider security aspects like authentication and encryption. **Chinese Translation (Simplified Chinese):** 好的,这是一个用 Python 编写的 Minecraft 协议 (MCP) 服务器的基本示例,以及如何在 VS Code 中设置它以进行调试的说明。这是一个*非常*简化的示例,没有实现完整的 Minecraft 协议。它旨在作为学习和调试的起点。 **重要声明:** 构建一个完整的 Minecraft 服务器是一项复杂的任务。此示例是一个最小的起点。您需要研究 Minecraft 协议文档以实现更多功能。 **1. 安装必要的库** 首先,您需要 `nbt` 库来处理 NBT 数据(用于 Minecraft 数据结构)和 `struct` 来打包和解包数据。 ```bash pip install nbt ``` **2. Python 代码 (mcp_server.py)** ```python import socket import struct import nbt import logging # 配置日志 logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') def handle_client(conn, addr): """处理单个客户端连接。""" try: logging.info(f"连接来自 {addr}") # 握手 (简化) data = conn.recv(256) # 根据需要调整缓冲区大小 if not data: logging.warning(f"客户端 {addr} 在握手之前断开连接。") return # 示例:读取数据包长度和 ID(非常基本) packet_length = data[0] packet_id = data[1] logging.debug(f"接收到的数据包长度:{packet_length},数据包 ID:{packet_id}") # 响应握手 (简化) if packet_id == 0x00: # 假设 0x00 是握手数据包 ID # 示例响应:一个简单的字符串 response_string = "你好,Minecraft 客户端!" response_bytes = response_string.encode('utf-8') response_length = len(response_bytes) # 打包长度和响应 response = struct.pack('>b', response_length) + response_bytes # >b 是大端无符号字节 conn.sendall(response) logging.info(f"发送响应到 {addr}: {response_string}") else: logging.warning(f"未知的数据包 ID:{packet_id}") except Exception as e: logging.exception(f"处理客户端 {addr} 时出错:{e}") finally: conn.close() logging.info(f"与 {addr} 的连接已关闭。") def start_server(host, port): """启动 MCP 服务器。""" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # 允许地址重用 s.bind((host, port)) s.listen() logging.info(f"服务器监听在 {host}:{port}") while True: conn, addr = s.accept() handle_client(conn, addr) if __name__ == "__main__": HOST = "127.0.0.1" # 标准环回接口地址(localhost) PORT = 25565 # Minecraft 默认端口 start_server(HOST, PORT) ``` **3. VS Code 调试配置 (launch.json)** 在与 `mcp_server.py` 文件相同的目录中创建一个 `.vscode` 文件夹。 在 `.vscode` 内部,创建一个名为 `launch.json` 的文件。 将以下配置粘贴到 `launch.json` 中: ```json { "version": "0.2.0", "configurations": [ { "name": "Python: MCP Server", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": false // 如果需要调试库代码,请设置为 false } ] } ``` **`launch.json` 的说明:** * `"name"`:调试配置的描述性名称。 * `"type"`:指定调试器类型(Python)。 * `"request"`:`"launch"` 表示您从 VS Code 启动程序。 * `"program"`:`${file}` 告诉 VS Code 运行当前打开的文件(即 `mcp_server.py`)。 * `"console"`:`"integratedTerminal"` 使用 VS Code 的内置终端进行输出。 * `"justMyCode"`:`false` 允许您进入库代码(如 `nbt` 或 `socket`)进行调试(如果需要)。 设置为 `true` 仅调试您自己的代码。 **4. 如何调试** 1. **在 VS Code 中打开 `mcp_server.py`。** 2. **设置断点:** 在编辑器左侧的行号旁边单击,您想要暂停执行的位置。 将出现红色圆点,表示断点。 好的起点是: * 在 `handle_client` 函数内部,在 `conn.recv(256)` 之前和之后。 * 在 `conn.sendall(response)` 之前。 3. **开始调试:** 转到 VS Code 中的“运行和调试”视图(通常图标看起来像带有错误符号的播放按钮)。 从顶部的下拉菜单中选择“Python: MCP Server”,然后单击绿色的“开始调试”按钮(或按 F5)。 4. **连接 Minecraft 客户端(修改后的):** 您无法将标准的 Minecraft 客户端直接连接到此服务器,因为它没有实现完整的协议。 您需要一个*非常*简单的客户端,它只发送一个基本的握手数据包。 这是一个 Python 示例: ```python # simple_client.py import socket import struct HOST = "127.0.0.1" PORT = 25565 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) # 创建一个最小的握手数据包(长度,数据包 ID) packet_length = 2 # 数据包的长度(1 字节用于长度,1 字节用于 ID) packet_id = 0x00 # 握手数据包 ID(示例) handshake_packet = struct.pack('>bb', packet_length, packet_id) # >bb 是大端无符号字节 s.sendall(handshake_packet) data = s.recv(1024) print(f"接收到:{data.decode('utf-8')}") ``` 5. **在 VS Code 中观察:** 当客户端连接并发送数据时,服务器将命中您的断点。 然后,您可以: * **检查变量:** 在“变量”窗格中查看变量的值。 * **单步执行代码:** 使用“单步跳过”(F10)、“单步进入”(F11)和“单步跳出”(Shift+F11)按钮逐行移动代码。 * **评估表达式:** 在“调试控制台”中键入表达式以查看其值。 **重要注意事项和后续步骤:** * **Minecraft 协议:** 这是一个*非常*基本的示例。 真正的 Minecraft 协议非常复杂。 您*必须*查阅官方 Minecraft 协议文档(搜索“Minecraft Protocol Documentation”)以了解数据包格式、数据类型和握手过程。 还有社区维护的资源。 * **数据包结构:** Minecraft 数据包具有特定的结构:`[长度][数据包 ID][数据]`。 “长度”字段指示数据包其余部分的大小。“数据包 ID”标识数据包的类型。“数据”字段包含实际信息。 * **数据类型:** Minecraft 使用特定的数据类型,如 VarInt、VarLong、字符串和 NBT 数据。 您需要正确处理这些数据。 `nbt` 库有助于处理 NBT 数据。 * **握手:** 握手是连接过程中的第一步。 它涉及客户端发送有关协议版本、服务器地址和端口的信息。 服务器必须做出适当的响应。 * **状态管理:** 服务器需要跟踪客户端的状态(例如,登录状态、游戏模式、位置)。 * **错误处理:** 强大的错误处理至关重要。 优雅地处理异常并记录错误以进行调试。 * **异步编程:** 对于实际的服务器,您可能需要使用异步编程(例如,Python 中的 `asyncio`)来并发处理多个客户端而不阻塞。 * **安全性:** 考虑安全性方面,如身份验证和加密。 This should give you a good starting point for building and debugging your MCP server! Remember to consult the Minecraft protocol documentation for more details. Good luck!

WeCom Bot MCP Server

WeCom Bot MCP Server

镜子 (jìng zi)

GitHub MCP Server

GitHub MCP Server

用于 GitHub 集成的模型上下文协议服务器

Okta MCP Server

Okta MCP Server

Pinner MCP 📍

Pinner MCP 📍

将模型上下文协议 (MCP) 服务器用于将组件固定到其不可变版本

DNSDumpster - MCP Server

DNSDumpster - MCP Server

mcp-use-didwba

mcp-use-didwba

一个使用 didwba 作为认证技术的 MCP 客户端和服务器的例子。

McpDoc

McpDoc

一个 MCP 服务器,用于从代码生成 C4 架构图。

MemGPT MCP Server

MemGPT MCP Server

镜子 (jìng zi)

MCP-SSE4

MCP-SSE4

从 MCP 服务器演示创建。

Mcp Servers

Mcp Servers

Toolhouse MCP Server

Toolhouse MCP Server

镜子 (jìng zi)

Okta MCP Server

Okta MCP Server

使Claude能够与Okta的用户管理系统交互,提供检索用户详细信息、列出带有过滤选项的用户以及管理用户组的功能。

Whoop MCP Server

Whoop MCP Server

一个模型上下文协议服务器,为语言模型提供访问个人 Whoop 健身数据的权限,允许从 Whoop API 查询周期、恢复、运动强度和锻炼信息。

Trello-Claude интеграция

Trello-Claude интеграция

在 Smithery.ai 上通过 MCP Server 将 Claude 与 Trello 集成

MCP Server Search

MCP Server Search

MCP 服务器使用搜索引擎来获取互联网上相关信息的位置。

MyMcpServer MCP Server

MyMcpServer MCP Server

MCP-Wikipedia-API-Server

MCP-Wikipedia-API-Server

一个 FastAPI-MCP 服务器,用于为 AI 助手获取维基百科摘要,使用 Google Colab 和 Ngrok 部署。

ConnectWise Manage MCP Server

ConnectWise Manage MCP Server

镜子 (jìng zi)

Flipt MCP Server

Flipt MCP Server

Flipt 的 MCP 服务器允许 AI 助手和 LLM 通过标准化的界面直接与您的功能标志、用户分群和评估进行交互。 例如,您可以询问您的 AI 助手: “‘dark-mode’ 功能标志的当前状态是什么?”

Twitter MCP Server for Claude Desktop

Twitter MCP Server for Claude Desktop

mcp-server-skyfireWhat is mcp-server-skyfire?How to use mcp-server-skyfire?Key features of mcp-server-skyfire:Use cases of mcp-server-skyfire:FAQ from mcp-server-skyfire:

mcp-server-skyfireWhat is mcp-server-skyfire?How to use mcp-server-skyfire?Key features of mcp-server-skyfire:Use cases of mcp-server-skyfire:FAQ from mcp-server-skyfire:

ComfyUI MCP Server

ComfyUI MCP Server

Zipic MCP Server

Zipic MCP Server

一个模型上下文协议服务器,通过 Zipic 应用提供图像压缩和优化功能。

MCP server

MCP server

Unity AI MCP Server

Unity AI MCP Server

一个MCP服务器,为Unity游戏开发提供人工智能驱动的工具和辅助功能。

EntityIdentification

EntityIdentification

That's a good translation! Here are a couple of minor variations that might be slightly more natural, depending on the specific context: * **More literal:** 用于识别两组数据是否来自同一实体的 MCP (模型上下文协议) 服务器。 (This is very close to your original and perfectly fine.) * **Slightly more common phrasing:** 用于识别两组数据是否属于同一实体的 MCP (模型上下文协议) 服务器。 (This uses "属于" which means "belong to" and is often used when discussing data and entities.) So, all three are good, but I'd probably lean towards the last one: **用于识别两组数据是否属于同一实体的 MCP (模型上下文协议) 服务器。**

convex-mcp-server MCP Server

convex-mcp-server MCP Server

gitlab-mr-mcp-server

gitlab-mr-mcp-server

Here are a few ways to interpret "MCP server to work with GitLab MR" and their corresponding Chinese translations, along with some context: **1. Referring to a server that performs Merge Checks/Pre-Merge Checks for GitLab Merge Requests:** * **Chinese Translation:** 用于 GitLab 合并请求的合并检查/预合并检查服务器 (Yòng yú GitLab hébìng qǐngqiú de hébìng jiǎnchá/yù hébìng jiǎnchá fúwùqì) * **Explanation:** This is the most likely interpretation. It refers to a server that runs automated checks (like code style, security scans, tests) on a Merge Request *before* it's merged into the main branch. This helps ensure code quality and prevents broken code from being integrated. **2. Referring to a server that integrates with GitLab Merge Requests for a specific purpose (e.g., deployment, testing):** * **Chinese Translation (General):** 与 GitLab 合并请求集成的服务器 (Yǔ GitLab hébìng qǐngqiú jíchéng de fúwùqì) * **Chinese Translation (Specific - e.g., Deployment):** 与 GitLab 合并请求集成的部署服务器 (Yǔ GitLab hébìng qǐngqiú jíchéng de bùshǔ fúwùqì) * **Explanation:** This is a more general interpretation. It means the server interacts with GitLab MRs in some way. The specific purpose needs to be clarified. Examples include: * **Deployment Server:** Automatically deploys code when a MR is merged. * **Testing Server:** Runs integration tests on the code in the MR. **3. If "MCP" is a specific acronym or tool:** * **Chinese Translation:** 用于 GitLab 合并请求的 MCP 服务器 (Yòng yú GitLab hébìng qǐngqiú de MCP fúwùqì) * **Explanation:** If "MCP" is a specific tool or system, then simply transliterate it and add "服务器" (server). You'll need to provide more context about what "MCP" is. **Which translation is best depends on the context. To give you the most accurate translation, please provide more information about what you mean by "MCP server." For example:** * What does "MCP" stand for? * What is the purpose of this server? * What kind of checks or actions should it perform on GitLab MRs? Once you provide more details, I can give you a more precise and helpful translation.