Back to MCP directory
publicPublicdnsLocal runtime

Excel Reader

一个基于SheetJS和TypeScript的Excel文件读取MCP服务,支持自动分块和分页处理大型文件,提供表格选择、行分页和日期处理等功能。

article

README

🚀 MCP Excel 读取器

一个基于模型上下文协议 (MCP) 的服务器,用于读取 Excel 文件,能自动进行分块和分页处理。该工具使用 SheetJS 和 TypeScript 构建,可帮助您高效处理大型 Excel 文件,通过自动将其分解为易于管理的分块。

smithery badge

🚀 快速开始

此工具能让您高效处理大型 Excel 文件,并自动进行分块和分页。下面将介绍其安装和使用方法。

✨ 主要特性

  • 📊 支持读取 Excel 文件(.xlsx、.xls)并自动设置大小限制
  • 🔄 自动分块处理大数据集
  • 📑 支持工作表选择和行分页
  • 📅 正确处理日期
  • ⚡ 优化以处理大型文件
  • 🛡️ 错误处理与验证

📦 安装指南

使用 Smithery 安装

通过 Smithery 自动安装 Excel Reader for Claude Desktop:

npx -y @smithery/cli install @ArchimedesCrypto/excel-reader-mcp-chunked --client claude

作为 MCP 服务器

  1. 全局安装:
npm install -g @archimdescrypto/excel-reader
  1. 添加到您的 MCP 设置文件(通常位于 ~/.config/mcp/config.json):
{
  "servers": {
    "excel-reader": {
      "url": "http://localhost:3000"
    }
  }
}

💻 使用示例

基础用法

接口定义

请求参数:

interface ReadExcelArgs {
  file: string; // Excel 文件路径或 URL
  sheet?: number | string; // 要读取的工作表编号或名称(可选)
  headers?: boolean; // 是否包含标题行(默认为 true)
}

响应格式:

interface ExcelResponse {
  data: any[]; // 解析后的数据数组
  error?: string; // 错误信息(如果有错误时返回)
}

示例代码

import { readExcel } from '@archimdescrypto/excel-reader';

async function main() {
  try {
    const result = await readExcel({
      file: 'path/to/file.xlsx',
      sheet: 0, // 指定第一个工作表
      headers: true // 包含标题行
    });
    
    if (result.error) {
      console.error('读取文件时出错:', result.error);
    } else {
      console.log('数据已成功读取:', result.data);
    }
  } catch (error) {
    console.error('发生错误:', error);
  }
}

main();

📚 详细文档

通过 SheetJS 提供的更多功能,您可以:

  • 处理合并单元格
  • 转换数据格式(如日期、数字)
  • 应用过滤器和排序
  • 操作工作表保护状态
  • 管理工作簿中的多个工作表

更多详细文档请参考 SheetJS 文档

🤝 贡献

如果您想为项目贡献代码,可以按照以下步骤进行:

  1. 叉仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m '添加神奇功能')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 打开 Pull Request

📄 许可证

本项目基于 MIT 许可证,具体内容请参阅 LICENSE 文件。

🙏 致谢

READY-TO-PASTE CONFIG

MCP client config generator

Choose your client, fill the required environment variables, then copy a config generated from this server's published metadata

terminal
data_object

This entry does not contain a standard command or remote URL, so a safe client config cannot be generated automatically

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client