发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 86,267 个能力。
RobotFrameworkLibrary-to-MCP
Okay, here's a breakdown of how to turn a Robot Framework library into an MCP (Message Center Protocol) server, along with explanations and considerations: **Understanding the Goal** The core idea is to expose the functionality of your Robot Framework library as a service that can be accessed remotely via MCP. This allows other systems (potentially written in different languages or running on different machines) to trigger actions within your Robot Framework library. **Key Concepts** * **Robot Framework Library:** A collection of keywords (functions) that can be used in Robot Framework test cases. * **MCP (Message Center Protocol):** A lightweight protocol for inter-process communication. It's often used for sending commands and receiving responses between different applications or services. * **MCP Server:** A process that listens for MCP requests, processes them, and sends back responses. * **MCP Client:** A process that sends MCP requests to an MCP server. * **Serialization/Deserialization:** Converting data structures (like Python objects) into a format suitable for transmission over a network (e.g., JSON) and then converting them back on the receiving end. **General Approach** 1. **Choose an MCP Library/Framework:** You'll need a Python library that handles the MCP protocol. Some options include: * **`mcp` (Python Package):** A dedicated MCP library for Python. This is likely the most direct and appropriate choice. You can install it with `pip install mcp`. * **ZeroMQ (with MCP Implementation):** ZeroMQ is a powerful messaging library that can be used to implement MCP. This is a more general-purpose solution, but it might be overkill if you only need MCP. * **Other Messaging Libraries:** You *could* potentially use other messaging libraries (like RabbitMQ or Redis Pub/Sub), but you'd need to implement the MCP protocol on top of them, which is more complex. 2. **Create an MCP Server:** Write a Python script that: * Imports your Robot Framework library. * Uses the chosen MCP library to create a server that listens on a specific port. * Registers handlers for different MCP commands. Each handler will correspond to a keyword in your Robot Framework library. * When a command is received, the handler will: * Extract the arguments from the MCP message. * Call the corresponding Robot Framework keyword with those arguments. * Capture the return value (if any) from the keyword. * Serialize the return value (e.g., to JSON). * Send the serialized result back to the MCP client as an MCP response. 3. **Create an MCP Client (if needed for testing):** Write a Python script (or use a tool like `netcat`) that: * Uses the chosen MCP library to connect to the MCP server. * Sends MCP requests with the appropriate command name and arguments. * Receives and deserializes the MCP response. * Prints or processes the result. **Example using the `mcp` Python Package** ```python # server.py (MCP Server) import mcp import json from robot.libraries.BuiltIn import BuiltIn # Or import your custom library # Instantiate your Robot Framework library (or use BuiltIn for demonstration) # my_library = MyRobotLibrary() builtin = BuiltIn() def execute_keyword(keyword_name, *args): """Executes a Robot Framework keyword and returns the result.""" try: result = builtin.run_keyword(keyword_name, *args) return result except Exception as e: return {"error": str(e)} # Handle errors gracefully class MyMCPHandler(mcp.Handler): def handle_message(self, message): """Handles incoming MCP messages.""" try: command = message.command arguments = message.arguments if command == "log_message": # Example: Expose the 'Log' keyword result = execute_keyword("Log", arguments.get("message", "")) # Pass arguments as needed return mcp.Response(result=result) elif command == "get_variable_value": #Example: Expose the 'Get Variable Value' keyword variable_name = arguments.get("name") default_value = arguments.get("default", None) result = execute_keyword("Get Variable Value", variable_name, default_value) return mcp.Response(result=result) else: return mcp.Response(error="Unknown command: {}".format(command)) except Exception as e: return mcp.Response(error=str(e)) if __name__ == "__main__": server = mcp.Server(handler=MyMCPHandler()) server.start() # Defaults to port 7000 print("MCP server started on port 7000...") try: server.join() # Keep the server running except KeyboardInterrupt: print("Shutting down server...") server.stop() ``` ```python # client.py (MCP Client - for testing) import mcp import json def send_mcp_request(command, arguments): """Sends an MCP request and returns the response.""" try: client = mcp.Client() response = client.send_message(mcp.Message(command=command, arguments=arguments)) client.close() return response.result, response.error except Exception as e: return None, str(e) if __name__ == "__main__": # Example 1: Call the 'Log' keyword result, error = send_mcp_request("log_message", {"message": "Hello from MCP!"}) if error: print("Error:", error) else: print("Log Result:", result) # Example 2: Call the 'Get Variable Value' keyword result, error = send_mcp_request("get_variable_value", {"name": "${TEMPDIR}"}) if error: print("Error:", error) else: print("Variable Value:", result) ``` **Explanation of the Example** * **`server.py`:** * Imports the `mcp` library and `robot.libraries.BuiltIn`. Replace `robot.libraries.BuiltIn` with your actual Robot Framework library. * `execute_keyword` function: This is the crucial part. It takes a keyword name and arguments, and then uses `BuiltIn().run_keyword()` (or the equivalent for your library) to execute the keyword. Error handling is included. * `MyMCPHandler`: This class inherits from `mcp.Handler` and overrides the `handle_message` method. This method is called whenever the server receives an MCP message. * It extracts the command name and arguments from the message. * It uses a series of `if/elif/else` statements to determine which Robot Framework keyword to call based on the command name. * It calls `execute_keyword` to execute the keyword. * It creates an `mcp.Response` object with the result (or an error message) and returns it. * The `if __name__ == "__main__":` block creates an `mcp.Server` instance, starts it, and keeps it running until a `KeyboardInterrupt` (Ctrl+C) is received. * **`client.py`:** * Imports the `mcp` library. * `send_mcp_request` function: This function takes a command name and arguments, creates an `mcp.Message` object, sends it to the server, and returns the response. * The `if __name__ == "__main__":` block shows how to use the `send_mcp_request` function to call the `log_message` and `get_variable_value` commands. **How to Run the Example** 1. **Install `mcp`:** `pip install mcp` 2. **Save the code:** Save the server code as `server.py` and the client code as `client.py`. 3. **Run the server:** `python server.py` 4. **Run the client:** `python client.py` (in a separate terminal) You should see the "Hello from MCP!" message logged by the Robot Framework `Log` keyword, and the value of the `${TEMPDIR}` variable printed by the client. **Important Considerations and Enhancements** * **Error Handling:** The example includes basic error handling, but you should add more robust error handling to catch exceptions and return meaningful error messages to the client. * **Security:** MCP itself doesn't provide any security features. If you need to secure your MCP server, you'll need to implement your own security mechanisms (e.g., authentication, encryption). Consider using TLS/SSL for encryption. * **Argument Handling:** The example assumes that the arguments are passed as a dictionary. You might need to adjust the argument handling to match the specific requirements of your Robot Framework keywords. Consider using a more structured data format like JSON Schema to define the expected arguments for each command. * **Data Serialization:** The example uses JSON for serialization. You can use other serialization formats (e.g., Pickle, MessagePack) if needed. JSON is generally a good choice for interoperability. * **Asynchronous Operations:** If your Robot Framework keywords perform long-running operations, consider using asynchronous programming (e.g., `asyncio`) to prevent the MCP server from blocking. * **Configuration:** Use a configuration file (e.g., YAML, JSON) to store the server's port number, logging settings, and other configuration parameters. * **Logging:** Add logging to the server to track requests, responses, and errors. Use a logging library like `logging`. * **Command Discovery:** Implement a mechanism for the client to discover the available commands and their arguments. This could be done by adding a special "describe" command to the server. * **Robot Framework Listener:** You could potentially use a Robot Framework listener to automatically register keywords as MCP commands. This would reduce the amount of manual configuration required. * **Testing:** Write unit tests and integration tests to ensure that your MCP server is working correctly. **In summary, turning a Robot Framework library into an MCP server involves creating a Python script that listens for MCP requests, calls the appropriate Robot Framework keywords, and sends back the results as MCP responses. The `mcp` Python package provides a convenient way to implement the MCP protocol.** Remember to consider error handling, security, argument handling, and other important factors to create a robust and reliable service.
playwright-mcp-fetch
这个工具提供了一个模型上下文协议(MCP)服务器,用于从网站获取内容,并使用 Playwright 将其转换为不同的格式。
mcp-server-hub
创建一个单例 MCP 服务器中心,可供 Cline/Roo 代码使用。
PostgreSQL Model Context Protocol (PG-MCP) Server
code-rules-mcp
用于将代码规则可靠地读入 Agentic AI 上下文的 MCP 服务器。 (MCP 服务器用于可靠地将代码规则读入自主智能体 (Agentic AI) 的上下文。)
YouTube MCP Server
用于 YouTube 集成的媒体控制协议服务器
Bilibili API MCP Server
用于Bilibili API的MCP服务器,支持各种操作。
Local MCP-Server-with-HTTPS-and-GitHub-OAuth
这个项目是一个安全的 MCP 服务器,使用 Node.js 和 Express 构建。它具有以下特性:使用自签名证书的 HTTPS 加密、GitHub OAuth 身份验证,以及额外的安全措施,例如速率限制和 HTTP 头部保护。
Ixnetwork Mcp
IxNetwork 会话管理的 MCP 服务器
Kibela MCP Server
镜子 (jìng zi)
Cross-System Agent Communication MCP Server
镜子 (jìng zi)
Mcp Server Basic Sample
mcp-demo
一个使用 mcp-server 库的小型演示项目。
MCP Server for YouTube Transcript API
YouTube 集成的 MCP 服务器实现
MCP to LangChain/LangGraph Adapter
Okay, I understand. You want me to translate the following English sentence into Chinese: "Adapter that turns MCP server tools into langchain usable tools" Here are a few options, depending on the nuance you want to convey: **Option 1 (Most Literal):** * **将 MCP 服务器工具转换为 Langchain 可用工具的适配器** (Jiāng MCP fúwùqì gōngjù zhuǎnhuàn wéi Langchain kěyòng gōngjù de shìpèiqì) * This is a direct translation and is generally understandable. **Option 2 (Slightly More Natural):** * **一个将 MCP 服务器工具适配成 Langchain 可用工具的工具** (Yī gè jiāng MCP fúwùqì gōngjù shìpèi chéng Langchain kěyòng gōngjù de gōngjù) * This emphasizes that the adapter *is* a tool itself. It also uses "适配成" (shìpèi chéng) which implies adapting *into* something. **Option 3 (Focus on Integration):** * **用于将 MCP 服务器工具集成到 Langchain 的适配器** (Yòng yú jiāng MCP fúwùqì gōngjù jíchéng dào Langchain de shìpèiqì) * This focuses on the *integration* aspect, using the word "集成" (jíchéng), which means "integrate." **Breakdown of the terms:** * **Adapter:** 适配器 (shìpèiqì) * **MCP server tools:** MCP 服务器工具 (MCP fúwùqì gōngjù) * **turns into / adapts to:** 转换成 (zhuǎnhuàn chéng) / 适配成 (shìpèi chéng) * **Langchain usable tools:** Langchain 可用工具 (Langchain kěyòng gōngjù) * **Integrate:** 集成 (jíchéng) **Which option is best depends on the specific context.** If you want a simple, direct translation, Option 1 is fine. If you want to emphasize the adapter's role as a tool, Option 2 is better. If you want to highlight the integration aspect, Option 3 is the best choice.
Fastapi Mcp Server
FastAPI MCP Server 是一个使用 FastAPI 构建的 MCP (模型上下文协议) 服务器。 该项目旨在统一对各种工具和数据源的访问。
Bitrefill MCP Server
镜子 (jìng zi)
MCPE-ServerInfo
这是一个程序,它接收 Minecraft 基岩版服务器地址,并显示未连接的信息。
Openai Mcp Server
适用于 OpenAI 协议的 MCP 服务器
sufy-mcp-server
MCP Hello World Example
一个用于创建 MCP 服务器和客户端项目的模板项目
Magnet Desktop
用于探索 MCP (模型上下文协议) 服务器的 MacOS 和 Windows 桌面应用程序
MCP-Demo: Model Context Protocol Integration with OpenAI
初步的 C# MCP SDK 客户端-服务器 示例
zan-mcp-server
ZAN 节点服务的模型上下文协议服务器。
Brandfetch MCP Server
Brandfetch API 的模型上下文协议 (MCP) 服务器
mcp-prompt
发现提示 (Fāxiàn tíshì)
Discorevy local MCP Servers. Specification.
MCP 服务器发现规范
bigquery-mcp
一个 MCP 服务器,用于帮助 AI 代理检查 BigQuery 仓库的内容。 (Or, more formally:) 一个 MCP 服务器,旨在帮助人工智能代理检查 BigQuery 数据仓库的内容。
comfy-ui-mcp-server MCP server
镜子 (jìng zi)
mcp0
安全 MCP(模型上下文协议)服务器配置器/检查器,将配置的上下文暴露为 MCP 服务器。一次配置,可与任何 MCP 客户端重复使用。