Skip to content

Office Oxide MCP 服务器 — 快速上手

office-oxide-mcp 是一个 Model Context Protocol 服务器,让 AI 助手能够提取 Office 文档中的内容。它完全在本地运行,文件不会离开你的机器。

安装 crgx(仅需一次)

crgx 是面向 Rust 二进制的 npx 风格运行器,首次执行时会自动下载 office_oxide_mcp,无需手动安装 MCP。

Linux / macOS

curl -fsSL crgx.dev/install.sh | sh

Windows (PowerShell)

irm crgx.dev/install.ps1 | iex

配置

安装好 crgx 后,将下方配置粘贴到你的 AI 工具中即可。office_oxide_mcp 的下载与更新均由 crgx 自动完成。

Claude Desktop

添加到 ~/.config/claude/claude_desktop_config.json(Linux)或 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):

{
  "mcpServers": {
    "office-oxide": {
      "command": "crgx",
      "args": ["office_oxide_mcp@latest"]
    }
  }
}

Claude Code

添加到项目的 .claude/settings.json

{
  "mcpServers": {
    "office-oxide": {
      "command": "crgx",
      "args": ["office_oxide_mcp@latest"]
    }
  }
}

Cursor

添加到 Cursor 的 MCP 设置中:

{
  "mcpServers": {
    "office-oxide": {
      "command": "crgx",
      "args": ["office_oxide_mcp@latest"]
    }
  }
}

备选安装方式

如果你不想使用 crgx,也可以直接安装 office_oxide_mcp

cargo install office_oxide_mcp

然后在 AI 工具中指向该二进制文件:

{
  "mcpServers": {
    "office-oxide": {
      "command": "office-oxide-mcp"
    }
  }
}

可用工具

extract

从六种受支持的 Office 格式中提取文本、Markdown、HTML 或结构化 IR。

参数 类型 必填 说明
file_path string .docx.xlsx.pptx.doc.xls.ppt 文件路径
output_path string 提取内容的写入路径
format string "text"(默认)、"markdown""html""ir"
from_format string 覆盖基于扩展名的格式识别

convert

格式间转换 — 主要用于旧版格式到 OOXML 的迁移。

参数 类型 必填 说明
input_path string 源文件
output_path string 目标文件(目标格式由扩展名推断)

工作原理

MCP 服务器通过 stdio JSON-RPC 2.0 进行通信。当 AI 助手需要读取 Office 文档时,它会发送一个 tools/call 请求,并收到指向输出文件的确认响应。

所有处理均在本地完成,使用的是与库和 CLI 相同的 Rust 提取引擎 — 不向任何外部服务发送数据。

效果好的提示词

  • “把 quarterly.docx 的 Markdown 导出到 quarterly.md。”
  • “将 legacy/old_report.doc 转换为 modern/old_report.docx。”
  • “把 slides.pptx 提取为 HTML 输出到 slides.html,方便我在浏览器里预览。”
  • “把 pricing.xlsx 的 IR JSON 转储到 pricing.ir.json,我想查看表格结构。”

底层实现上,助手会发出类似这样的 JSON-RPC 调用:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "extract",
    "arguments": {
      "file_path": "/path/quarterly.docx",
      "output_path": "/path/quarterly.md",
      "format": "markdown"
    }
  }
}

服务器将结果写入 output_path 并返回简短的确认信息;助手随后将该文件读回自己的上下文。

相关链接