关于 Microsoft Office
Microsoft Office 是面向桌面版 Microsoft 365 的 MCP 服务,可读取和编辑当前打开的 Word、Excel 与 PowerPoint 文件。它通过 Office 加载项 sidecar 工作,并支持 macOS 和 Windows。
主要功能
- 01读取和编辑 Word 文档
- 02操作 Excel 单元格与公式
- 03读取和编辑 PowerPoint 幻灯片
- 04处理批注与修订
- 05查看当前选区和文档结构
适用场景
- 01更新打开的 Word 文档并处理修订
- 02在 Excel 中填入公式并格式化数据
- 03调整 PowerPoint 幻灯片及演讲者备注
MCP 相关
它向 MCP 客户端提供 62 个 Office 工具,通过本地 sidecar 和 Office 加载项操作桌面应用中已打开的文件。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y @mindstone/mcp-server-officeMCP_OFFICE_SIDECAR_STATEAbsolute path to sidecar state file (host-managed; sidecar writes port + token here)MCP_OFFICE_SIDECAR_DISABLEKill-switch — set to 1 to refuse to spawn or talk to the sidecarREBEL_DISABLE_OFFICE_SIDECARDEPRECATED legacy alias for MCP_OFFICE_SIDECAR_DISABLE — still honored for backward compatibility with v0.1.1 operator-set kill-switches; will be removed in a future major version. Use MCP_OFFICE_SIDECAR_DISABLE instead.MCP_OFFICE_SIDECAR_STATE_DIRSidecar state directory (certs, per-app manifests). Normally derived from MCP_OFFICE_SIDECAR_STATE; hosts managing the sidecar lifecycle directly can override.MCP_OFFICE_ADDIN_DIRAbsolute path to the built add-in static files. Defaults to the package's dist/addin/ directory.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
62收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | enum | 否 | 安装还是卸载加载项。install | uninstall |
详细介绍
@mindstone/mcp-server-office
通过 Office 加载项 sidecar,从桌面版 Microsoft 365 读取和编辑 Word 文档、Excel 工作簿和 PowerPoint 演示文稿。
仅限桌面版的 Office MCP。可编辑用户已在 macOS 或 Windows 上打开的 Word/Excel/PowerPoint 文档。
状态
- 版本: 0.3.0 · npm
- 身份验证: 无(
server.json) - 工具: 62(word、excel、powerpoint、setup)
- 界面: 桌面加载项
- 机器可读:
STATUS.json
为什么要开发它
在我们开发这个项目时,Microsoft 尚未为 桌面版 Office 应用提供 MCP 服务,而我们找到的社区方案要么针对存储在云端的文档,通过 Microsoft Graph 操作,要么只能在 Windows 上运行。我们需要一个既能编辑用户已打开的 Word 文档、Excel 工作簿或 PowerPoint 演示文稿,又能在 macOS 和 Windows 上实时访问所选内容、公式和修订记录的方案。此软件包将 MCP 服务、用于与 Office 通信的小型本地助手以及 Office 加载项本身打包为一次 npm 安装,因此这三个部分始终以相同版本发布。
交互示例
“在我打开的 Excel 工作簿中,为每个数据行的 D 列填入 =B*C,并将汇总行加粗。”
宿主调用的工具:
rebel_office_excel_set_formula— 将=B<row>*C<row>写入 D 列的每个单元格。rebel_office_excel_format_range— 将汇总行范围设为粗体。
响应(删节):
{
"set_formula": {
"worksheet": "Sheet1",
"range": "D2:D24",
"formula": "=B2*C2",
"filled_rows": 23
},
"format_range": {
"worksheet": "Sheet1",
"range": "A25:D25",
"bold": true
}
}
要求
- Node.js 20+
- npm
- 安装了 Microsoft 365 Word、Excel 和/或 PowerPoint 的 macOS 或 Windows
- Windows 首次运行时会提示管理员批准,以信任开发证书(仅需一次)
一键安装
点击按钮后,宿主会提示你填写:MCP_OFFICE_SIDECAR_STATE。
Claude Desktop / Claude Code / Goose / Continue.dev(Microsoft Office)的手动配置
{
"mcpServers": {
"Microsoft Office": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-office"
],
"env": {
"MCP_OFFICE_SIDECAR_STATE": ""
}
}
}
}
快速开始
安装并构建
cd <path-to-repo>/connectors/office
npm install
npm run build
npx(发布后使用)
npx -y @mindstone/mcp-server-office
本地
node dist/index.js
配置
环境变量
由 stdio MCP 服务读取(dist/index.js):
MCP_OFFICE_SIDECAR_STATE— 必需。sidecar 状态文件(JSON)的绝对路径。MCP 服务从该文件读取port和token,以便与 sidecar 通信;sidecar 会在启动时写入此文件。状态文件的父目录也用作 sidecar 的状态目录(证书、各应用的清单)。MCP_OFFICE_SIDECAR_DISABLE— 可选的紧急停用开关。设置为1时,MCP 服务会拒绝与 sidecar 通信,也不会启动 sidecar。
由 sidecar 读取(dist/sidecar/cli.js)——通常由 MCP 服务在延迟启动 sidecar 时设置;此处记录这些变量,供直接管理 sidecar 生命周期的宿主使用:
MCP_OFFICE_SIDECAR_STATE_DIR— sidecar 必需。用于存放状态文件、HTTPS 证书和生成的各应用清单(manifest.word.xml、manifest.excel.xml、manifest.powerpoint.xml)的目录。MCP 服务会从MCP_OFFICE_SIDECAR_STATE的父目录推导此路径,并自动传入。MCP_OFFICE_ADDIN_DIR— 可选。已构建的加载项静态文件的绝对路径(包含taskpane.html、taskpane.js和assets/的目录)。MCP 服务会将其设为软件包的dist/addin/目录;提供自定义加载项包的宿主可以覆盖此值。
宿主配置示例
Claude Desktop / Cursor
Office 连接器旨在由拥有 sidecar 生命周期管理权的宿主应用程序(如 Mindstone Rebel)管理。也可以直接从 Claude Desktop 运行,但宿主必须提供可写入的 MCP_OFFICE_SIDECAR_STATE 路径。
{
"mcpServers": {
"Office": {
"command": "npx",
"args": ["-y", "@mindstone/mcp-server-office"],
"env": {
"MCP_OFFICE_SIDECAR_STATE": "/absolute/path/to/sidecar-state.json"
}
}
}
}
Mindstone Rebel
"RebelOffice": {
"name": "RebelOffice",
"type": "stdio",
"command": "npx",
"args": ["-y", "@mindstone/[email protected]"],
"env": {
"MCP_OFFICE_SIDECAR_STATE": "~/Library/Application Support/mindstone-rebel/office-sidecar/sidecar-state.json"
},
"description": "Microsoft Office integration — Word, Excel, PowerPoint.",
"catalogId": "bundled-office"
}
工具(62)
设置
rebel_office_setup— 安装或修复(或卸载)Office 加载项。rebel_office_status— 检查 Word、Excel、PowerPoint 的 Office 连接状态。
Word(20)
rebel_office_word_read_document— 读取当前 Word 文档正文,按段落分页。rebel_office_word_get_document_structure— 获取文档的标题/章节大纲。rebel_office_word_get_selection— 获取当前选中的文本和位置。rebel_office_word_find_text— 搜索文本及其周围的上下文。rebel_office_word_insert_text— 在指定位置插入文本或替换所选内容(有破坏性)。rebel_office_word_replace_text— 在文档中查找并替换文本(有破坏性)。rebel_office_word_format_text— 应用字体、颜色、高亮或对齐格式(有破坏性)。rebel_office_word_apply_style— 为现有段落应用命名段落样式(例如 “Heading 1”“Quote”)(有破坏性)。rebel_office_word_insert_table— 插入包含表头和行的表格(有破坏性)。rebel_office_word_read_table— 将表格单元格的值读取为二维数组。rebel_office_word_update_table_cell— 替换单个表格单元格的文本(有破坏性)。rebel_office_word_insert_image— 从文件路径或 base64 数据插入图像(有破坏性)。rebel_office_word_insert_break— 插入分页符或分节符(有破坏性)。rebel_office_word_set_header_footer— 设置页眉或页脚文本及其对齐方式(有破坏性)。rebel_office_word_get_properties— 获取文档元数据(标题、作者、计数)。rebel_office_word_get_comments— 读取批注和回复线程。rebel_office_word_add_comment— 在所选文本上添加批注或线程回复(有破坏性)。rebel_office_word_resolve_comment— 按 ID 解决或删除批注(有破坏性)。rebel_office_word_get_tracked_changes— 读取修订(跟踪更改)。rebel_office_word_accept_reject_changes— 批量或按 ID 接受或拒绝修订(有破坏性)。
Excel(25)
rebel_office_excel_read_range— 读取 A1 区域或命名区域中的单元格值。rebel_office_excel_write_range— 将二维数组的值写入区域(有破坏性)。rebel_office_excel_get_worksheets— 列出工作表及其位置和已用区域。rebel_office_excel_add_worksheet— 在指定位置添加新工作表(有破坏性)。rebel_office_excel_delete_worksheet— 删除工作表及其所有数据(有破坏性)。rebel_office_excel_read_table— 读取命名 Excel 表格中的行。rebel_office_excel_create_table— 将区域转换为命名 Excel 表格(有破坏性)。rebel_office_excel_set_formula— 在单元格中设置公式,可选择向下填充(有破坏性)。rebel_office_excel_get_formulas— 读取区域中的公式字符串(而非值)。rebel_office_excel_create_chart— 根据数据区域创建嵌入式图表(有破坏性)。rebel_office_excel_format_range— 设置字体、填充、边框和数字格式(有破坏性)。rebel_office_excel_add_conditional_formatting— 添加色阶、数据条或基于规则的格式(有破坏性)。rebel_office_excel_sort_range— 按一列或多列对区域或表格排序(有破坏性)。rebel_office_excel_filter_table— 对表格或区域应用或清除自动筛选(有破坏性)。rebel_office_excel_get_named_ranges— 列出工作簿中的命名区域和表格。rebel_office_excel_insert_rows_columns— 在指定位置插入行或列(有破坏性)。rebel_office_excel_delete_rows_columns— 删除行或列及其数据(有破坏性)。rebel_office_excel_merge_cells— 合并或取消合并区域中的单元格(有破坏性)。rebel_office_excel_auto_fit— 自动调整列宽或行高(有破坏性)。rebel_office_excel_add_data_validation— 为区域添加输入验证规则(有破坏性)。rebel_office_excel_get_comments— 读取单元格中的线程批注。rebel_office_excel_add_comment— 在单元格中添加批注或回复(有破坏性)。rebel_office_excel_get_pivot_tables— 列出数据透视表及其所在的工作表。rebel_office_excel_create_pivot_table— 根据源区域创建数据透视表(有破坏性)。rebel_office_excel_refresh_pivot_table— 刷新一个或所有数据透视表。
PowerPoint(15)
rebel_office_powerpoint_get_slides— 列出幻灯片及其版式、标题和形状数量。rebel_office_powerpoint_get_slide_content— 获取指定幻灯片上的所有形状和文本。rebel_office_powerpoint_add_slide— 使用指定版式和可选内容添加新幻灯片(有破坏性)。rebel_office_powerpoint_apply_layout— 更改现有幻灯片的版式(有破坏性)。rebel_office_powerpoint_delete_slide— 按索引删除幻灯片(有破坏性)。rebel_office_powerpoint_reorder_slides— 将幻灯片移动到新位置(有破坏性)。rebel_office_powerpoint_add_text_box— 在幻灯片上添加定位文本框(有破坏性)。rebel_office_powerpoint_add_image— 从路径或 base64 向幻灯片添加图像(有破坏性)。rebel_office_powerpoint_add_shape— 添加带有可选文本和填充的几何形状(有破坏性)。rebel_office_powerpoint_delete_shape— 按 ID 或名称删除幻灯片中的形状(有破坏性)。rebel_office_powerpoint_format_shape— 设置形状的填充、线条、位置、大小或名称(有破坏性)。rebel_office_powerpoint_update_text— 更新形状或版式占位符中的文本(有破坏性)。rebel_office_powerpoint_get_speaker_notes— 读取一张或所有幻灯片的演讲者备注。rebel_office_powerpoint_set_speaker_notes— 设置或替换幻灯片的演讲者备注(有破坏性)。rebel_office_powerpoint_get_presentation_properties— 获取演示文稿元数据、尺寸和版式。
冒烟测试
MCP_OFFICE_SIDECAR_STATE=/tmp/rebel-office-smoke/sidecar-state.json \
node dist/index.js
然后在 stdin 上发送 listTools MCP 请求;你应该会收到完整的工具清单。服务无需连接运行中的 sidecar 即可响应 listTools。
许可
FSL-1.1-MIT — Functional Source License,Version 1.1,附带未来生效的 MIT 许可。该软件将于 2030-04-08 转为 MIT 许可。
安全
请参阅 SECURITY.md,了解此连接器的安全策略;如需报告漏洞,请参阅仓库级别的 SECURITY.md。
架构和漂移风险说明
Sidecar 生命周期、端口分配、清单旁加载,以及从 Mindstone Rebel 单体仓库引入并保持字节兼容的代码,均记录在 docs/connectors/office-architecture.md 中。如果你正在调试 sidecar 握手,或计划发布涉及旁加载的 sidecar/appBridge 或聊天代码的版本,该文件是权威参考。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。