Graph Excel

io.github.mickey-ichi由 GitHub 账号 mickey-ichi 发布v0.5.2更新于 Nov 7, 2026

Read and edit Excel workbooks on SharePoint/OneDrive via Microsoft Graph, with verified writes.

概览

AI 生成的概览

通过 Microsoft Graph 读取和编辑 SharePoint、OneDrive 或 Teams 上的 Excel 工作簿,写入默认试运行并回读校验。

可以做什么
  • 登录并检查 Microsoft Graph 令牌,把工作簿别名解析为 driveId、itemId 及各工作表已用区域
  • 读取单元格值及每格哈希,按子串或正则跨工作表搜索单元格文本
  • 按基线校验写入数值块并回读确认,在单元格原有文本下追加或替换更新段落
  • 批量设置或清除填充色,并应用加粗、字体、换行、对齐和数字格式
  • 新增、重命名工作表,插入或追加行,所有改动在显式发送前均为试运行
适用场景
适合让助手无需浏览器即可查看或更新 Microsoft 365 中的共享 Excel 工作簿,尤其是多人同时编辑、必须避免覆盖他人改动的表格。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node 18 或更高版本。需用设备代码登录 Microsoft,使用 Graph PowerShell 公共客户端和委托权限 Files.ReadWrite.All;若租户禁止用户同意,需管理员批准该客户端。刷新令牌和工作簿别名保存在由 GRAPH_EXCEL_HOME 指定的目录,默认为 ~/.graph-excel。需要访问 Microsoft 登录和 Graph 端点的网络。
安装前请注意
token.json 中的刷新令牌可读写用户文件,请保护好该目录及 GRAPH_EXCEL_HOME 指定的位置。写入会改动真实的共享工作簿,只有设置 send 为 true 才真正执行,且不会删除工作表、行或单元格。请求时单元格内容会发送给助手,所有通信仅发往 Microsoft Graph。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Graph Excel,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[图片]

graph-excel-mcp

Read and edit Excel workbooks on SharePoint and OneDrive from AI agents — without overwriting anyone’s edits.

[npm] [downloads] [CI] [provenance] [license]

npm · Claude Desktop extension · Releases

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):

bash
claude mcp add --scope user graph-excel -- npx -y graph-excel-mcp
json
{ "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. One install covers both Chat and Cowork in Claude Desktop.

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
findSearches cell text across all sheets (or one), substring or regex, and returns addresses with hashes
add_sheetAdds an empty sheet (Excel name rules, no duplicates), optionally at a position
rename_sheetRenames a sheet
insert_rowsInserts empty rows above a row and verifies the shifted row moved intact
append_rowsAppends rows below the last used row; the target cells must still be empty
set_formatBold, italic, font color and size, wrap, alignment and number format for one or more ranges

Every tool that changes the workbook is a dry run until send: true. Nothing deletes sheets, rows or cells.

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:

bash
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.

Privacy

graph-excel-mcp has no server of its own and collects nothing. It signs in to Microsoft with a device code and keeps the refresh token only in ~/.graph-excel/token.json (mode 600) on your computer. It talks to Microsoft only — login.microsoftonline.com to sign in and graph.microsoft.com to read and write the workbooks you point it at. Cell contents go to Claude only when you ask for them, and are then handled under your Claude plan's terms. No telemetry, no third-party services.

Support

If graph-excel-mcp saves you time, you can support its development through GitHub Sponsors. Bug reports and pull requests are just as welcome.

License

MIT

来源:README.md,提交 7535b0a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.5.2最新Nov 7, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分