Discover Awesome MCP Servers

Extend your agent with 12,420 capabilities via MCP servers.

All12,420
MCP Client Example ☀️

MCP Client Example ☀️

Okay, here's a basic example of a Python client and server using the `mcp` (Memcached Client Protocol) library. This assumes you're using a Memcached server. If you don't have one running, you'll need to install and start it (e.g., `sudo apt install memcached` on Debian/Ubuntu, or `brew install memcached` on macOS with Homebrew). **Important Notes:** * **`mcp` Library:** The `mcp` library is not a standard Python library. You'll likely need to install it using `pip install python-memcached`. However, the `python-memcached` library is more commonly used and provides similar functionality. This example will use `python-memcached`. * **Error Handling:** This is a simplified example. Real-world code should include more robust error handling (e.g., catching connection errors, handling timeouts, etc.). * **Security:** Memcached, by default, doesn't have strong security features. It's generally designed for internal use within a trusted network. Don't expose it directly to the internet without proper security measures. **Server (Memcached - No Python Server Needed)** You don't need a separate Python server script. Memcached *is* the server. Just make sure it's running. The client will connect to it. 1. **Install Memcached (if you don't have it):** * **Linux (Debian/Ubuntu):** `sudo apt update && sudo apt install memcached` * **macOS (with Homebrew):** `brew install memcached` * **Windows:** Download a pre-built binary (search online for "memcached windows download"). You might need to run it as an administrator. 2. **Start Memcached:** * On most systems, it will start automatically after installation. If not, try: * `sudo systemctl start memcached` (Linux) * `brew services start memcached` (macOS) * For Windows, follow the instructions that came with the binary you downloaded. * The default port is usually 11211. **Client (Python)** ```python import memcache # Memcached server address and port MEMCACHED_HOST = '127.0.0.1' # Localhost MEMCACHED_PORT = 11211 try: # Connect to the Memcached server mc = memcache.Client([f'{MEMCACHED_HOST}:{MEMCACHED_PORT}']) # Set a key-value pair key = 'my_key' value = 'Hello, Memcached!' mc.set(key, value) print(f"Set key '{key}' to value '{value}'") # Get the value associated with the key retrieved_value = mc.get(key) if retrieved_value: print(f"Retrieved value for key '{key}': {retrieved_value.decode('utf-8')}") # Decode if necessary else: print(f"Key '{key}' not found in Memcached.") # Delete the key mc.delete(key) print(f"Deleted key '{key}'") # Try to get the value again (should be None) retrieved_value = mc.get(key) if retrieved_value: print(f"Retrieved value for key '{key}': {retrieved_value}") else: print(f"Key '{key}' not found in Memcached (after deletion).") except Exception as e: print(f"An error occurred: {e}") ``` **How to Run:** 1. **Save:** Save the Python code as a `.py` file (e.g., `memcached_client.py`). 2. **Run:** Execute the Python script from your terminal: `python memcached_client.py` **Explanation:** 1. **`import memcache`:** Imports the `memcache` library. 2. **`MEMCACHED_HOST` and `MEMCACHED_PORT`:** Defines the Memcached server's address and port. The default is usually localhost (127.0.0.1) and port 11211. 3. **`memcache.Client(...)`:** Creates a connection to the Memcached server. You can specify multiple servers for redundancy. 4. **`mc.set(key, value)`:** Sets a key-value pair in Memcached. The `key` is a string, and the `value` can be a string, number, or other Python object (it will be serialized). 5. **`mc.get(key)`:** Retrieves the value associated with a key. Returns `None` if the key doesn't exist. The returned value is often a byte string, so you might need to decode it using `.decode('utf-8')` if you stored a string. 6. **`mc.delete(key)`:** Deletes a key from Memcached. **Example Output:** ``` Set key 'my_key' to value 'Hello, Memcached!' Retrieved value for key 'my_key': Hello, Memcached! Deleted key 'my_key' Key 'my_key' not found in Memcached (after deletion). ``` **Chinese Translation of Key Concepts:** * **Memcached:** 内存缓存 (Nèi cún huǎn cún) - Memory Cache * **Key:** 键 (Jiàn) * **Value:** 值 (Zhí) * **Set:** 设置 (Shè zhì) * **Get:** 获取 (Huò qǔ) * **Delete:** 删除 (Shān chú) * **Client:** 客户端 (Kè hù duān) * **Server:** 服务器 (Fú wù qì) * **Connection:** 连接 (Lián jiē) * **Port:** 端口 (Duān kǒu) * **Localhost:** 本地主机 (Běn dì zhǔ jī) **Example with Chinese Characters:** ```python import memcache MEMCACHED_HOST = '127.0.0.1' MEMCACHED_PORT = 11211 try: mc = memcache.Client([f'{MEMCACHED_HOST}:{MEMCACHED_PORT}']) key = '我的键' # My Key value = '你好,Memcached!' # Hello, Memcached! mc.set(key, value) print(f"设置键 '{key}' 为值 '{value}'") # Set key '{key}' to value '{value}' retrieved_value = mc.get(key) if retrieved_value: print(f"获取键 '{key}' 的值: {retrieved_value.decode('utf-8')}") # Retrieved value for key '{key}': {retrieved_value} else: print(f"在 Memcached 中找不到键 '{key}'。") # Key '{key}' not found in Memcached. mc.delete(key) print(f"删除键 '{key}'") # Deleted key '{key}' retrieved_value = mc.get(key) if retrieved_value: print(f"获取键 '{key}' 的值: {retrieved_value}") else: print(f"在 Memcached 中找不到键 '{key}' (删除后)。") # Key '{key}' not found in Memcached (after deletion). except Exception as e: print(f"发生错误: {e}") # An error occurred: {e} ``` This example demonstrates how to use Chinese characters for keys and values. Make sure your terminal and code editor are configured to support UTF-8 encoding. The `.decode('utf-8')` is important when retrieving the value to convert the byte string back into a regular Python string with Chinese characters.

Gemini MCP Server

Gemini MCP Server

实现模型上下文协议 (MCP) 服务器,使 Claude Desktop 能够与 Google 的 Gemini AI 模型交互。

Screenshot MCP Server

Screenshot MCP Server

启用 AI 工具来捕获和处理用户屏幕的截图,从而允许 AI 助手通过一个简单的 MCP 接口来查看和分析用户正在看的内容。

mcp-mananger-desktop

mcp-mananger-desktop

进行中:一个 MCP 服务器,用于搜索、安装、卸载你的所有 MCP 服务器或 Claude 应用(或更多)的服务。

MCP Go SDK

MCP Go SDK

这个 SDK 提供了机器控制协议 (MCP) 的 Go 语言实现,支持客户端和服务器之间的双向通信,用于工具执行、资源访问和提示处理。基于...

GRID MCP Server

GRID MCP Server

一个 MCP 服务器,用于直接从 Claude 桌面版使用 GRID API。 (Yī gè MCP fúwùqì, yòng yú zhíjiē cóng Claude zhuōmiàn bǎn shǐyòng GRID API.)

Modal MCP Server

Modal MCP Server

一个 MCP 服务器,使 AI 代理能够与 Modal 交互,允许它们在无服务器云环境中部署应用程序和运行函数。

Terminal MCP Server

Terminal MCP Server

This request is a bit ambiguous. "MCP server" could refer to several things, and the desired functionality isn't entirely clear. However, I can provide a translation based on a few possible interpretations and offer some clarification questions. Here are a few translations, depending on what "MCP server" means: **Interpretation 1: "MCP" refers to a specific software or protocol (unlikely without more context).** * **Translation:** 用于通过 Claude Desktop 执行终端命令的 MCP 服务器 (Yòng yú tōngguò Claude Desktop zhíxíng zhōngduān mìnglìng de MCP fúwùqì) * **Explanation:** This is a direct translation, assuming "MCP" is a known term. It translates to "MCP server for executing terminal commands through Claude Desktop." **Interpretation 2: "MCP" is a general term for a server that manages command execution (more likely).** * **Translation:** 用于通过 Claude Desktop 执行终端命令的 **命令执行** 服务器 (Yòng yú tōngguò Claude Desktop zhíxíng zhōngduān mìnglìng de **mìnglìng zhíxíng** fúwùqì) * **Explanation:** This replaces "MCP" with "命令执行" (mìnglìng zhíxíng), which means "command execution." It translates to "Command execution server for executing terminal commands through Claude Desktop." **Interpretation 3: A server that allows remote command execution via Claude Desktop.** * **Translation:** 允许通过 Claude Desktop 远程执行终端命令的服务器 (Yǔnxǔ tōngguò Claude Desktop yuǎnchéng zhíxíng zhōngduān mìnglìng de fúwùqì) * **Explanation:** This focuses on the remote aspect. It translates to "A server that allows remote execution of terminal commands through Claude Desktop." **Interpretation 4: A server that acts as a bridge between Claude Desktop and the terminal.** * **Translation:** 作为 Claude Desktop 和终端之间桥梁的服务器 (Zuòwéi Claude Desktop hé zhōngduān zhījiān qiáoliáng de fúwùqì) * **Explanation:** This emphasizes the bridging role. It translates to "A server that acts as a bridge between Claude Desktop and the terminal." You would likely need to add more context about command execution. For example: "作为 Claude Desktop 和终端之间桥梁,用于执行命令的服务器" (Zuòwéi Claude Desktop hé zhōngduān zhījiān qiáoliáng, yòng yú zhíxíng mìnglìng de fúwùqì) - "A server that acts as a bridge between Claude Desktop and the terminal, used for executing commands." **Which translation is best depends on what you mean by "MCP server."** **To help me provide a more accurate translation, please clarify:** * **What does "MCP" stand for in this context?** Is it a specific software, protocol, or just a general term? * **What is the purpose of this server?** What specific functionality are you looking for? Is it for remote access, automation, or something else? * **What kind of terminal commands are you referring to?** Are they system commands, application-specific commands, or something else? Once you provide more details, I can give you a more precise and helpful translation.

Agent.ai MCP Server

Agent.ai MCP Server

MySQL查询服务器

MySQL查询服务器

一个基于 MCP (模型-控制器-提供者) 框架,通过 SSE (服务器发送事件) 提供 MySQL 数据库操作的服务器,能够实现 MySQL 数据库的实时数据传输。

Mcp_proxy_pydantic_agent

Mcp_proxy_pydantic_agent

好的,以下是将 MCP 服务器暴露给 Pydantic Agents 的一个例子: **英文:** Here's an example of exposing MCP (Model Control Plane) servers to Pydantic Agents: **Conceptual Overview:** 1. **MCP Server:** Imagine you have an MCP server that manages machine learning models. It might provide endpoints for: * Listing available models. * Getting model metadata (e.g., input/output schema). * Making predictions using a specific model. 2. **Pydantic Agent:** You want to create a Pydantic Agent that can interact with this MCP server. The agent should be able to: * Discover available models. * Choose the appropriate model for a given task. * Call the model with the correct input format. * Process the model's output. 3. **Pydantic Models for MCP Interaction:** You'll define Pydantic models to represent the data structures used when communicating with the MCP server. This includes: * A model for representing a model's metadata (name, description, input schema, output schema). * A model for representing the input to a model. * A model for representing the output from a model. 4. **Agent Tools:** You'll create agent tools that use these Pydantic models to interact with the MCP server. These tools will handle the HTTP requests to the MCP server and parse the responses into Pydantic objects. **Simplified Example (using Python and `requests` library):** ```python from pydantic import BaseModel, Field from typing import List, Dict, Any import requests # 1. Pydantic Models for MCP Data class ModelMetadata(BaseModel): name: str = Field(..., description="The name of the model.") description: str = Field(..., description="A description of the model.") input_schema: Dict[str, Any] = Field(..., description="The input schema of the model.") output_schema: Dict[str, Any] = Field(..., description="The output schema of the model.") class ModelInput(BaseModel): data: Dict[str, Any] = Field(..., description="The input data for the model.") class ModelOutput(BaseModel): result: Any = Field(..., description="The output from the model.") # 2. Agent Tools for MCP Interaction class MCPClient: def __init__(self, mcp_server_url: str): self.mcp_server_url = mcp_server_url def list_models(self) -> List[ModelMetadata]: """Lists all available models on the MCP server.""" response = requests.get(f"{self.mcp_server_url}/models") response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) model_data = response.json() return [ModelMetadata(**model) for model in model_data] def get_model_metadata(self, model_name: str) -> ModelMetadata: """Gets the metadata for a specific model.""" response = requests.get(f"{self.mcp_server_url}/models/{model_name}") response.raise_for_status() model_data = response.json() return ModelMetadata(**model_data) def predict(self, model_name: str, input_data: ModelInput) -> ModelOutput: """Makes a prediction using the specified model.""" response = requests.post(f"{self.mcp_server_url}/models/{model_name}/predict", json=input_data.dict()) response.raise_for_status() output_data = response.json() return ModelOutput(**output_data) # 3. Example Usage (Conceptual - needs integration with a Pydantic Agent framework) # Assuming you have a Pydantic Agent framework set up (e.g., using LangChain) # Initialize the MCP client mcp_client = MCPClient(mcp_server_url="http://your-mcp-server.com") # Example: List available models available_models = mcp_client.list_models() print("Available Models:", available_models) # Example: Get metadata for a specific model if available_models: first_model_name = available_models[0].name model_metadata = mcp_client.get_model_metadata(first_model_name) print("Model Metadata:", model_metadata) # Example: Make a prediction input_data = ModelInput(data={"feature1": 1.0, "feature2": 2.0}) # Replace with actual input data prediction = mcp_client.predict(first_model_name, input_data) print("Prediction:", prediction) # In a real Pydantic Agent setup, you would: # 1. Define tools that wrap the MCPClient methods. # 2. Use the Pydantic models to define the input and output types of the tools. # 3. Register these tools with your Pydantic Agent. # 4. The agent can then use these tools to interact with the MCP server based on the user's instructions. ``` **Explanation:** * **Pydantic Models:** `ModelMetadata`, `ModelInput`, and `ModelOutput` define the structure of the data exchanged with the MCP server. The `Field` annotations provide descriptions that can be used by the agent framework for tool selection and parameter validation. * **MCPClient:** This class encapsulates the logic for interacting with the MCP server. It uses the `requests` library to make HTTP requests and parses the responses into Pydantic objects. * **Example Usage:** This section shows how you would use the `MCPClient` to interact with the MCP server. It's a simplified example and would need to be integrated with a Pydantic Agent framework like LangChain. * **Important Considerations for Pydantic Agents:** * **Tool Definition:** You would need to define tools that wrap the `MCPClient` methods. Each tool would have a name, description, and input/output types defined using Pydantic models. * **Agent Integration:** You would register these tools with your Pydantic Agent framework. The agent would then be able to use these tools to interact with the MCP server based on the user's instructions. * **Error Handling:** The `response.raise_for_status()` method is used for basic error handling. You might need to add more sophisticated error handling to your agent. * **Authentication:** If your MCP server requires authentication, you would need to add authentication logic to the `MCPClient`. **中文:** 以下是将 MCP (模型控制平面) 服务器暴露给 Pydantic Agents 的一个例子: **概念概述:** 1. **MCP 服务器:** 假设你有一个 MCP 服务器,用于管理机器学习模型。它可能提供以下端点: * 列出可用的模型。 * 获取模型元数据(例如,输入/输出模式)。 * 使用特定模型进行预测。 2. **Pydantic Agent:** 你想创建一个可以与此 MCP 服务器交互的 Pydantic Agent。该 Agent 应该能够: * 发现可用的模型。 * 为给定的任务选择合适的模型。 * 使用正确的输入格式调用模型。 * 处理模型的输出。 3. **用于 MCP 交互的 Pydantic 模型:** 你将定义 Pydantic 模型来表示与 MCP 服务器通信时使用的数据结构。 这包括: * 一个用于表示模型元数据的模型(名称、描述、输入模式、输出模式)。 * 一个用于表示模型输入的模型。 * 一个用于表示模型输出的模型。 4. **Agent 工具:** 你将创建 Agent 工具,这些工具使用这些 Pydantic 模型与 MCP 服务器交互。 这些工具将处理到 MCP 服务器的 HTTP 请求,并将响应解析为 Pydantic 对象。 **简化示例 (使用 Python 和 `requests` 库):** ```python from pydantic import BaseModel, Field from typing import List, Dict, Any import requests # 1. 用于 MCP 数据的 Pydantic 模型 class ModelMetadata(BaseModel): name: str = Field(..., description="模型的名称。") description: str = Field(..., description="模型的描述。") input_schema: Dict[str, Any] = Field(..., description="模型的输入模式。") output_schema: Dict[str, Any] = Field(..., description="模型的输出模式。") class ModelInput(BaseModel): data: Dict[str, Any] = Field(..., description="模型的输入数据。") class ModelOutput(BaseModel): result: Any = Field(..., description="模型的输出。") # 2. 用于 MCP 交互的 Agent 工具 class MCPClient: def __init__(self, mcp_server_url: str): self.mcp_server_url = mcp_server_url def list_models(self) -> List[ModelMetadata]: """列出 MCP 服务器上所有可用的模型。""" response = requests.get(f"{self.mcp_server_url}/models") response.raise_for_status() # 为错误的响应(4xx 或 5xx)引发 HTTPError model_data = response.json() return [ModelMetadata(**model) for model in model_data] def get_model_metadata(self, model_name: str) -> ModelMetadata: """获取特定模型的元数据。""" response = requests.get(f"{self.mcp_server_url}/models/{model_name}") response.raise_for_status() model_data = response.json() return ModelMetadata(**model_data) def predict(self, model_name: str, input_data: ModelInput) -> ModelOutput: """使用指定的模型进行预测。""" response = requests.post(f"{self.mcp_server_url}/models/{model_name}/predict", json=input_data.dict()) response.raise_for_status() output_data = response.json() return ModelOutput(**output_data) # 3. 示例用法 (概念性的 - 需要与 Pydantic Agent 框架集成) # 假设你已经设置了一个 Pydantic Agent 框架(例如,使用 LangChain) # 初始化 MCP 客户端 mcp_client = MCPClient(mcp_server_url="http://your-mcp-server.com") # 示例:列出可用的模型 available_models = mcp_client.list_models() print("可用的模型:", available_models) # 示例:获取特定模型的元数据 if available_models: first_model_name = available_models[0].name model_metadata = mcp_client.get_model_metadata(first_model_name) print("模型元数据:", model_metadata) # 示例:进行预测 input_data = ModelInput(data={"feature1": 1.0, "feature2": 2.0}) # 替换为实际的输入数据 prediction = mcp_client.predict(first_model_name, input_data) print("预测:", prediction) # 在实际的 Pydantic Agent 设置中,你需要: # 1. 定义包装 MCPClient 方法的工具。 # 2. 使用 Pydantic 模型定义工具的输入和输出类型。 # 3. 将这些工具注册到你的 Pydantic Agent。 # 4. 然后,Agent 可以使用这些工具根据用户的指令与 MCP 服务器交互。 ``` **解释:** * **Pydantic 模型:** `ModelMetadata`、`ModelInput` 和 `ModelOutput` 定义了与 MCP 服务器交换的数据的结构。 `Field` 注释提供了描述,Agent 框架可以使用这些描述进行工具选择和参数验证。 * **MCPClient:** 此类封装了与 MCP 服务器交互的逻辑。 它使用 `requests` 库发出 HTTP 请求并将响应解析为 Pydantic 对象。 * **示例用法:** 本节展示了如何使用 `MCPClient` 与 MCP 服务器交互。 这是一个简化的示例,需要与像 LangChain 这样的 Pydantic Agent 框架集成。 * **Pydantic Agents 的重要注意事项:** * **工具定义:** 你需要定义包装 `MCPClient` 方法的工具。 每个工具都将具有一个名称、描述以及使用 Pydantic 模型定义的输入/输出类型。 * **Agent 集成:** 你需要将这些工具注册到你的 Pydantic Agent 框架。 然后,Agent 将能够使用这些工具根据用户的指令与 MCP 服务器交互。 * **错误处理:** `response.raise_for_status()` 方法用于基本的错误处理。 你可能需要在你的 Agent 中添加更复杂的错误处理。 * **身份验证:** 如果你的 MCP 服务器需要身份验证,你需要将身份验证逻辑添加到 `MCPClient`。 This translation aims to be accurate and maintain the technical nuances of the original English text. It also provides explanations to help understand the code and concepts.

MCP Documentation Project

MCP Documentation Project

为我的瞄准镜摄像头项目准备的 MCP 服务器。

Role-Specific Context MCP Server

Role-Specific Context MCP Server

一个模型上下文协议服务器,它为人工智能代理启用基于角色的上下文管理,允许用户建立特定的指令,维护分区内存,并为系统中不同代理角色调整语气。

cognee-mcp-server

cognee-mcp-server

Clojars MCP Server

Clojars MCP Server

Okay, I understand. Please provide the English text you want me to translate into Chinese. I will translate it, keeping in mind the context of providing up-to-date dependency information for Clojure libraries. This will help me choose the most accurate and relevant Chinese terms. For example, you could give me sentences like: * "This library depends on Clojure 1.10.3 or later." * "The latest version of this library is 2.0.1." * "This dependency is optional." * "This library has a transitive dependency on SLF4J." * "Please update your dependencies to the latest versions." I'm ready when you are!

Mcp Gaodeweather Server

Mcp Gaodeweather Server

Story IP Creator Agent

Story IP Creator Agent

一个使用我们 MCP 服务器的演示代理

OBS MCP Server

OBS MCP Server

一个服务器,通过 OBS WebSocket 协议提供远程控制 OBS Studio 的工具,从而可以通过 MCP 客户端界面管理场景、来源、流媒体和录制。

MCP Server for Ollama

MCP Server for Ollama

用于将 Claude Desktop 连接到 Ollama LLM 服务器的 MCP 服务器。 (This translation focuses on clarity and directness. "MCP server" is kept as is, assuming it's a specific technical term. If you have more context about what "MCP server" refers to, I can provide a more nuanced translation.)

YR MCP Server

YR MCP Server

使用 Yr 天气数据作为 LLM 工具上下文的 MCP 服务器。

EOL MCP Server 📅

EOL MCP Server 📅

镜子 (jìng zi)

Cryptocurrency Market Data MCP Server

Cryptocurrency Market Data MCP Server

镜子 (jìng zi)

GUIDE

GUIDE

MCP 服务器,用于 MSSQL (MCP fúwùqì, yòng yú MSSQL) This translates to: * **MCP 服务器 (MCP fúwùqì):** MCP Server * **用于 (yòng yú):** for * **MSSQL:** MSSQL (This is often kept as is, as it's a technical term) Therefore, the whole translation means "MCP Server for MSSQL".

npm-search MCP Server

npm-search MCP Server

镜子 (jìng zi)

mcp-sentry: A Sentry MCP Server

mcp-sentry: A Sentry MCP Server

与 Sentry 交互的 MCP 服务器

Weather MCP Server

Weather MCP Server

镜子 (jìng zi)

MCP-Grep

MCP-Grep

一个服务器实现,通过模型上下文协议 (Model Context Protocol) 暴露 grep 功能,允许兼容 MCP 的客户端使用正则表达式在文件中搜索模式。

MCP Evolution API

MCP Evolution API

一个模型上下文协议服务器,使 Claude 能够通过 Evolution API 与 WhatsApp 互动,从而实现消息发送、联系人管理、群组操作和 WhatsApp 实例管理。

mentor-mcp-server

mentor-mcp-server

镜子 (jìng zi)

Flux Schnell MCP Server

Flux Schnell MCP Server

一个服务器,它通过模型上下文协议(MCP)调用 Flux Schnell 模型,从而能够通过 Replicate API 生成图像。