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 分