发现优秀的 MCP 服务器
通过 MCP 服务器扩展您的代理能力,拥有 84,423 个能力。
doc-tools-mcp
在 Node.js 中实现 Word 文档的读取和写入 MCP (Message Communication Protocol) 协议,需要分解成几个部分,并使用合适的库来处理 Word 文档和网络通信。 由于 MCP 通常指的是消息通信协议,与 Word 文档本身没有直接关系,因此我将假设你需要: 1. **读取和写入 Word 文档 (docx 格式)** 2. **使用 MCP 协议发送和接收 Word 文档的内容或相关信息** 以下是一个概念性的实现方案,包含代码示例和解释。 **1. 读取和写入 Word 文档 (docx 格式)** 可以使用 `docx` 库来处理 Word 文档。 ```bash npm install docx ``` ```javascript const { Document, Packer, Paragraph, TextRun } = require("docx"); const fs = require("fs"); // 创建一个新的 Word 文档 async function createWordDocument(data) { const doc = new Document({ sections: [{ children: [ new Paragraph({ children: [ new TextRun(data), ], }), ], }], }); // 将文档保存到文件 const buffer = await Packer.toBuffer(doc); fs.writeFileSync("my-document.docx", buffer); console.log("Word document created successfully!"); } // 读取 Word 文档 (需要额外的库,例如 mammoth.js) async function readWordDocument(filePath) { const mammoth = require("mammoth"); // 需要安装: npm install mammoth try { const result = await mammoth.extractRawText({ path: filePath }); const text = result.value; console.log("Word document content:", text); return text; } catch (error) { console.error("Error reading Word document:", error); return null; } } // 示例用法 async function main() { await createWordDocument("Hello, this is a test document created with Node.js!"); const content = await readWordDocument("my-document.docx"); if (content) { console.log("Successfully read the document."); } } main(); ``` **解释:** * **`docx` 库:** 用于创建和修改 Word 文档。 `Document`, `Paragraph`, `TextRun` 是 `docx` 库提供的类,用于构建文档结构。 * **`mammoth` 库:** 用于读取 Word 文档的内容。 `mammoth.extractRawText` 提取文档中的文本。 * **`fs` 模块:** Node.js 的文件系统模块,用于读写文件。 * **`createWordDocument` 函数:** 创建一个包含指定文本的 Word 文档,并将其保存到 `my-document.docx` 文件中。 * **`readWordDocument` 函数:** 读取指定路径的 Word 文档,并返回其文本内容。 **2. 使用 MCP 协议发送和接收 Word 文档的内容或相关信息** 这里需要定义 MCP 协议的具体格式。 假设 MCP 协议包含以下字段: * `type`: 消息类型 (例如 "document_content", "document_metadata") * `data`: 消息数据 (例如 Word 文档的内容,文档的元数据) 可以使用 Node.js 的 `net` 模块创建 TCP 服务器和客户端,并使用自定义的 MCP 协议进行通信。 ```javascript const net = require("net"); // MCP 协议编码函数 function encodeMCP(type, data) { const message = JSON.stringify({ type, data }); const length = Buffer.byteLength(message, 'utf8'); const lengthBuffer = Buffer.alloc(4); // 4 字节表示消息长度 lengthBuffer.writeInt32BE(length, 0); return Buffer.concat([lengthBuffer, Buffer.from(message, 'utf8')]); } // MCP 协议解码函数 function decodeMCP(buffer) { const length = buffer.readInt32BE(0); const message = buffer.slice(4, 4 + length).toString('utf8'); return JSON.parse(message); } // 服务器端 function startServer(port) { const server = net.createServer((socket) => { console.log("Client connected."); let receivedData = Buffer.alloc(0); socket.on("data", (data) => { receivedData = Buffer.concat([receivedData, data]); while (receivedData.length >= 4) { const length = receivedData.readInt32BE(0); if (receivedData.length >= 4 + length) { const messageBuffer = receivedData.slice(0, 4 + length); const message = decodeMCP(messageBuffer); console.log("Received message:", message); // 处理消息 if (message.type === "document_content") { console.log("Received document content:", message.data); } receivedData = receivedData.slice(4 + length); // 移除已处理的消息 } else { break; // 等待更多数据 } } }); socket.on("end", () => { console.log("Client disconnected."); }); socket.on("error", (err) => { console.error("Socket error:", err); }); }); server.listen(port, () => { console.log(`Server listening on port ${port}`); }); } // 客户端 function connectToServer(port, message) { const client = net.createConnection({ port: port }, () => { console.log("Connected to server."); const encodedMessage = encodeMCP(message.type, message.data); client.write(encodedMessage); }); client.on("data", (data) => { console.log("Received data from server:", data.toString()); client.end(); }); client.on("end", () => { console.log("Disconnected from server."); }); client.on("error", (err) => { console.error("Client error:", err); }); } // 示例用法 async function main() { const port = 8080; // 启动服务器 startServer(port); // 等待服务器启动 await new Promise(resolve => setTimeout(resolve, 1000)); // 读取 Word 文档内容 const documentContent = await readWordDocument("my-document.docx"); if (documentContent) { // 创建 MCP 消息 const message = { type: "document_content", data: documentContent, }; // 连接到服务器并发送消息 connectToServer(port, message); } } main(); ``` **解释:** * **`net` 模块:** Node.js 的网络模块,用于创建 TCP 服务器和客户端。 * **`encodeMCP` 函数:** 将消息编码为 MCP 协议格式。 它将消息类型和数据转换为 JSON 字符串,然后计算字符串的长度,并将长度作为 4 字节的大端整数添加到消息的前面。 * **`decodeMCP` 函数:** 将 MCP 协议格式的消息解码为 JavaScript 对象。 它首先读取消息长度,然后读取消息内容,并将其解析为 JSON 对象。 * **`startServer` 函数:** 启动一个 TCP 服务器,监听指定端口。 当客户端连接时,它会接收数据,解码 MCP 消息,并处理消息。 * **`connectToServer` 函数:** 连接到指定端口的 TCP 服务器,并发送 MCP 消息。 * **示例用法:** 首先启动服务器,然后读取 Word 文档的内容,创建一个包含文档内容的 MCP 消息,并将其发送到服务器。 **关键点:** * **MCP 协议定义:** 你需要根据实际需求定义 MCP 协议的格式。 上面的示例使用 JSON 格式,并添加了消息长度字段。 * **错误处理:** 在实际应用中,需要添加更完善的错误处理机制,例如处理网络连接错误,数据解析错误等。 * **数据分块:** 如果 Word 文档非常大,可能需要将文档内容分成多个块进行传输。 * **安全性:** 如果需要传输敏感数据,需要考虑使用加密技术,例如 TLS/SSL。 * **库的选择:** `docx` 和 `mammoth` 只是处理 Word 文档的其中两种库。 还有其他的库,例如 `officegen`,可以用于创建更复杂的 Word 文档。 选择合适的库取决于你的具体需求。 **总结:** 这个方案提供了一个基本的框架,用于在 Node.js 中实现 Word 文档的读取和写入,并使用 MCP 协议进行通信。 你需要根据实际需求调整代码,并添加必要的错误处理和安全性措施。 记住安装所需的 npm 包:`npm install docx mammoth`。 如果需要更复杂的 Word 文档处理功能,可以考虑使用其他的 Word 文档处理库。
MCP-SOC Middleware
Enables AI agents to interact with Splunk SIEM and TheHive SOAR through a unified MCP interface, providing 12 tools for alert triage, case management, and security operations.
Microsoft 365 Core MCP Server
Provides comprehensive management of Microsoft 365 services including Exchange, SharePoint, Teams, Azure AD, Intune device management, security & compliance frameworks, and universal access to 1000+ Microsoft Graph API endpoints with advanced features like batch operations, delta queries, and real-time webhooks.
brain-trust
Enables AI agents to ask questions and review planning documents by connecting to OpenAI's GPT-4. Provides context-aware question answering and multi-level plan analysis with structured feedback including strengths, weaknesses, and suggestions.
Proxmox MCP Server
MCP server for managing Proxmox VE virtualization infrastructure, providing tools for VMs, containers, snapshots, storage, cluster nodes, and tasks. Compatible with Claude Desktop, Cline, and other MCP clients via natural language.
MockMCP
Hosted MCP endpoint that returns realistic fake data for prototyping agents. Paste one URL into Claude Code, Cursor, or Claude Desktop — 12 pre-built tools covering users, products, orders, events, email, and knowledge base search. No signup, no config, no auth. Built for developers who want to prototype agent workflows before wiring up a real backend.
RollDate MCP
Helps AI agents install and integrate the RollDate vanilla JS scrolling date picker into projects.
arxiv-smart-mcp
MCP server for searching and reading arXiv papers from AI assistants, with built-in rate limiting to avoid API blocks.
HA Admin MCP
An MCP server for safely previewing, creating, validating, editing and rolling back AI-managed Home Assistant automations.
pytorch-mcp
A full-featured MCP server for PyTorch documentation workflows, providing tools for search, symbol lookup, code examples, troubleshooting, and question-answering using local docs.
kat-tribute-mcp
MCP server for foldkit that provides tools and resources for the 7-prime spine, 7 κ-bands, and 6 fold operations, enabling folding, classification, and state manipulation in any MCP client.
z/OS FTP MCP Server
Enables interaction with z/OS mainframe systems via FTP, including dataset listing/download/upload, JCL job submission and monitoring, with advanced text processing and pagination support.
webcheck-mcp
Website health checker MCP server - SEO audit, accessibility scan, broken link detection, performance analysis, and page comparison.
Brevo MCP Server
A comprehensive MCP server providing Claude with full access to Brevo's marketing automation platform through the official SDK, featuring tools for email operations, contact management, campaigns, SMS, conversations, webhooks, e-commerce, and account management.
movmint-fx-mcp
Exposes two tools (get_fx_quote, capture_fx_quote) that LLM clients can call to get live FX rates and execute trades.
remark-mcp
Enables AI assistants to browse and read documents from a reMarkable tablet connected via USB, rendering PDF pages as images for the AI to see.
MCP Jieba Server
Provides high-performance Chinese text segmentation, POS tagging, and keyword extraction using Rust-based Jieba implementation. Supports both local STDIO and remote HTTP deployment modes.
Keboola Explorer MCP Server
This server facilitates interaction with Keboola's Storage API, enabling users to browse and manage project buckets, tables, and components efficiently through Claude Desktop.
Rootstock MCP Server
A backend service that enables seamless interaction with the Rootstock blockchain using the Model Context Protocol, providing standardized APIs for querying, transacting, and managing assets on Rootstock.
African Market OS - MVR API
Read-only relational-readiness preflight for AI agents evaluating market trust, permission, evidence gaps, pilot readiness, and scale readiness in African and other high-context markets.
Useful-mcps
以下是一些实用的小型 MCP 服务器,包括: * docx\_replace:替换 Word 文档中的标签 * yt-dlp:基于章节提取章节和字幕 * mermaid:使用 mermaidchart.com API 生成和渲染图像
advanced-seo-mcp
Provides AI agents with professional-grade SEO capabilities including on-page analysis, technical audits, PageSpeed insights, and Ahrefs data integration.
OpenFDA MCP Server
A comprehensive MCP server that provides access to U.S. FDA public datasets via the openFDA API, enabling querying of drug adverse events, labeling, recalls, approvals, shortages, NDC directory, and medical device regulatory data.
PABS MCP Server
Provides AI coding tools with live access to product strategy including briefs, hypotheses, competitor analysis, PRD, and strategic pulse for context-aware development.
mcPixelmonServer
openfinance-br-mcp
Enables Claude to interact with the Open Finance Brasil APIs, allowing users to query accounts, balances, transactions, credit cards, PIX keys, initiate PIX payments, and view investments across supported Brazilian banks using natural language.
DB Query MCP
Query SQLite databases via AI — safe read-only mode
Chrome MCP Server
Enables AI assistants to control and automate your Chrome browser directly, leveraging existing login states and configurations for tasks like content analysis, semantic search across tabs, screenshots, network monitoring, and interactive operations.
CozoDB Memory MCP Server
Local-first memory for Claude & AI agents with hybrid search, Graph-RAG, and time-travel, runs entirely on your machine.
Model Context Protocol (MCP) Server for Unity