Excel转Markdown MCP服务器 - Python版本
Project description
Excel转Markdown
这是一个基于Python的MCP (Model Context Protocol) 服务器,用于将Excel文件转换为Markdown格式。
功能特性
- 🚀 直接使用Python的
markitdown库,支持Excel处理 - 📊 支持多种Excel格式 (.xlsx, .xls)
- 🗂️ 支持多工作表转换
- 🔧 简单的API接口
- 🛡️ 完整的错误处理
安装和使用
1. 安装依赖
cd /Users/fengjinchao/Desktop/mcp/skills/python/excel-to-markdown
uv sync
2. Claude配置
在Claude的MCP配置中添加:
{
"excel-to-markdown-python": {
"name": "Excel转markdown(Python)",
"type": "stdio",
"description": "Python版本的Excel转markdown工具,支持多工作表",
"isActive": true,
"command": "uv",
"args": ["--directory", "/Users/fengjinchao/Desktop/mcp/skills/python/excel-to-markdown", "run", "excel-to-markdown-mcp"]
}
}
3. 使用工具
基本用法
{
"name": "xlsx-to-markdown",
"arguments": {
"filepath": "/path/to/your/spreadsheet.xlsx"
}
}
指定工作表
{
"name": "xlsx-to-markdown",
"arguments": {
"filepath": "/path/to/your/spreadsheet.xlsx",
"sheet_name": "Sheet1"
}
}
支持的文件格式
.xlsx- Excel 2007+ 格式.xls- Excel 97-2003 格式
Python版本的优势
- 更强大的Excel支持: Python生态系统有更好的Excel处理库
- 更好的性能: 避免了子进程调用的开销
- 更简洁的代码: 直接API调用,无需复杂的进程管理
- 更好的错误处理: Python异常处理机制更完善
- 扩展性更强: 易于添加新功能(如工作表选择、格式选项等)
代码结构
excel-to-markdown/
├── pyproject.toml # 项目配置
├── README.md # 说明文档
└── excel_to_markdown_mcp/ # 主要代码
├── __init__.py # 包初始化
└── server.py # MCP服务器实现
vs TypeScript 版本
| 特性 | Python版本 | TypeScript版本 |
|---|---|---|
| 代码行数 | ~120行 | ~150+行 |
| 依赖安装 | uv sync |
npm install + uv sync |
| 构建步骤 | 无需构建 | npm run build |
| Excel支持 | 原生支持 | 通过子进程 |
| 错误处理 | Python异常 | 复杂的进程错误处理 |
| 维护性 | 更简单 | 更复杂 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file excel_to_markdown_mcp-0.1.0.tar.gz.
File metadata
- Download URL: excel_to_markdown_mcp-0.1.0.tar.gz
- Upload date:
- Size: 64.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac71add5decab697750a008cf5316ffd3620c966a0cb468672bdbadef154d5cc
|
|
| MD5 |
e30fa337ca32a1f53a435841fd30b779
|
|
| BLAKE2b-256 |
aa86c59d4da310a52cfa8e9303e49c910dafdb146525d4d1aaf627cdcfa3c017
|
File details
Details for the file excel_to_markdown_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: excel_to_markdown_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13ca153273979f95d99f6ed63809c7b65ecbc8d7d5660b4468da8eac62ac57d7
|
|
| MD5 |
517a26b9cb1d71e8b650249d338c63e8
|
|
| BLAKE2b-256 |
b574c14ac3d0d6b5eda09160da1bc034920b056d7a4aa323248a9435992adf03
|