发现优秀的 MCP 服务器

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

全部67,821
staruml-controller-dfd-mcp

staruml-controller-dfd-mcp

An MCP server specialized for Data Flow Diagrams, enabling AI assistants to programmatically create and manage DFD elements like external entities, processes, data stores, and data flows in StarUML.

mcp-personal

mcp-personal

MCP server that provides tools to manage Gmail and Outlook emails, and search Mercadona products, for use with Cursor and LangChain.

maltego-mcp

maltego-mcp

Enables LLMs to author Maltego .mtgx graph files and perform OSINT lookups, with an optional transform layer for pivoting into MISP, TheHive, Cortex, and MITRE ATT\&CK directly in Maltego Desktop.

🤖 Deno Model Context Protocol (MCP) Agent Template Repository

🤖 Deno Model Context Protocol (MCP) Agent Template Repository

好的,这是用 Deno 实现的模板 Model Context Protocol (MCP) 服务器: ```typescript import { serve } from "https://deno.land/std@0.177.1/http/server.ts"; import { acceptWebSocket, isWebSocketCloseEvent, WebSocket, } from "https://deno.land/std@0.177.1/ws/mod.ts"; // 定义 MCP 消息类型 interface MCPMessage { type: string; data: any; } // 处理 WebSocket 连接 async function handleWebSocket(ws: WebSocket) { console.log("WebSocket connected"); try { for await (const event of ws) { if (typeof event === "string") { // 处理文本消息 try { const message: MCPMessage = JSON.parse(event); console.log("Received message:", message); // 根据消息类型进行处理 switch (message.type) { case "ping": // 响应 ping 消息 ws.send(JSON.stringify({ type: "pong" })); break; case "model_request": // 处理模型请求 const modelResponse = await processModelRequest(message.data); ws.send(JSON.stringify({ type: "model_response", data: modelResponse })); break; default: console.warn("Unknown message type:", message.type); ws.send(JSON.stringify({ type: "error", data: "Unknown message type" })); } } catch (error) { console.error("Error parsing message:", error); ws.send(JSON.stringify({ type: "error", data: "Invalid message format" })); } } else if (isWebSocketCloseEvent(event)) { // 处理 WebSocket 关闭事件 const { code, reason } = event; console.log("WebSocket closed:", code, reason); } } } catch (error) { console.error("Error handling WebSocket:", error); try { ws.close(1011, "Internal Server Error"); // 1011 表示服务器遇到了意外情况,阻止其完成请求。 } catch (_ignore) { // 忽略关闭错误,因为连接可能已经关闭 } } } // 模拟模型请求处理函数 async function processModelRequest(requestData: any): Promise<any> { // 在这里实现你的模型处理逻辑 console.log("Processing model request:", requestData); // 模拟延迟 await new Promise((resolve) => setTimeout(resolve, 500)); // 模拟模型响应 return { result: "Model processing successful", data: { input: requestData, output: "This is a simulated model output.", }, }; } // HTTP 请求处理函数 async function handleHttpRequest(request: Request): Promise<Response> { if (request.headers.get("upgrade") === "websocket") { // 处理 WebSocket 连接 const { socket, response } = Deno.upgradeWebSocket(request); handleWebSocket(socket); return response; } else { // 处理 HTTP 请求 return new Response("Hello, Deno! This is a Model Context Protocol server.", { headers: { "content-type": "text/plain" }, }); } } // 启动服务器 const port = 8080; console.log(`Server listening on port ${port}`); await serve(handleHttpRequest, { port }); ``` **代码解释:** 1. **导入必要的模块:** - `serve` 来自 `https://deno.land/std@0.177.1/http/server.ts` 用于启动 HTTP 服务器。 - `acceptWebSocket`, `isWebSocketCloseEvent`, `WebSocket` 来自 `https://deno.land/std@0.177.1/ws/mod.ts` 用于处理 WebSocket 连接。 2. **定义 `MCPMessage` 接口:** - 定义了 MCP 消息的结构,包含 `type` (字符串类型) 和 `data` (任意类型) 两个字段。 3. **`handleWebSocket(ws: WebSocket)` 函数:** - 处理 WebSocket 连接的逻辑。 - 使用 `for await (const event of ws)` 循环监听 WebSocket 事件。 - **处理文本消息 (`typeof event === "string"`):** - 使用 `JSON.parse(event)` 将文本消息解析为 `MCPMessage` 对象。 - 使用 `switch` 语句根据 `message.type` 进行不同的处理: - `ping`: 响应 `pong` 消息。 - `model_request`: 调用 `processModelRequest` 函数处理模型请求,并将响应发送回客户端。 - `default`: 处理未知消息类型,并发送错误消息。 - 使用 `try...catch` 块捕获 JSON 解析错误。 - **处理 WebSocket 关闭事件 (`isWebSocketCloseEvent(event)`):** - 记录关闭代码和原因。 - 使用 `try...catch` 块捕获 WebSocket 处理过程中的错误,并尝试关闭连接。 4. **`processModelRequest(requestData: any): Promise<any>` 函数:** - **模拟** 模型请求处理逻辑。 - 接受 `requestData` 作为输入。 - 使用 `await new Promise((resolve) => setTimeout(resolve, 500))` 模拟延迟。 - 返回一个包含 `result` 和 `data` 的模拟响应。 - **你需要根据你的实际模型处理逻辑替换此函数的内容。** 5. **`handleHttpRequest(request: Request): Promise<Response>` 函数:** - 处理 HTTP 请求的逻辑。 - **WebSocket 升级:** - 检查请求头中是否包含 `upgrade: websocket`。 - 如果是,则使用 `Deno.upgradeWebSocket(request)` 将 HTTP 连接升级为 WebSocket 连接。 - 调用 `handleWebSocket(socket)` 处理 WebSocket 连接。 - 返回 `response` 对象。 - **HTTP 请求处理:** - 如果不是 WebSocket 升级请求,则返回一个简单的 "Hello, Deno!" 响应。 6. **启动服务器:** - 定义服务器监听的端口号 `port = 8080`。 - 使用 `console.log` 打印服务器启动信息。 - 使用 `await serve(handleHttpRequest, { port })` 启动服务器,并传入 HTTP 请求处理函数和端口号。 **如何运行:** 1. **保存代码:** 将代码保存为 `mcp_server.ts` 文件。 2. **运行命令:** 在终端中运行以下命令: ```bash deno run --allow-net mcp_server.ts ``` - `--allow-net` 标志允许 Deno 程序访问网络。 **如何测试:** 你可以使用 WebSocket 客户端(例如 wscat 或 Postman)连接到服务器,并发送 MCP 消息进行测试。 **示例 WebSocket 客户端交互:** 1. **连接:** 连接到 `ws://localhost:8080`。 2. **发送 ping 消息:** ```json {"type": "ping"} ``` 3. **接收 pong 消息:** ```json {"type": "pong"} ``` 4. **发送模型请求消息:** ```json {"type": "model_request", "data": {"input_data": "example input"}} ``` 5. **接收模型响应消息:** ```json {"type": "model_response", "data": {"result": "Model processing successful", "data": {"input": {"input_data": "example input"}, "output": "This is a simulated model output."}}} ``` **重要提示:** - **替换 `processModelRequest` 函数:** 你需要根据你的实际模型处理逻辑替换 `processModelRequest` 函数的内容。 - **错误处理:** 在实际应用中,你需要添加更完善的错误处理机制。 - **安全性:** 在生产环境中,你需要考虑安全性问题,例如身份验证和授权。 - **依赖管理:** Deno 使用 URL 作为依赖项,因此你需要确保你的依赖项 URL 是正确的。 **中文翻译:** 好的,这是一个用 Deno 实现的模板模型上下文协议 (MCP) 服务器: ```typescript import { serve } from "https://deno.land/std@0.177.1/http/server.ts"; import { acceptWebSocket, isWebSocketCloseEvent, WebSocket, } from "https://deno.land/std@0.177.1/ws/mod.ts"; // 定义 MCP 消息类型 interface MCPMessage { type: string; data: any; } // 处理 WebSocket 连接 async function handleWebSocket(ws: WebSocket) { console.log("WebSocket 已连接"); try { for await (const event of ws) { if (typeof event === "string") { // 处理文本消息 try { const message: MCPMessage = JSON.parse(event); console.log("接收到的消息:", message); // 根据消息类型进行处理 switch (message.type) { case "ping": // 响应 ping 消息 ws.send(JSON.stringify({ type: "pong" })); break; case "model_request": // 处理模型请求 const modelResponse = await processModelRequest(message.data); ws.send(JSON.stringify({ type: "model_response", data: modelResponse })); break; default: console.warn("未知消息类型:", message.type); ws.send(JSON.stringify({ type: "error", data: "未知消息类型" })); } } catch (error) { console.error("解析消息时出错:", error); ws.send(JSON.stringify({ type: "error", data: "无效的消息格式" })); } } else if (isWebSocketCloseEvent(event)) { // 处理 WebSocket 关闭事件 const { code, reason } = event; console.log("WebSocket 已关闭:", code, reason); } } } catch (error) { console.error("处理 WebSocket 时出错:", error); try { ws.close(1011, "Internal Server Error"); // 1011 表示服务器遇到了意外情况,阻止其完成请求。 } catch (_ignore) { // 忽略关闭错误,因为连接可能已经关闭 } } } // 模拟模型请求处理函数 async function processModelRequest(requestData: any): Promise<any> { // 在这里实现你的模型处理逻辑 console.log("正在处理模型请求:", requestData); // 模拟延迟 await new Promise((resolve) => setTimeout(resolve, 500)); // 模拟模型响应 return { result: "模型处理成功", data: { input: requestData, output: "这是一个模拟的模型输出。", }, }; } // HTTP 请求处理函数 async function handleHttpRequest(request: Request): Promise<Response> { if (request.headers.get("upgrade") === "websocket") { // 处理 WebSocket 连接 const { socket, response } = Deno.upgradeWebSocket(request); handleWebSocket(socket); return response; } else { // 处理 HTTP 请求 return new Response("你好,Deno!这是一个模型上下文协议服务器。", { headers: { "content-type": "text/plain" }, }); } } // 启动服务器 const port = 8080; console.log(`服务器监听端口 ${port}`); await serve(handleHttpRequest, { port }); ``` **代码解释:** 1. **导入必要的模块:** - `serve` 来自 `https://deno.land/std@0.177.1/http/server.ts` 用于启动 HTTP 服务器。 - `acceptWebSocket`, `isWebSocketCloseEvent`, `WebSocket` 来自 `https://deno.land/std@0.177.1/ws/mod.ts` 用于处理 WebSocket 连接。 2. **定义 `MCPMessage` 接口:** - 定义了 MCP 消息的结构,包含 `type` (字符串类型) 和 `data` (任意类型) 两个字段。 3. **`handleWebSocket(ws: WebSocket)` 函数:** - 处理 WebSocket 连接的逻辑。 - 使用 `for await (const event of ws)` 循环监听 WebSocket 事件。 - **处理文本消息 (`typeof event === "string"`):** - 使用 `JSON.parse(event)` 将文本消息解析为 `MCPMessage` 对象。 - 使用 `switch` 语句根据 `message.type` 进行不同的处理: - `ping`: 响应 `pong` 消息。 - `model_request`: 调用 `processModelRequest` 函数处理模型请求,并将响应发送回客户端。 - `default`: 处理未知消息类型,并发送错误消息。 - 使用 `try...catch` 块捕获 JSON 解析错误。 - **处理 WebSocket 关闭事件 (`isWebSocketCloseEvent(event)`):** - 记录关闭代码和原因。 - 使用 `try...catch` 块捕获 WebSocket 处理过程中的错误,并尝试关闭连接。 4. **`processModelRequest(requestData: any): Promise<any>` 函数:** - **模拟** 模型请求处理逻辑。 - 接受 `requestData` 作为输入。 - 使用 `await new Promise((resolve) => setTimeout(resolve, 500))` 模拟延迟。 - 返回一个包含 `result` 和 `data` 的模拟响应。 - **你需要根据你的实际模型处理逻辑替换此函数的内容。** 5. **`handleHttpRequest(request: Request): Promise<Response>` 函数:** - 处理 HTTP 请求的逻辑。 - **WebSocket 升级:** - 检查请求头中是否包含 `upgrade: websocket`。 - 如果是,则使用 `Deno.upgradeWebSocket(request)` 将 HTTP 连接升级为 WebSocket 连接。 - 调用 `handleWebSocket(socket)` 处理 WebSocket 连接。 - 返回 `response` 对象。 - **HTTP 请求处理:** - 如果不是 WebSocket 升级请求,则返回一个简单的 "你好,Deno!" 响应。 6. **启动服务器:** - 定义服务器监听的端口号 `port = 8080`。 - 使用 `console.log` 打印服务器启动信息。 - 使用 `await serve(handleHttpRequest, { port })` 启动服务器,并传入 HTTP 请求处理函数和端口号。 **如何运行:** 1. **保存代码:** 将代码保存为 `mcp_server.ts` 文件。 2. **运行命令:** 在终端中运行以下命令: ```bash deno run --allow-net mcp_server.ts ``` - `--allow-net` 标志允许 Deno 程序访问网络。 **如何测试:** 你可以使用 WebSocket 客户端(例如 wscat 或 Postman)连接到服务器,并发送 MCP 消息进行测试。 **示例 WebSocket 客户端交互:** 1. **连接:** 连接到 `ws://localhost:8080`。 2. **发送 ping 消息:** ```json {"type": "ping"} ``` 3. **接收 pong 消息:** ```json {"type": "pong"} ``` 4. **发送模型请求消息:** ```json {"type": "model_request", "data": {"input_data": "example input"}} ``` 5. **接收模型响应消息:** ```json {"type": "model_response", "data": {"result": "模型处理成功", "data": {"input": {"input_data": "example input"}, "output": "这是一个模拟的模型输出。"}}} ``` **重要提示:** - **替换 `processModelRequest` 函数:** 你需要根据你的实际模型处理逻辑替换 `processModelRequest` 函数的内容。 - **错误处理:** 在实际应用中,你需要添加更完善的错误处理机制。 - **安全性:** 在生产环境中,你需要考虑安全性问题,例如身份验证和授权。 - **依赖管理:** Deno 使用 URL 作为依赖项,因此你需要确保你的依赖项 URL 是正确的。 This provides a basic template. Remember to replace the placeholder `processModelRequest` function with your actual model processing logic. Also, consider adding more robust error handling and security measures for production use.

Weather MCP Server

Weather MCP Server

MCP 服务器获取美国城市天气 Or, more literally: MCP 服务器获取美国城市的天气

Academiadepolitie.com MCP Server

Academiadepolitie.com MCP Server

Provides AI tutoring capabilities for Romanian police academy entrance exam preparation, enabling students to access educational content, track learning progress, and collaborate with peers. Connects to the Academiadepolitie.com platform serving over 50,000 students with comprehensive study materials for law enforcement subjects.

cc-mem-mcp

cc-mem-mcp

Lossless, categorized long-term memory for Claude Code (and any MCP client), backed by Qdrant, capturing compaction summaries across generations.

github-ops-mcp

github-ops-mcp

An MCP server that provides operational tooling over the GitHub API — issue triage, PR review monitoring, repo health audits, and team access reviews.

Web Scraper MCP Server

Web Scraper MCP Server

Enables MCP-compatible clients to scrape and extract data from live websites using a headless Chromium browser, with support for CSS selectors, link extraction, table extraction, and Amazon product pages.

SkillStrata

SkillStrata

Enables automatic discovery and reuse of tools from Claude Code execution traces. Provides MCP tools that are distilled from real work, allowing you to reuse previously written scripts without manual effort.

Example Next.js MCP Server

Example Next.js MCP Server

Provides a template to run an MCP server in a Next.js project using the Vercel MCP Adapter, with SSE transport supported via Redis.

Claude Team MCP

Claude Team MCP

Enables collaboration between multiple AI models (GPT, Claude, Gemini) to work together on complex tasks, with intelligent task distribution and role-based expert assignment for code development, review, and optimization.

remindctl-mcp

remindctl-mcp

MCP server for Apple Reminders, enabling management of reminders and lists via tools like add, edit, complete, and delete reminders.

godot-mcp-omni

godot-mcp-omni

Codex-optimized MCP server for Godot 4.x with a compact set of high-signal tools for project, scene, script, editor, and API operations.

SIA MCP Server

SIA MCP Server

Enables management of SAP Intelligent Agriculture farming platform, including areas, farms, fields, crop zones, and reference data through natural language.

slurm_MCP

slurm_MCP

Enables interaction with Slurm HPC clusters via SSH, allowing job submission, monitoring, and error diagnosis through MCP clients like Claude Desktop.

On Running MCP

On Running MCP

用于与 On Running API 交互的 MCP 服务器

AutoFlow

AutoFlow

AutoFlow enables AI agents to automate Windows desktop tasks by visually recognizing screen elements and simulating keyboard and mouse actions, with 18 MCP tools for workflow control.

GitLab MCP (glab)

GitLab MCP (glab)

Provides GitLab issue and CI/CD management tools using the glab CLI, with reduced context token usage compared to the official GitLab MCP.

ltm

ltm

Portable memory protocol for AI coding sessions. Push the state of a session (goal, decisions, attempts, next step) from one MCP-capable agent and pull it back from another.

SEC Filing MCP Server

SEC Filing MCP Server

Enables querying and analysis of SEC filing documents through natural language. Uses Pinecone vector search with document summarization to help users retrieve and understand financial filings for various companies.

stremio-mcp

stremio-mcp

Unified MCP server for Stremio enabling search, metadata, catalogs, and stream listings via Stremio's addon APIs, plus Android TV playback control over adb.

wp-ultra-mcp

wp-ultra-mcp

Turns any WordPress site into an MCP server, allowing AI clients to directly control files, database, WP-CLI, PHP, content, and more through declarative abilities without writing code.

Open Helplines

Open Helplines

CC0 open-data registry of community support helplines worldwide. TypeScript MCP server providing verified contacts with citation, staleness, and country-context guardrails. 15+ countries indexed.

ibkr-mcp-server

ibkr-mcp-server

MCP server for Interactive Brokers that exposes portfolio data, market quotes, trading, and analysis to any MCP-compatible AI client, with support for EU investors and safety-gated trading.

聚义厅MCP

聚义厅MCP

An AI personality collaboration tool based on Model Context Protocol (MCP) that enables users to summon and collaborate with multiple AI personas for intelligent analysis and problem-solving.

Math Operations MCP Server

Math Operations MCP Server

Enables mathematical operations and calculations through an MCP server interface. Provides computational capabilities accessible via HTTP endpoints for mathematical processing tasks.

enquire-mcp

enquire-mcp

MCP server that exposes a local Obsidian vault as persistent, searchable memory for AI agents, with hybrid retrieval, reranker, and PDF support.

Dear User

Dear User

Tells you how you and your Claude agent actually work together. Reads CLAUDE.md, hooks, skills, memory + scheduled tasks and writes you a letter. Local-only, no API keys, no data leaves your machine.

ecommerce-mcp

ecommerce-mcp

Enables AI to view and manage e-commerce data such as products, orders, and coupons, and perform actions like updating prices, stock, and generating sales reports.