
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.
概覽
讓助理在 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 金鑰、環境變數或標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Server Xlwings,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
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)
With pip
Configuration
Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json:
Claude Code
Roo Code (VS Code)
Add to Roo Code MCP settings or create <project-root>/.roo/mcp.json:
Cursor
Add to %USERPROFILE%\.cursor\mcp.json:
Windsurf
Add to %USERPROFILE%\.codeium\windsurf\mcp_config.json:
Continue (VS Code)
Add to ~/.continue/config.yaml:
Available Tools (11)
All tools default to the active workbook when workbook is omitted.
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版本歷史
1- v0.4.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分