MCP Excel Server
一个基于 Model Context Protocol (MCP) 的 Excel 处理服务器,提供以下功能:
-
获取 Excel 工作簿信息
- 读取所有工作表名称
- 获取每个工作表的表头
- 获取数据范围信息
-
读取 Excel 数据
- 支持按范围读取数据
- 支持读取公式
-
写入 Excel 数据
- 支持按范围写入数据
- 支持写入公式
安装
pip install baiyx-mcp-server-excel
使用方法
启动服务器:
baiyx-mcp-server-excel
功能说明
1. 获取工作簿信息
get_workbook_info(file_path: str) -> WorkbookInfo
返回工作簿中所有工作表的信息,包括表名、表头和数据范围。
2. 读取数据
read_sheet_data(file_path: str, sheet_name: str, range: Optional[str] = None) -> ExcelData
从指定工作表读取数据,可以指定读取范围(例如:"A1:C10")。
3. 读取公式
read_sheet_formula(file_path: str, sheet_name: str, range: Optional[str] = None) -> ExcelFormula
从指定工作表读取公式,可以指定读取范围。
4. 写入数据
write_sheet_data(file_path: str, sheet_name: str, range: str, data: List[List[Any]]) -> bool
向指定工作表写入数据,需要指定写入范围。
5. 写入公式
write_sheet_formula(file_path: str, sheet_name: str, range: str, formulas: List[str]) -> bool
向指定工作表写入公式,需要指定写入范围。
示例
# 获取工作簿信息
workbook_info = get_workbook_info("example.xlsx")
print(f"Found {len(workbook_info.sheets)} sheets")
# 读取数据
data = read_sheet_data("example.xlsx", "Sheet1", "A1:C10")
print(f"Read {len(data.data)} rows")
# 写入数据
success = write_sheet_data("example.xlsx", "Sheet1", "A1", [[1, 2, 3], [4, 5, 6]])
print(f"Write {'successful' if success else 'failed'}")
依赖
- Python >= 3.10
- mcp >= 1.6.0
- pandas >= 2.0.0
- openpyxl >= 3.1.2
许可证
MIT
Metadata
Release files for baiyx-mcp-server-excel 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| baiyx_mcp_server_excel-0.1.6.tar.gz | 43.5 kB | Without provenance | Details for baiyx_mcp_server_excel-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baiyx_mcp_server_excel-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for baiyx_mcp_server_excel-0.1.6-py3-none-any.whl |
Total release size: 50.9 kB
Release files / baiyx_mcp_server_excel-0.1.6.tar.gz
| Download URL | baiyx_mcp_server_excel-0.1.6.tar.gz |
|---|---|
| Size | 43.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cea0695c32e84cb19166bb3c4b1b887f9d6e6f574829e6aa874581a1d2bae2e1
|
|
BLAKE2b-256 checksum How to use checksums |
cc335014d4abb852b5ba44e6606c1fe29c129382a3cb6ed16e883b9f17794701
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / baiyx_mcp_server_excel-0.1.6-py3-none-any.whl
| Download URL | baiyx_mcp_server_excel-0.1.6-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ece54a9d91e1b26eff05738ae8274bc3938efbeb8ec29548f0f4fc3e0770025
|
|
BLAKE2b-256 checksum How to use checksums |
280b898ebb5c05847c304711f7ecbd5d7ad5b53603430f379a40819d0bfdda69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for baiyx-mcp-server-excel 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.