发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 86,267 个能力。
Moodle MCP Server
镜子 (jìng zi)
Mcp Servers Wiki Website
Cloudflare AI
Googleworkspace Mcp
ChatGPT MCP Server
镜子 (jìng zi)
Apache Doris MCP Server
Apache Doris 和 VeloDB 的 MCP 服务器
MCP Server для Prom.ua
MCP 服务器,用于与 Prom.ua API 交互
Creating an MCP Server in Go and Serving it with Docker
untapped-mcp
一个未被使用的 MCP 服务器,用于与 Claude 配合使用。
Payman AI Documentation MCP Server
镜子 (jìng zi)
🤖 Agenite
🤖 使用 TypeScript 构建强大的 AI 代理。Agenite 可以轻松创建、组合和控制 AI 代理,并提供对工具、流式传输和多代理架构的一流支持。在 OpenAI、Anthropic、AWS Bedrock 和 Ollama 等提供商之间无缝切换。
Firebase Docs MCP Server Setup
这是一个示例,展示了如何将 Firebase 文档用作 MCP 服务器(包括索引文档)。
Linear
MetaMCP MCP Server
镜子 (jìng zi)
mcp-server-fetch-typescript MCP Server
镜子 (jìng zi)
mcptesting
通过 MCP 服务器创建的测试仓库
comment-stripper-mcp
一个灵活的 MCP 服务器,可以批量处理代码文件,以删除多种编程语言中的注释。目前支持 JavaScript、TypeScript 和 Vue 文件,并使用基于正则表达式的模式匹配。可以处理单个文件、目录(包括子目录)和文本输入。专为代码的清洁维护和准备而构建。
Mcp Todo App
一个结合了 MCP 服务器和客户端,并为简单的待办事项应用添加了一点 AI 功能的组合。
Remote MCP Server on Cloudflare
MCP Server Runner
一个用于运行模型上下文协议(MCP)服务器的 WebSocket 服务器实现。此应用程序允许通过 WebSocket 连接访问 MCP 服务器,从而方便与 Web 应用程序和其他支持网络的客户端集成。
Model Context Protocol Community
轻松运行、部署和连接到 MCP 服务器
MCP Chess
一个用于下国际象棋的 MCP 服务器 (Yī gè yòng yú xià guójì xiàngqí de MCP fúwùqì) **Breakdown:** * **一个 (yī gè):** A * **用于 (yòng yú):** for * **下国际象棋 (xià guójì xiàngqí):** playing chess (literally "play international chess") * **的 (de):** a possessive particle, linking the preceding phrase to the following noun. * **MCP 服务器 (MCP fúwùqì):** MCP server
むらっけ MPC Server
一个简易地再现了宝可梦特性“飘飘然”的 MPC Server
HexDocs MCP Server
MCP Middleware Adapter for Express Servers
Okay, here's a breakdown of how to run multiple Minecraft Protocol (MCP) clients on a NodeJS Express server, acting as an adapter or middleware. This is a complex topic, so I'll break it down into key concepts and provide code snippets to illustrate the ideas. **Core Concepts** 1. **Minecraft Protocol (MCP) Clients:** These are libraries (like `minecraft-protocol` or `prismarine-proxy`) that handle the low-level communication with Minecraft servers. You'll need to choose one and understand its API. 2. **NodeJS Express Server:** This provides the HTTP endpoint(s) that your users/applications will interact with. It acts as the intermediary between the outside world and your Minecraft clients. 3. **Client Management:** You need a way to keep track of each MCP client instance. A simple object or array can work, but for more complex scenarios, consider a more robust data structure. 4. **Proxying/Adapting:** The Express server will receive requests, determine which MCP client should handle the request, and then forward the request (or a modified version of it) to the appropriate Minecraft server. The response from the Minecraft server is then sent back to the original requester. 5. **Authentication/Authorization:** Crucially important. You need to ensure that only authorized users can control specific Minecraft clients. This might involve API keys, user accounts, or other authentication mechanisms. 6. **Error Handling:** Robust error handling is essential. Minecraft servers can be unreliable, and network issues can occur. Your Express server needs to gracefully handle these errors and provide informative feedback to the user. **Example Structure (Conceptual)** ``` / ├── server.js // Main Express server file ├── mcp_manager.js // Manages MCP client instances ├── routes/ │ └── minecraft.js // Routes for interacting with Minecraft clients └── config.js // Configuration settings ``` **1. Project Setup** ```bash mkdir minecraft-proxy cd minecraft-proxy npm init -y npm install express minecraft-protocol // Or prismarine-proxy, etc. ``` **2. `config.js` (Configuration)** ```javascript module.exports = { minecraftServers: [ { id: 'server1', host: 'minecraft.example.com', port: 25565 }, { id: 'server2', host: 'another.minecraft.net', port: 25565 } ], apiKeys: { 'user1': 'some-secret-key', 'user2': 'another-secret-key' } }; ``` **3. `mcp_manager.js` (MCP Client Management)** ```javascript const mc = require('minecraft-protocol'); const config = require('./config'); class MCPManager { constructor() { this.clients = {}; // Store MCP client instances } createClient(serverId, username, password) { const serverConfig = config.minecraftServers.find(s => s.id === serverId); if (!serverConfig) { throw new Error(`Server with ID ${serverId} not found.`); } const client = mc.createClient({ host: serverConfig.host, port: serverConfig.port, username: username, password: password // Handle authentication appropriately }); this.clients[serverId] = client; client.on('connect', () => { console.log(`Connected to ${serverId}`); }); client.on('disconnect', (packet) => { console.log(`Disconnected from ${serverId}: ${packet.reason}`); delete this.clients[serverId]; // Remove client on disconnect }); client.on('error', (err) => { console.error(`Error on ${serverId}: ${err}`); delete this.clients[serverId]; // Remove client on error }); return client; } getClient(serverId) { return this.clients[serverId]; } removeClient(serverId) { if (this.clients[serverId]) { this.clients[serverId].end(); // Disconnect the client delete this.clients[serverId]; } } } module.exports = new MCPManager(); ``` **4. `routes/minecraft.js` (Express Routes)** ```javascript const express = require('express'); const router = express.Router(); const mcpManager = require('../mcp_manager'); const config = require('../config'); // Middleware to authenticate API key const authenticate = (req, res, next) => { const apiKey = req.headers['x-api-key']; const userId = req.query.userId; // Or get from body, params, etc. if (!apiKey || !userId || config.apiKeys[userId] !== apiKey) { return res.status(401).json({ error: 'Unauthorized' }); } req.userId = userId; // Store user ID for later use next(); }; // Route to create a Minecraft client router.post('/client/:serverId', authenticate, (req, res) => { const serverId = req.params.serverId; const username = req.body.username; const password = req.body.password; try { const client = mcpManager.createClient(serverId, username, password); res.status(201).json({ message: `Client created for ${serverId}` }); } catch (error) { console.error(error); res.status(500).json({ error: error.message }); } }); // Route to send a chat message router.post('/client/:serverId/chat', authenticate, (req, res) => { const serverId = req.params.serverId; const message = req.body.message; const client = mcpManager.getClient(serverId); if (!client) { return res.status(404).json({ error: `Client for ${serverId} not found` }); } client.write('chat', { message: message }); res.json({ message: 'Chat message sent' }); }); // Route to disconnect a client router.delete('/client/:serverId', authenticate, (req, res) => { const serverId = req.params.serverId; mcpManager.removeClient(serverId); res.json({ message: `Client for ${serverId} disconnected` }); }); module.exports = router; ``` **5. `server.js` (Main Express Server)** ```javascript const express = require('express'); const app = express(); const minecraftRoutes = require('./routes/minecraft'); const port = 3000; app.use(express.json()); // Parse JSON request bodies app.use('/minecraft', minecraftRoutes); app.listen(port, () => { console.log(`Server listening on port ${port}`); }); ``` **Explanation and Key Points** * **`config.js`:** Stores configuration data like Minecraft server details and API keys. **Never hardcode sensitive information directly into your code.** * **`mcp_manager.js`:** * Manages the creation, retrieval, and removal of MCP client instances. * Uses a `clients` object to store the clients, keyed by `serverId`. * Handles connection, disconnection, and error events for each client. This is crucial for maintaining a stable system. * **`routes/minecraft.js`:** * Defines the Express routes for interacting with the Minecraft clients. * **`authenticate` middleware:** This is a *critical* security measure. It checks for a valid API key before allowing access to the routes. Adapt this to your authentication needs. * `/client/:serverId`: Creates a new MCP client for the specified server. * `/client/:serverId/chat`: Sends a chat message to the specified server. * `/client/:serverId`: Disconnects the client for the specified server. * **`server.js`:** * Sets up the Express server and mounts the `minecraftRoutes`. * Includes `express.json()` middleware to parse JSON request bodies. **How to Run** 1. Save all the files. 2. Open a terminal in the project directory. 3. Run `node server.js`. **Example API Usage (using `curl`)** * **Create a client:** ```bash curl -X POST -H "Content-Type: application/json" -H "X-API-Key: some-secret-key" -d '{"username": "MyBot", "password": "MyPassword"}' "http://localhost:3000/minecraft/client/server1?userId=user1" ``` * **Send a chat message:** ```bash curl -X POST -H "Content-Type: application/json" -H "X-API-Key: some-secret-key" -d '{"message": "Hello, world!"}' "http://localhost:3000/minecraft/client/server1/chat?userId=user1" ``` * **Disconnect a client:** ```bash curl -X DELETE -H "X-API-Key: some-secret-key" "http://localhost:3000/minecraft/client/server1?userId=user1" ``` **Important Considerations and Enhancements** * **Error Handling:** The example includes basic error handling, but you should add more robust error handling throughout the code. Use `try...catch` blocks, log errors, and provide informative error messages to the user. * **Authentication:** The API key authentication is a simple example. For production environments, use a more secure authentication method like JWT (JSON Web Tokens) or OAuth 2.0. * **Rate Limiting:** Implement rate limiting to prevent abuse of your API. This can be done using middleware like `express-rate-limit`. * **Logging:** Use a logging library (like `winston` or `morgan`) to log requests, errors, and other important events. This will help you debug and monitor your application. * **Scalability:** For high-traffic applications, consider using a message queue (like RabbitMQ or Kafka) to handle requests asynchronously. This will prevent your Express server from becoming overloaded. You could also use a load balancer to distribute traffic across multiple instances of your Express server. * **Minecraft Protocol Library:** The example uses `minecraft-protocol`. You can also use `prismarine-proxy` or other libraries. Choose the library that best suits your needs. `prismarine-proxy` is often used for more advanced proxying scenarios. * **Data Validation:** Validate the data that you receive from the user (e.g., username, password, message). This will help prevent errors and security vulnerabilities. Use a library like `joi` or `express-validator`. * **Minecraft Server Version Compatibility:** Minecraft protocols change with each version. Make sure your chosen library supports the Minecraft server versions you want to connect to. You might need to handle different protocol versions. * **Proxying vs. Adapting:** * **Proxying:** Simply forwards the raw Minecraft protocol packets between the client and the server. This is more efficient but requires more knowledge of the Minecraft protocol. `prismarine-proxy` is well-suited for this. * **Adapting:** Translates the requests into a different format (e.g., HTTP) and then converts them back into Minecraft protocol packets. This is easier to implement but can be less efficient. The example above is more of an adapter. * **Command Handling:** Instead of just sending chat messages, you can implement a more sophisticated command handling system. This would allow users to execute commands on the Minecraft server through your API. * **WebSockets:** Consider using WebSockets for real-time communication between the client and the Minecraft server. This would allow you to send updates to the client as they happen (e.g., player positions, chat messages). **Example using `prismarine-proxy` (Conceptual)** ```javascript const prismarineProxy = require('prismarine-proxy'); const express = require('express'); const app = express(); app.get('/proxy/:host/:port', (req, res) => { const host = req.params.host; const port = parseInt(req.params.port); prismarineProxy.createProxy({ host: host, port: port, // Options for the proxy (e.g., custom login handling) }); res.send(`Proxy created for ${host}:${port}`); }); app.listen(3000, () => { console.log('Proxy server listening on port 3000'); }); ``` This `prismarine-proxy` example is *very* basic. You'd need to add authentication, client management, and more sophisticated handling of the proxy events. `prismarine-proxy` gives you more control over the raw Minecraft protocol packets. **In summary, building a robust Minecraft proxy/adapter requires careful planning, security considerations, and a good understanding of the Minecraft protocol. Start with a simple example and gradually add features as needed.**
myanimelist-mcp
为我的动漫列表集成大型语言模型的 MCP 服务器
mcp-server
一个基于 Nasdanika (AI) 能力构建的 MCP 服务器
GitHub MCP Server
镜子 (jìng zi)
Google Image Search MCP Server
用于集成谷歌图片搜索的 MCP 服务器 (Yòng yú jíchéng Gǔgē Túpian Sōusuǒ de MCP fúwùqì)
redis-mcp-server