graph-excel-mcp

中文文档
0.4.0发布于 2026/11/04MITES Module零依赖构建来源已验证

MCP server for reading and editing Excel workbooks on SharePoint/OneDrive via Microsoft Graph: base-checked writes, read-back verification, fills. Zero dependencies.

原始使用文档
文档目录8 节
  1. Install
  2. Sign in
  3. Workbook aliases
  4. Tools
  5. Notes
  6. Development
  7. Release
  8. License

graph-excel-mcp

MCP server for reading and editing Excel workbooks on SharePoint, OneDrive or Teams through Microsoft Graph, without a browser. It is written in TypeScript, has no runtime dependencies, and runs on Node 18 or later.

It is built for workbooks that several people edit at once:

  • Every write starts as a dry run.
  • Before writing, it checks the cells' current content against the version you read, so it won't overwrite someone else's edit.
  • After writing, it reads the cells back to confirm the change.

Install

Claude Code / any MCP host (stdio):

claude mcp add --scope user graph-excel -- npx -y graph-excel-mcp
{ "mcpServers": { "graph-excel": { "command": "npx", "args": ["-y", "graph-excel-mcp"] } } }

Claude Desktop extension: download graph-excel-mcp-<version>.mcpb from the latest release and open it.

Claude plugin (Cowork, Claude Code): install the plugin/ folder of this repo. It contains the server and a graph-excel skill.

Sign in

Call the login_status tool, or run npx graph-excel-mcp login, then enter the code it shows at https://login.microsoft.com/device. The refresh token is saved in ~/.graph-excel/token.json with mode 600. Set GRAPH_EXCEL_HOME to keep it somewhere else.

Sign-in uses the Microsoft Graph PowerShell public client with the delegated scope Files.ReadWrite.All, so you don't need to register an app. If your tenant blocks user consent, an admin has to approve that client once.

Workbook aliases

Instead of pasting the SharePoint URL every time, you can add aliases to ~/.graph-excel/workbooks.json (see workbooks.example.json). The resolve tool returns the driveId and itemId you need for an alias.

Tools

ToolWhat it does
login_statusChecks the token, or starts a device code login
resolveReturns drive/item ids, last modified, and the sheets with their used ranges
read_rangeReturns values plus a sha256: hash per cell, and fills on request
write_valuesWrites blocks of values with a base check (expected) and read-back verification
append_updateAdds or replaces a 「-----update-----」 section under a cell's existing text, keeping the original part byte-identical, and can fill the row with a color
set_fillSets or clears the fill color of one or more ranges in a single batch

Notes

  • Every call runs inside a workbook session. Sessionless calls on large workbooks can time out with a 504 even though the write was applied.
  • Line breaks are sent as \n, which Excel stores as \r\n. If you write \r\n directly, the cell ends up with a stray _x000D_.

Development

Development needs Node 22.18 or later, which runs the .ts sources directly.

CommandWhat it does
npm run mcp / npm run loginRuns the server or the terminal sign-in from src/
npm run typecheckRuns tsc in strict mode with no emit
npm testRuns offline tests: range parsing, update composition, and the MCP handshake on src/ and dist/
npm run buildCompiles src/ to dist/, which is what npm, the .mcpb and the plugin run
npm run packBuilds, then writes build/*.mcpb (gitignored) and plugin/ (committed)

Layout:

PathContents
src/graph.tsAuth and the Graph client
src/excel.tsWorkbook operations
src/mcp.tsTools and the JSON-RPC server
src/cli.tsEntry point

Release

Bump version in package.json, run npm run pack, commit, then push a matching tag:

git tag v0.3.1 && git push origin v0.3.1

The Publish workflow runs the tests, publishes to npm through trusted publishing (no token or OTP; provenance attached) and creates a GitHub release with the .mcpb attached.

License

MIT

版本与发布记录

graph-excel-mcp 共发布 3 个版本,首次发布于 2026/11/03;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.0latest2026/11/04今天
0.3.02026/11/03今天
0.0.0-stage2026/11/03今天

关于 graph-excel-mcp 的常见问题

graph-excel-mcp 是什么?

MCP服务器通过microsoftgraph在SharePoint/OneDrive上读取和编辑Excel工作簿:基本检查写入,回读验证,填充。零依赖关系。

如何安装 graph-excel-mcp?

在项目目录运行 npm install graph-excel-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 graph-excel-mcp,可以用 npx graph-excel-mcp 直接运行。

graph-excel-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/graph-excel-mcp 是否存在。

graph-excel-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

graph-excel-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

graph-excel-mcp 可以商用吗?

graph-excel-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

graph-excel-mcp 还在维护吗?

最新版本 0.4.0 发布于 2026/11/04(今天);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。