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 工具里。crgx 会自动下载并更新 office_oxide_mcp。
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
从六种支持格式中提取文本、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 并返回简短确认;助手再把文件读回上下文。
相关链接
- CLI — 在终端做同样的操作
- Rust crate — 把同一引擎当作库
- MCP 规范 — modelcontextprotocol.io