Mcp Server Xlwings

io.github.geniuskey由 GitHub 账号 geniuskey 发布v0.4.1更新于 Oct 24, 2026

Excel automation via xlwings COM. DRM-protected files, live sessions, VBA macros. Windows only.

概览

AI 生成的概览

让助手在 Windows 上读取、写入、格式化并管理当前打开的 Excel 工作簿,包括运行 VBA 宏。

可以做什么
它通过 COM 自动化驱动 Excel,而不是从磁盘读取文件,因此可处理实时会话、受 DRM 保护的文档以及被其他进程锁定的文件。共 11 个工具,涵盖获取活动工作簿与选中区域,列出、打开、保存、关闭和重算工作簿,读写区域或公式,管理工作表与行列,查找替换,设置格式,运行 VBA 宏,读取公式与单元格样式,以及列出图表、图片和形状。未指定工作簿时,工具默认作用于活动工作簿。
适用场景
当助手需要处理已在 Excel 中打开的表格、需要用到公式、宏或加载项,或因为 DRM、加密、文件被占用而无法用 openpyxl、pandas 等基于文件的库打开文档时,适合使用。在 macOS 或 Linux 上,或没有安装 Excel 时,它没有用处。
运行要求
仅限 Windows,需已安装 Microsoft Excel 和 Python 3.10 或更高版本。以 stdio 方式在本地运行,通常用 uvx mcp-server-xlwings 启动,或用 pip 安装。未声明任何账号、API 密钥、环境变量或请求头。
安装前请注意
它会读写当前打开的 Excel 会话,因此 write_data、manage_sheets、find_replace 和 format_range 可能修改或删除已打开工作簿中的内容,run_macro 会执行现有 VBA 宏并产生其副作用。它还能读取当前打开的工作簿或选中区域,包括受 DRM 保护的文件,因此敏感表格数据可能被发送给助手。未要求任何凭据。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-server-xlwings

MCP server for Excel automation via xlwings COM. Works with DRM-protected files.

[PyPI] [License: MIT] [Python 3.10+]

Why xlwings?

Libraries like openpyxl or pandas read .xlsx files directly from disk. This fails when:

  • DRM / file-level encryption is applied (common in enterprise environments)
  • You need to interact with a live Excel session (formulas, macros, add-ins)
  • Files are locked by another process

mcp-server-xlwings uses COM automation to talk to the running Excel process, so it can read and write any file that Excel itself can open -- including DRM-protected documents.

xlwings-exclusive capabilities

These features are impossible with file-based libraries like openpyxl:

  • Read the user's current selection -- see exactly what the user is looking at
  • Get the active workbook -- no need to specify a file path
  • Run VBA macros -- execute existing macros and get their return values
  • Live formula results -- set a formula and get the calculated value immediately
  • Force recalculation -- trigger Excel to recalculate all formulas

Installation

With uvx (recommended)

bash
uvx mcp-server-xlwings

With pip

bash
pip install mcp-server-xlwings

Configuration

Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json:

json
{  "mcpServers": {    "xlwings": {      "command": "uvx",      "args": ["mcp-server-xlwings"]    }  }}

Claude Code

bash
claude mcp add xlwings -- uvx mcp-server-xlwings

Roo Code (VS Code)

Add to Roo Code MCP settings or create <project-root>/.roo/mcp.json:

json
{  "mcpServers": {    "xlwings": {      "command": "uvx",      "args": ["mcp-server-xlwings"]    }  }}

Cursor

Add to %USERPROFILE%\.cursor\mcp.json:

json
{  "mcpServers": {    "xlwings": {      "command": "uvx",      "args": ["mcp-server-xlwings"]    }  }}

Windsurf

Add to %USERPROFILE%\.codeium\windsurf\mcp_config.json:

json
{  "mcpServers": {    "xlwings": {      "command": "uvx",      "args": ["mcp-server-xlwings"]    }  }}

Continue (VS Code)

Add to ~/.continue/config.yaml:

yaml
mcpServers:  - name: xlwings    command: uvx    args:      - mcp-server-xlwings

Available Tools (11)

All tools default to the active workbook when workbook is omitted.

ToolDescription
get_active_workbookGet active workbook info, sheets, and current selection with data
manage_workbooksList, open, save, close, or recalculate workbooks
read_dataRead a range with merge_info, header_row, sheet="*" batch read, and detail mode
write_dataWrite a 2D array (data) or a single-cell formula (formula)
manage_sheetsList, add, delete, rename, copy, activate sheets. Insert/delete rows and columns
find_replaceSearch for text, optionally replace it
format_rangeApply formatting (bold, italic, color, borders, alignment, number format, etc.)
run_macroExecute a VBA macro and get its return value
get_formulasGet all formulas in a range with optional calculated values
get_cell_stylesGet formatting/style info (bold, colors, borders, etc.) for cells in a range
get_objectsList charts, images, and shapes on a sheet

Examples

See what the user is working on

"What's in the spreadsheet I have open?"

The agent calls get_active_workbook() to get the workbook name, sheets, and selection data, then read_data() to fetch the full sheet.

Summarize selected data

"Summarize the data I've selected"

The agent calls get_active_workbook() -- the response includes the selection data directly.

Run a macro

"Run the UpdateReport macro"

The agent calls run_macro(macro_name="UpdateReport") and returns the result.

Build a summary row

"Add a SUM formula in C10 that totals C2:C9"

The agent calls write_data(start_cell="C10", formula="=SUM(C2:C9)") and gets back the calculated value.

Format a header row

"Make row 1 bold and centered with a yellow background"

The agent calls format_range(cell_range="A1:D1", bold=true, alignment="center", bg_color="#FFFF00").

Read all sheets at once

"Give me a summary of every sheet"

The agent calls read_data(sheet="*") -- returns all sheet summaries in a single call.

Read merged cells properly

"Read B6:C20 and fill in merged cell values"

The agent calls read_data(cell_range="B6:C20", merge_info=true). Merged cells return the parent value instead of null.

Find all formulas

"Show me all formulas in this sheet"

The agent calls get_formulas(cell_range="A1:Z100", values_too=true) and gets every formula with its calculated value.

Insert rows

"Insert 3 blank rows at row 5"

The agent calls manage_sheets(action="insert_rows", position=5, count=3).

Requirements

  • Windows (Excel COM automation is Windows-only)
  • Microsoft Excel installed
  • Python 3.10+

License

MIT

来源:README.md,提交 3869179

工具

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

版本历史

1
  1. v0.4.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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