excel-reader-mcp

MCP.Pizza Chef: ArchimedesCrypto

The excel-reader-mcp is a Model Context Protocol server designed to read Excel files (.xlsx, .xls) efficiently. It supports automatic chunking and pagination to handle large datasets, offers sheet selection, proper date handling, and robust error validation. Built with SheetJS and TypeScript, it optimizes Excel data processing for real-time model context integration.

Use This MCP server To

Read large Excel files with automatic chunking for manageable data processing Paginate rows in Excel sheets for incremental data loading Select specific sheets from multi-sheet Excel workbooks Handle Excel date formats correctly in model context Validate and handle errors in Excel file reading Integrate Excel data into LLM workflows for real-time context Process large datasets from Excel without memory overload Enable AI models to query Excel data efficiently

README

MCP Excel Reader

smithery badge A Model Context Protocol (MCP) server for reading Excel files with automatic chunking and pagination support. Built with SheetJS and TypeScript, this tool helps you handle large Excel files efficiently by automatically breaking them into manageable chunks.

Excel Reader MCP server

Features

  • 📊 Read Excel files (.xlsx, .xls) with automatic size limits
  • 🔄 Automatic chunking for large datasets
  • 📑 Sheet selection and row pagination
  • 📅 Proper date handling
  • ⚡ Optimized for large files
  • 🛡️ Error handling and validation

Installation

Installing via Smithery

To install Excel Reader for Claude Desktop automatically via Smithery:

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

As an MCP Server

  1. Install globally:
npm install -g @archimdescrypto/excel-reader
  1. Add to your MCP settings file (usually at ~/.config/claude/settings.json or equivalent):
{
  "mcpServers": {
    "excel-reader": {
      "command": "excel-reader",
      "env": {}
    }
  }
}

For Development

  1. Clone the repository:
git clone https://github.com/ArchimdesCrypto/mcp-excel-reader.git
cd mcp-excel-reader
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Usage

Usage

The Excel Reader provides a single tool read_excel with the following parameters:

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[];
    };
  };
}

Basic Usage

When used with Claude or another MCP-compatible AI:

Read the Excel file at path/to/file.xlsx

The AI will use the tool to read the file, automatically handling chunking for large files.

Features

  1. Automatic Chunking

    • Automatically splits large files into manageable chunks
    • Default chunk size of 100KB
    • Provides metadata for pagination
  2. Sheet Selection

    • Read specific sheets by name
    • Defaults to first sheet if not specified
  3. Row Pagination

    • Control which rows to read with startRow and maxRows
    • Get next chunk information for continuous reading
  4. Error Handling

    • Validates file existence and format
    • Provides clear error messages
    • Handles malformed Excel files gracefully

Extending with SheetJS Features

The Excel Reader is built on SheetJS and can be extended with its powerful features:

Available Extensions

  1. Formula Handling

    // Enable formula parsing
    const wb = XLSX.read(data, {
      cellFormula: true,
      cellNF: true
    });
  2. Cell Formatting

    // Access cell styles and formatting
    const styles = Object.keys(worksheet)
      .filter(key => key[0] !== '!')
      .map(key => ({
        cell: key,
        style: worksheet[key].s
      }));
  3. Data Validation

    // Access data validation rules
    const validation = worksheet['!dataValidation'];
  4. Sheet Features

    • Merged Cells: worksheet['!merges']
    • Hidden Rows/Columns: worksheet['!rows'], worksheet['!cols']
    • Sheet Protection: worksheet['!protect']

For more features and detailed documentation, visit the SheetJS Documentation.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

excel-reader-mcp FAQ

How does excel-reader-mcp handle large Excel files?
It automatically chunks large Excel files into smaller, manageable pieces with pagination support to optimize processing.
Which Excel file formats are supported?
The server supports .xlsx and .xls file formats using SheetJS.
Can I select specific sheets within an Excel workbook?
Yes, the server allows sheet selection to focus on relevant data.
How does the server handle date values in Excel files?
It properly parses and formats Excel date fields to ensure accurate data representation.
What happens if the Excel file contains errors or invalid data?
The server includes error handling and validation to manage and report issues gracefully.
Is the excel-reader-mcp optimized for performance?
Yes, it is built with TypeScript and optimized for handling large Excel files efficiently.
How can I install the excel-reader-mcp server?
It can be installed via Smithery for easy integration with MCP hosts like Claude Desktop.
Can this server be used with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Claude, Gemini, and others.