这是一个用于读取 Excel 文件的 Model Context Protocol (MCP) 服务器,支持自动分块和分页。使用 SheetJS 和 TypeScript 构建,该工具通过将大文件自动拆分为可管理的小块来帮助您高效处理大型 Excel 文件。
要通过 Smithery 自动为 Claude Desktop 安装 Excel 读取器:
npx -y @smithery/cli install @ArchimedesCrypto/excel-reader-mcp-chunked --client claude
npm install -g @archimdescrypto/excel-reader
~/.config/claude/settings.json
或等效位置):{
"mcpServers": {
"excel-reader": {
"command": "excel-reader",
"env": {}
}
}
}

git clone https://github.com/ArchimdesCrypto/mcp-excel-reader.git
cd mcp-excel-reader

npm install
npm run build
Excel 读取器提供了一个名为 read_excel
的工具,具有以下参数:
interface ReadExcelArgs {
filePath: string; // Path to Excel file
sheetName?: string; // Optional sheet name (defaults to first sheet)
startRow?: number; // Optional starting row for pagination
maxRows?: number; // Optional maximum rows to read
}
// Response format
interface ExcelResponse {
fileName: string;
totalSheets: number;
currentSheet: {
name: string;
totalRows: number;
totalColumns: number;
chunk: {
rowStart: number;
rowEnd: number;
columns: string[];
data: Record<string, any>[];
};
hasMore: boolean;
nextChunk?: {
rowStart: number;
columns: string[];
};
};
}

当与 Claude 或其他 MCP 兼容的 AI 一起使用时:
Read the Excel file at path/to/file.xlsx
AI 将使用该工具读取文件,并自动处理大文件的分块。
自动分块
表格选择
行分页
错误处理
Excel 读取器基于 SheetJS 构建,可以利用其强大的功能进行扩展:
公式处理
// 启用公式解析
const wb = XLSX.read(data, {
cellFormula: true,
cellNF: true
});

单元格格式化
// 访问单元格样式和格式
const styles = Object.keys(worksheet)
.filter(key => key[0] !== '!')
.map(key => ({
cell: key,
style: worksheet[key].s
}));

数据验证
// 访问数据验证规则
const validation = worksheet['!dataValidation'];

表格功能
worksheet['!merges']
worksheet['!rows']
, worksheet['!cols']
worksheet['!protect']
更多功能和详细文档,请访问 SheetJS 文档。
git checkout -b feature/amazing-feature
)git commit -m '添加了一些惊人的功能'
)git push origin feature/amazing-feature
)本项目根据 MIT 许可证发布 - 详情请参阅 LICENSE 文件。