PD

puchunjie/doc-tools-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 6 forks 质量 64 趋势 18MIT

A Model Context Protocol (MCP) server that provides AI-powered Word document manipulation capabilities.

概览

A Model Context Protocol (MCP) server that provides AI-powered Word document manipulation capabilities. This server implements the MCP protocol to enable AI applications to create, edit, and manage Word documents through natural language interactions. - Full MCP protocol implementation - Word document creation and management - Rich text content manipulation - Table creation and formatting - Document layout control - Document metadata management - Real-time document state monitoring - Node.js 14 or higher - Microsoft Word (optional, for advanced features) For use as a dependency in your project: 2. The server will start on port 8765 by default 3. Configure your AI application (e.g., Cursor, VSCode) to use the MCP server: The server provides the following MCP functions: - create_document - Create a new Word document - Parameters: filePath (required), title, author

README

以下为原文 README 节选,完整内容请查看原文。

Word Tools MCP Server

A Model Context Protocol (MCP) server that provides AI-powered Word document manipulation capabilities. This server implements the MCP protocol to enable AI applications to create, edit, and manage Word documents through natural language interactions.

Features

  • Full MCP protocol implementation
  • Word document creation and management
  • Rich text content manipulation
  • Table creation and formatting
  • Document layout control
  • Document metadata management
  • Real-time document state monitoring

Prerequisites

  • Node.js 14 or higher
  • Microsoft Word (optional, for advanced features)

Installation

npx @puchunjie/doc-tools-mcp

Or install globally:

npm install -g @puchunjie/doc-tools-mcp

For use as a dependency in your project:

npm install @puchunjie/doc-tools-mcp

Usage

  1. Start the MCP server:
npx @puchunjie/doc-tools-mcp
  1. The server will start on port 8765 by default

  2. Configure your AI application (e.g., Cursor, VSCode) to use the MCP server:

    http://localhost:8765
    

MCP Tools

The server provides the following MCP functions:

  • create_document - Create a new Word document

    • Parameters: filePath (required), title, author
  • open_document - Open an existing Word document

    • Parameters: filePath (required)
  • add_paragraph - Add a paragraph to the document

    • Parameters: filePath (required), text (required), style, alignment
  • add_table - Add a table to the document

    • Parameters: filePath (required), rows (required), cols (required), headers, data
  • search_and_replace - Find and replace text in the document

    • Parameters: filePath (required), searchText (required), replaceText (required), matchCase
  • set_page_margins - Set document page margins

    • Parameters: filePath (required), top, right, bottom, left
  • get_document_info - Get document metadata

    • Parameters: filePath (required)

Integration with AI Applications

Cursor

  1. Open the Cursor configuration file ~/.cursor/mcp.json
  2. Add the following configuration:
{
  "mcpServers": {
    "doc-tools-mcp": {
      "command": "npx",
      "args": [
        "@puchunjie/doc-tools-mcp"
      ]
    }
  }
}

Or for local development version:

{
  "mcpServers": {
    "doc-tools-mcp": {
      "command": "node",
      "args": [
        "/path/to/your/doc-tools-mcp/dist/mcp-server.js"
      ]
    }
  }
}

After configuration, you can use natural language to manipulate Word documents:

"Create a new document named report.docx"
"Add a heading 'Monthly Report' to report.docx"
"Insert a 4x3 table with sales data"

VSCode and Other MCP-Compatible Tools

在 GitHub 查看完整 README

安装

npx @puchunjie/doc-tools-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "doc-tools-mcp": { "command": "npx", "args": [ "@puchunjie/doc-tools-mcp" ] } } }