发现优秀的 MCP 服务器

通过 MCP 服务器扩展您的代理能力,拥有 17,884 个能力。

全部17,884
Cars MCP Server

Cars MCP Server

Okay, here's a basic example of how you might set up a simple Minecraft Protocol (MCP) server using Spring AI. This is a high-level outline and requires you to fill in the details based on your specific needs and the MCP library you choose. This example focuses on the Spring AI integration for handling commands or interactions. **Important Considerations:** * **MCP Library:** There isn't a single "standard" MCP library for Java. You'll need to choose one. Popular options include: * **MinecraftForge:** A very common modding platform. If you're building a mod, this is likely your choice. * **SpongeAPI:** Another modding platform, known for its plugin API. * **Custom Implementation:** You *could* implement the MCP protocol yourself, but this is a significant undertaking. I strongly recommend using an existing library. * **Spring Boot:** This example assumes you're using Spring Boot for easy setup and dependency management. * **Spring AI:** This example uses Spring AI to process player input and generate responses. **Project Setup (Maven or Gradle):** Add the following dependencies to your `pom.xml` (Maven) or `build.gradle` (Gradle): **Maven (`pom.xml`):** ```xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-core</artifactId> <version>0.8.0</version> <!-- Or the latest version --> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-openai</artifactId> <version>0.8.0</version> <!-- Or the latest version --> </dependency> <!-- Your chosen MCP library dependency goes here. Example using a hypothetical MCP library: --> <!-- <dependency> <groupId>com.example</groupId> <artifactId>mcp-library</artifactId> <version>1.0.0</version> </dependency> --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> ``` **Gradle (`build.gradle`):** ```gradle dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.ai:spring-ai-core:0.8.0' // Or the latest version implementation 'org.springframework.ai:spring-ai-openai:0.8.0' // Or the latest version // Your chosen MCP library dependency goes here. Example using a hypothetical MCP library: // implementation 'com.example:mcp-library:1.0.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' } ``` **1. Spring Boot Application Class:** ```java import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class McpServerApplication { public static void main(String[] args) { SpringApplication.run(McpServerApplication.class, args); } } ``` **2. MCP Server Component (Example):** ```java import org.springframework.ai.client.AiClient; import org.springframework.ai.prompt.PromptTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import java.util.HashMap; import java.util.Map; @Component public class McpServer { // Replace with your actual MCP server implementation private boolean isRunning = false; @Autowired private AiClient aiClient; @Value("${spring.ai.openai.api-key}") private String openAiApiKey; @Value("${mcp.server.port}") private int serverPort; @Value("${mcp.ai.prompt}") private String aiPrompt; @PostConstruct public void startServer() { System.out.println("Starting MCP Server on port: " + serverPort); System.out.println("Using OpenAI API Key: " + openAiApiKey); // Initialize your MCP server here (using your chosen library) // Example (replace with actual code): // this.mcpServer = new MyMcpserver(serverPort); // this.mcpServer.start(); isRunning = true; System.out.println("MCP Server started."); } @PreDestroy public void stopServer() { if (isRunning) { System.out.println("Stopping MCP Server"); // Stop your MCP server here (using your chosen library) // Example (replace with actual code): // this.mcpServer.stop(); isRunning = false; System.out.println("MCP Server stopped."); } } // Example method to handle player input and use Spring AI public String handlePlayerCommand(String playerName, String command) { System.out.println("Received command from " + playerName + ": " + command); // Use Spring AI to generate a response PromptTemplate promptTemplate = new PromptTemplate(aiPrompt); Map<String, Object> model = new HashMap<>(); model.put("playerName", playerName); model.put("command", command); String response = aiClient.generate(promptTemplate.create(model)).getGeneration().getText(); System.out.println("AI Response: " + response); return response; // Or send the response back to the player in-game } } ``` **3. Configuration (`application.properties` or `application.yml`):** ```properties spring.ai.openai.api-key=YOUR_OPENAI_API_KEY # Replace with your actual OpenAI API key mcp.server.port=25565 # Or your desired port mcp.ai.prompt=Player {playerName} issued command: {command}. Respond in a helpful and Minecraft-themed way. ``` **Explanation:** * **Dependencies:** The `spring-boot-starter-web` dependency is included for basic web functionality (though you might not need it directly for the MCP server itself, it's often useful for management endpoints). `spring-ai-core` and `spring-ai-openai` are the core Spring AI dependencies. You'll need to add the dependency for your chosen MCP library. * **`McpServerApplication`:** A standard Spring Boot application entry point. * **`McpServer` Component:** * `@Component`: Marks this class as a Spring-managed component. * `@Autowired AiClient`: Injects the Spring AI client. * `@Value`: Injects values from your `application.properties` or `application.yml` file. **Important:** Replace `YOUR_OPENAI_API_KEY` with your actual OpenAI API key. * `@PostConstruct`: The `startServer()` method is called after the Spring context is initialized. This is where you would start your MCP server. **You'll need to replace the placeholder comments with the actual code to initialize and start your chosen MCP library.** * `@PreDestroy`: The `stopServer()` method is called when the Spring context is shutting down. This is where you would stop your MCP server. **You'll need to replace the placeholder comments with the actual code to stop your chosen MCP library.** * `handlePlayerCommand()`: This is a *very* simplified example of how you might handle player input. It takes the player's name and command as input, uses Spring AI to generate a response, and then returns the response. **You'll need to adapt this to your specific MCP library and how it handles player input.** * **Spring AI Integration:** * `PromptTemplate`: Defines the prompt that will be sent to the AI model. The prompt includes placeholders for the player's name and command. * `aiClient.generate()`: Sends the prompt to the AI model and returns a response. * The response is then printed to the console and returned. * **`application.properties`:** Contains the configuration for your application, including the OpenAI API key, the server port, and the AI prompt. **Remember to replace `YOUR_OPENAI_API_KEY` with your actual key.** **How to Use It (Conceptual):** 1. **Choose an MCP Library:** Select the MCP library that best suits your needs (MinecraftForge, SpongeAPI, or a custom implementation). 2. **Implement MCP Server Logic:** Replace the placeholder comments in the `McpServer` class with the actual code to initialize, start, and stop your MCP server using your chosen library. This will involve handling network connections, player authentication, world loading, etc. 3. **Handle Player Input:** Modify the `handlePlayerCommand()` method to receive player input from your MCP server. This will likely involve listening for specific events or packets from the MCP library. 4. **Send Responses to Players:** Modify the `handlePlayerCommand()` method to send the AI-generated response back to the player in the game. This will involve using the appropriate methods from your MCP library to send messages to players. 5. **Configure Spring AI:** Make sure you have a valid OpenAI API key and that you've configured it in your `application.properties` file. You can also experiment with different AI models and prompt templates to get the desired behavior. **Example Scenario:** 1. A player types `/ask what is the best way to find diamonds?` in the game. 2. Your MCP server receives this command. 3. The `handlePlayerCommand()` method is called with `playerName` set to the player's name and `command` set to "what is the best way to find diamonds?". 4. The `PromptTemplate` is used to create a prompt like: "Player Steve issued command: what is the best way to find diamonds?. Respond in a helpful and Minecraft-themed way." 5. The prompt is sent to the OpenAI API. 6. The OpenAI API generates a response, such as: "Ahoy, matey! To find diamonds, ye should dig down to level -58 and look for them near lava pools. Be careful, though, or ye might get burned!" 7. The response is sent back to the player in the game. **Important Notes:** * **Error Handling:** This is a very basic example and doesn't include any error handling. You'll need to add error handling to your code to make it more robust. * **Security:** Be very careful about security when building an MCP server. Make sure you properly authenticate players and protect against exploits. * **Asynchronous Operations:** MCP servers are typically multi-threaded. Make sure you handle player input and AI responses asynchronously to avoid blocking the main server thread. Consider using Spring's `@Async` annotation or other concurrency mechanisms. * **Rate Limiting:** Be mindful of the OpenAI API's rate limits. You may need to implement rate limiting in your code to avoid being throttled. * **Prompt Engineering:** The quality of the AI's responses depends heavily on the prompt you provide. Experiment with different prompts to get the best results. * **Cost:** Using OpenAI's API incurs costs. Be aware of the pricing and monitor your usage. **Chinese Translation of Key Terms:** * **MCP (Minecraft Protocol):** Minecraft 协议 (Minecraft Xiéyì) * **Spring AI:** Spring 人工智能 (Spring Réngōng Zhìnéng) * **Server:** 服务器 (Fúwùqì) * **Player:** 玩家 (Wánjiā) * **Command:** 命令 (Mìnglìng) * **Prompt:** 提示 (Tíshì) * **API Key:** API 密钥 (API Mìyuè) * **Dependency:** 依赖 (Yīlài) * **Configuration:** 配置 (Pèizhì) * **Response:** 回应 (Huíyìng) / 响应 (Xiǎngyìng) This example provides a starting point for building an MCP server with Spring AI. You'll need to adapt it to your specific needs and the MCP library you choose. Remember to consult the documentation for your chosen MCP library and the Spring AI documentation for more information. Good luck!

MCP Memory

MCP Memory

An MCP server that enables clients like Cursor, Claude, and Windsurf to remember user information and preferences across conversations using vector search technology.

Databricks MCP Server

Databricks MCP Server

A Model Context Protocol server that enables AI assistants to interact with Databricks workspaces, allowing them to browse Unity Catalog, query metadata, sample data, and execute SQL queries.

Structured Thinking

Structured Thinking

一个统一的 MCP 服务器,用于结构化思维工具,包括模板思维和验证思维。 (Alternatively, depending on the specific context and target audience, you could also say:) 一个整合的 MCP 服务器,提供结构化思维工具,例如模板思维和验证思维。

OpenTelemetry MCP Server

OpenTelemetry MCP Server

Enables AI agents to query Prometheus metrics and Loki logs for intelligent alert investigation and troubleshooting. Provides service discovery, metric querying, log searching, and correlation tools to help identify root causes of issues.

Teable MCP Server

Teable MCP Server

Connects Teable no-code databases to LLMs, enabling AI agents to query records, explore schema structures, retrieve data history, and interact with spaces, bases, tables, and views using natural language.

Remote MCP Server Authless

Remote MCP Server Authless

A Cloudflare Workers-based Model Context Protocol server without authentication requirements, allowing users to deploy and customize AI tools that can be accessed from Claude Desktop or Cloudflare AI Playground.

MCP Client-Server Sandbox for LLM Augmentation

MCP Client-Server Sandbox for LLM Augmentation

用于增强 LLM 推理(本地或云端)的完整沙盒,集成了 MCP 客户端-服务器。为 MCP 服务器验证和 Agentic 评估提供低摩擦的试验平台。

DrissionPage MCP Browser Automation

DrissionPage MCP Browser Automation

Provides browser automation and web scraping capabilities including page navigation, form filling, data extraction, and intelligent conversion of web pages to Markdown format.

UK Bus Departures MCP Server

UK Bus Departures MCP Server

Enables users to get real-time UK bus departure information and validate bus stop ATCO codes by scraping bustimes.org. Provides structured data including service numbers, destinations, scheduled and expected departure times for any UK bus stop.

mcp_server

mcp_server

Okay, I understand. You want me to describe how to implement a "weather MCP server" that can be called by a client IDE like Cursor. Here's a breakdown of the concept, implementation considerations, and a simplified example (using Python and a basic HTTP API) to illustrate the core ideas. **What is an MCP Server (in this context)?** In this scenario, "MCP" likely refers to a *Microservice Communication Protocol* or a similar concept. It means you're building a small, independent service (the weather server) that provides weather information and communicates with other applications (like the Cursor IDE) using a defined protocol. In practice, this often translates to a RESTful API over HTTP. **Key Components** 1. **Weather Data Source:** * This is where your server gets the actual weather information. You'll likely use a third-party weather API (e.g., OpenWeatherMap, AccuWeather, WeatherAPI.com). These APIs typically require you to sign up for an account and obtain an API key. * Consider caching the weather data to reduce the number of API calls and improve response times. 2. **Server-Side Implementation (e.g., Python with Flask/FastAPI):** * This is the core of your weather server. It handles incoming requests, fetches weather data from the data source, and formats the response. * **Framework Choice:** * **Flask:** A lightweight and flexible framework, good for simple APIs. * **FastAPI:** A modern, high-performance framework with automatic data validation and API documentation (using OpenAPI/Swagger). Generally preferred for new projects. * **API Endpoints:** You'll define endpoints like: * `/weather?city={city_name}`: Returns weather information for a specific city. * `/weather?zip={zip_code}`: Returns weather information for a specific zip code. * `/forecast?city={city_name}`: Returns a weather forecast for a specific city. 3. **Client-Side Integration (in Cursor IDE):** * The Cursor IDE (or any other client) will need to make HTTP requests to your weather server's API endpoints. * This might involve writing code within Cursor (e.g., using JavaScript or Python within a Cursor extension) to: * Get user input (e.g., the city name). * Construct the API request URL. * Send the request to the weather server. * Parse the JSON response from the server. * Display the weather information in the Cursor IDE. **Implementation Steps (Simplified Example with Python and Flask)** **1. Set up your environment:** ```bash # Create a project directory mkdir weather_server cd weather_server # Create a virtual environment (recommended) python3 -m venv venv source venv/bin/activate # On Linux/macOS # venv\Scripts\activate # On Windows # Install Flask and requests (for making HTTP requests to the weather API) pip install Flask requests ``` **2. `weather_server.py` (Flask Server):** ```python from flask import Flask, request, jsonify import requests import os app = Flask(__name__) # Replace with your actual OpenWeatherMap API key API_KEY = os.environ.get("OPENWEATHERMAP_API_KEY") or "YOUR_OPENWEATHERMAP_API_KEY" # Get from environment variable or hardcode (not recommended for production) BASE_URL = "https://api.openweathermap.org/data/2.5/weather" def get_weather_data(city): """Fetches weather data from OpenWeatherMap.""" params = { "q": city, "appid": API_KEY, "units": "metric", # Use Celsius } try: response = requests.get(BASE_URL, params=params) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) data = response.json() return data except requests.exceptions.RequestException as e: print(f"Error fetching weather data: {e}") return None @app.route("/weather") def weather(): """API endpoint to get weather by city.""" city = request.args.get("city") if not city: return jsonify({"error": "City parameter is required"}), 400 weather_data = get_weather_data(city) if weather_data: # Extract relevant information temperature = weather_data["main"]["temp"] description = weather_data["weather"][0]["description"] humidity = weather_data["main"]["humidity"] wind_speed = weather_data["wind"]["speed"] return jsonify({ "city": city, "temperature": temperature, "description": description, "humidity": humidity, "wind_speed": wind_speed }) else: return jsonify({"error": "Could not retrieve weather data for that city"}), 500 if __name__ == "__main__": app.run(debug=True) # Don't use debug=True in production! ``` **3. Running the Server:** ```bash # Set your OpenWeatherMap API key (replace with your actual key) export OPENWEATHERMAP_API_KEY="YOUR_OPENWEATHERMAP_API_KEY" # Linux/macOS # set OPENWEATHERMAP_API_KEY="YOUR_OPENWEATHERMAP_API_KEY" # Windows # Run the Flask server python weather_server.py ``` **4. Example Client-Side Code (Conceptual - in Cursor IDE):** This is a *very* simplified example of how you *might* integrate this into Cursor. The exact implementation will depend on Cursor's extension API and how you want to display the information. This assumes you can execute JavaScript or Python code within Cursor. ```javascript // Example JavaScript code (Conceptual - adapt to Cursor's API) async function getWeather(city) { const apiUrl = `http://127.0.0.1:5000/weather?city=${city}`; // Replace with your server's address try { const response = await fetch(apiUrl); const data = await response.json(); if (response.ok) { // Display the weather information in the Cursor IDE console.log(`Weather in ${data.city}:`); console.log(`Temperature: ${data.temperature}°C`); console.log(`Description: ${data.description}`); console.log(`Humidity: ${data.humidity}%`); console.log(`Wind Speed: ${data.wind_speed} m/s`); // You'd need to use Cursor's API to actually display this in the editor or a panel. // For example, Cursor might have a function like: // cursor.showInformationMessage(`Weather in ${data.city}: ...`); } else { console.error(`Error: ${data.error}`); // Display an error message in Cursor } } catch (error) { console.error("Error fetching weather:", error); // Display a network error in Cursor } } // Example usage: const cityName = "London"; // Or get the city from user input in Cursor getWeather(cityName); ``` **Explanation and Improvements** * **Error Handling:** The code includes basic error handling (checking for API errors, missing city parameter). Robust error handling is crucial for production. * **API Key Security:** *Never* hardcode your API key directly in the code, especially if you're sharing it. Use environment variables (as shown) or a configuration file. * **Asynchronous Operations:** Use `async/await` (as in the JavaScript example) to avoid blocking the UI thread while waiting for the API response. * **Data Validation:** Use a library like `marshmallow` (in Python) or a similar validation library in your chosen language to validate the data received from the weather API. This helps prevent unexpected errors. * **Caching:** Implement caching to store frequently accessed weather data. This reduces the load on the weather API and improves response times. You could use a simple in-memory cache (for small-scale deployments) or a more robust caching solution like Redis or Memcached. * **Rate Limiting:** Be aware of the rate limits imposed by the weather API you're using. Implement rate limiting in your server to avoid exceeding the limits and getting your API key blocked. * **Logging:** Use a logging library (e.g., `logging` in Python) to log important events, errors, and debugging information. * **API Documentation:** Use a tool like Swagger (with FastAPI) to automatically generate API documentation. This makes it easier for other developers to use your weather server. * **Deployment:** Consider deploying your weather server to a cloud platform like AWS, Google Cloud, or Azure. **Chinese Translation of Key Concepts** * **Weather MCP Server:** 天气 MCP 服务器 (Tiānqì MCP fúwùqì) * **Microservice Communication Protocol:** 微服务通信协议 (Wēi fúwù tōngxìn xiéyì) * **API Endpoint:** API 端点 (API duāndiǎn) * **RESTful API:** RESTful API (RESTful API) (The term is often used directly in Chinese as well) * **API Key:** API 密钥 (API mìyào) * **Data Source:** 数据源 (shùjù yuán) * **Caching:** 缓存 (huǎncún) * **Rate Limiting:** 速率限制 (sùlǜ xiànzhì) * **Error Handling:** 错误处理 (cuòwù chǔlǐ) * **Environment Variable:** 环境变量 (huánjìng biànliàng) **Important Considerations for Cursor Integration** * **Cursor's Extension API:** The most important thing is to understand Cursor's extension API. How can you create extensions, access the editor, display information, and get user input? Refer to Cursor's official documentation for this. * **Security:** Be very careful about security when integrating with an IDE. Avoid storing sensitive information (like API keys) directly in the extension code. Use secure storage mechanisms provided by the IDE or the operating system. * **User Experience:** Design the integration to be as seamless and intuitive as possible for the user. Consider how the weather information will be displayed (e.g., in a tooltip, a panel, or directly in the editor). This detailed explanation and example should give you a solid foundation for building your weather MCP server and integrating it with Cursor. Remember to adapt the code and concepts to your specific needs and the capabilities of the Cursor IDE. Good luck!

MCP Tailwind Gemini Server

MCP Tailwind Gemini Server

Advanced Model Context Protocol server that integrates Gemini AI with Tailwind CSS, providing intelligent component generation, class optimization, and cross-platform design assistance across major development environments.

MCP Demo Server

MCP Demo Server

A minimal fastmcp demonstration server that provides a simple addition tool through the MCP protocol, supporting deployment via Docker with multiple transport modes.

A MCP server for Godot RAG

A MCP server for Godot RAG

这个 MCP 服务器用于向 Godot RAG 模型提供 Godot 文档。

Configurable Puppeteer MCP Server

Configurable Puppeteer MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它使用 Puppeteer 提供浏览器自动化功能,并通过环境变量配置选项,从而使大型语言模型(LLM)能够与网页交互、截取屏幕截图,并在浏览器环境中执行 JavaScript。

Quack MCP Server

Quack MCP Server

A continuous integration server that automates Python code analysis, providing linting and static type checking tools for quality assurance.

ETH Price Current Server

ETH Price Current Server

A minimal Model Context Protocol (MCP) server that fetches the current Ethereum (ETH) price in USD. Data source: the public CoinGecko API (no API key required). This MCP is designed to simulate malicious behavior, specifically an attempt to mislead LLM to return incorrect results.

Canteen MCP

Canteen MCP

A Model Context Protocol server that provides structured access to canteen lunch menus for specific dates through a simple API integration.

🧠 MCP PID Wallet Verifier

🧠 MCP PID Wallet Verifier

一个轻量级且对 AI 友好的 MCP 服务器,允许任何 AI 代理或 MCP 兼容的助手通过 OIDC4VP 发起和验证 PID(个人身份数据)凭证展示。

Thirdweb Mcp

Thirdweb Mcp

mcp-cli-catalog

mcp-cli-catalog

An MCP server that publishes CLI tools on your machine for discoverability by LLMs

MCP Montano Server

MCP Montano Server

MCP Servers for Teams

MCP Servers for Teams

MCP 服务器的示例部署

Effect CLI - Model Context Protocol

Effect CLI - Model Context Protocol

MCP 服务器,以命令行工具的形式公开

Mcp Akshare

Mcp Akshare

AKShare 是一个基于 Python 的金融数据接口库,旨在提供一套工具,用于采集、清洗和存储股票、期货、期权、基金、外汇、债券、指数、加密货币等金融产品的基本面数据、实时和历史行情数据以及衍生数据。它主要用于学术研究目的。

Xero MCP Server

Xero MCP Server

一个允许客户端与 Xero 会计软件交互的 MCP 服务器。

Freedcamp MCP Server

Freedcamp MCP Server

A Model Context Protocol server that enables seamless integration with Freedcamp API for enterprise-level project management with advanced filtering, full CRUD operations, and extensive customization options.

mcp-servers

mcp-servers

在无服务器架构上运行 MCP 服务器

GitHub MCP Server for Cursor IDE

GitHub MCP Server for Cursor IDE

GitHub MCP 服务器,用于 Cursor IDE

MCP DateTime Server

MCP DateTime Server

Provides current local datetime information with timezone support. Serves as a minimal blueprint for building simple, single-purpose MCP servers.