Skip to main content
Glama
Dynamic Excel MCP Server

Dynamic Excel MCP Server

by nam090320251

Dynamic Excel MCP Server

Dynamic Excel file generation server using Model Context Protocol (MCP). This server allows LLMs to automatically create Excel files with any structure through dynamic JSON schemas.

๐Ÿš€ Features

  • โœ… Generate Excel files from JSON schemas

  • โœ… Dual transport modes: Local (stdio) and Remote (HTTP/SSE)

  • โœ… Deploy anywhere: VPS, Cloud (AWS, GCP, Heroku), Docker

  • โœ… Multiple sheets support

  • โœ… Advanced formatting (styling, borders, colors)

  • โœ… Data validation and conditional formatting

  • โœ… Formulas and calculations

  • โœ… Charts support (limited)

  • โœ… Page setup and printing options

  • โœ… S3 and local file storage

  • โœ… Presigned URLs for secure downloads

  • โœ… Freeze panes, auto-filter

  • โœ… Merged cells and row grouping

  • โœ… API key authentication

  • โœ… CORS support for web clients

Related MCP server: Excel MCP Server

๐Ÿ“ฆ Installation

npm install
npm run build

โš™๏ธ Configuration

Create a .env file (copy from .env.example):

For Local (Stdio) Mode:

TRANSPORT_MODE=stdio  # Local MCP client mode
STORAGE_TYPE=local
DEV_STORAGE_PATH=./temp-files
LOG_LEVEL=info

For Remote (HTTP/SSE) Mode:

TRANSPORT_MODE=http  # Remote server mode
HTTP_PORT=3000
HTTP_HOST=0.0.0.0
ALLOWED_ORIGINS=*  # Or specific domains: https://app.example.com
API_KEY=your-secret-api-key  # Optional

STORAGE_TYPE=s3  # or 'local'
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
AWS_REGION=ap-southeast-1
S3_BUCKET=your-bucket
PRESIGNED_URL_EXPIRY=3600
LOG_LEVEL=info

๐Ÿ”ง Usage

๐Ÿ–ฅ๏ธ Local Mode (Stdio) - For Claude Desktop

Add to your Claude Desktop or MCP client configuration:

For macOS (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "excel-generator": {
      "command": "node",
      "args": ["/absolute/path/to/excel-mcp-server/build/index.js"],
      "env": {
        "STORAGE_TYPE": "local",
        "DEV_STORAGE_PATH": "./temp-files",
        "LOG_LEVEL": "info"
      }
    }
  }
}

For Windows (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "excel-generator": {
      "command": "node",
      "args": ["C:\\path\\to\\excel-mcp-server\\build\\index.js"],
      "env": {
        "STORAGE_TYPE": "local",
        "DEV_STORAGE_PATH": "./temp-files",
        "LOG_LEVEL": "info"
      }
    }
  }
}

๐ŸŒ Remote Mode (HTTP/SSE) - For Web Apps & Remote Access

Start the server:

# Using environment variable
TRANSPORT_MODE=http npm start

# Or using npm script
npm run start:http

# Or with .env file configured for http mode
npm start

Server endpoints:

http://localhost:3000/health   - Health check
http://localhost:3000/info     - Server information
http://localhost:3000/sse      - SSE endpoint for MCP clients

Example client usage:

See examples/client-example.ts for a complete TypeScript client example using the MCP SDK.

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';

const transport = new SSEClientTransport(
  new URL('http://localhost:3000/sse'),
  {
    headers: { 'X-API-Key': 'your-api-key' } // If API_KEY is set
  }
);

const client = new Client({
  name: 'excel-client',
  version: '1.0.0',
}, { capabilities: {} });

await client.connect(transport);
const result = await client.callTool({
  name: 'generate_excel',
  arguments: excelSchema
});

Deployment options:

  • ๐Ÿณ Docker: See DEPLOYMENT.md for Dockerfile and docker-compose examples

  • โ˜๏ธ Cloud: Deploy to AWS, GCP, Heroku, etc.

  • ๐Ÿ–ง VPS: Use PM2, systemd, or other process managers

  • ๐Ÿ”’ Production: Enable API key auth, configure CORS, use HTTPS

๐Ÿ“š Full deployment guide: See DEPLOYMENT.md

Tool: generate_excel

The server provides one tool: generate_excel

Input Schema:

{
  "file_name": "report.xlsx",
  "sheets": [
    {
      "name": "Sheet1",
      "columns": [...],
      "data": [...],
      "formatting": {...}
    }
  ],
  "metadata": {...},
  "options": {...}
}

๐Ÿ“š JSON Schema Structure

Column Configuration

{
  "header": "Column Name",
  "key": "data_key",
  "width": 20,
  "type": "currency",
  "format": "#,##0โ‚ซ",
  "style": {
    "font": {"bold": true, "size": 12},
    "alignment": {"horizontal": "center"},
    "fill": {
      "type": "pattern",
      "pattern": "solid",
      "fgColor": {"argb": "FFFF0000"}
    }
  }
}

Supported Column Types

  • text: Plain text

  • number: Numeric values

  • currency: Currency format

  • percentage: Percentage format

  • date: Date format

  • datetime: Date and time format

  • boolean: Boolean values

  • formula: Excel formulas

Formatting Options

{
  "freeze_panes": "A2",
  "auto_filter": true,
  "conditional_formatting": [
    {
      "range": "A2:A100",
      "type": "cellIs",
      "operator": "greaterThan",
      "formulae": [0],
      "style": {
        "fill": {
          "type": "pattern",
          "pattern": "solid",
          "fgColor": {"argb": "FF90EE90"}
        }
      }
    }
  ],
  "totals_row": {
    "column_key": "=SUM(A2:A100)"
  },
  "merged_cells": ["A1:D1"],
  "row_heights": {
    "1": 30,
    "2": 25
  }
}

๐Ÿ“– Examples

1. Simple Data Table

See: examples/01-simple-table.json

Creates a basic product table with formatting:

  • Freeze panes

  • Auto-filter

  • Currency formatting

2. Financial Report

See: examples/02-financial-report.json

Advanced report with:

  • Report layout with title

  • Conditional formatting

  • Percentage calculations

  • Formula totals

3. Employee Database

See: examples/03-employee-database.json

Employee management spreadsheet with:

  • Multiple column types

  • Date formatting

  • Currency display

  • Auto-filter

4. Multi-Sheet Report

See: examples/04-multi-sheet-report.json

Comprehensive report with:

  • Multiple sheets

  • Summary and detail views

  • Cross-sheet consistency

๐Ÿ”จ Development

# Run in development mode (with auto-reload)
npm run dev

# Build TypeScript
npm run build

# Start production server
npm start

# Run tests
npm test

# Lint code
npm run lint

๐Ÿงช Testing with MCP Inspector

Test the server using the MCP Inspector:

npx @modelcontextprotocol/inspector node build/index.js

๐ŸŽฏ Use Cases

  1. Data Export: Export database queries to formatted Excel files

  2. Financial Reports: Generate quarterly/annual financial statements

  3. Inventory Management: Create product catalogs and stock reports

  4. HR Management: Employee databases and payroll reports

  5. Sales Analytics: Sales reports with charts and conditional formatting

  6. Project Tracking: Project status reports with multiple sheets

๐Ÿ—๏ธ Architecture

src/
โ”œโ”€โ”€ index.ts                 # MCP Server entry point
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ schema.ts           # TypeScript types & Zod schemas
โ”œโ”€โ”€ generators/
โ”‚   โ”œโ”€โ”€ base-generator.ts   # Abstract base class
โ”‚   โ”œโ”€โ”€ basic-generator.ts  # Simple tables
โ”‚   โ””โ”€โ”€ report-generator.ts # Reports with styling
โ”œโ”€โ”€ formatters/
โ”‚   โ”œโ”€โ”€ cell-formatter.ts   # Cell formatting
โ”‚   โ”œโ”€โ”€ style-formatter.ts  # Styling utilities
โ”‚   โ””โ”€โ”€ formula-builder.ts  # Formula generation
โ”œโ”€โ”€ storage/
โ”‚   โ”œโ”€โ”€ s3-storage.ts       # S3 upload handler
โ”‚   โ””โ”€โ”€ local-storage.ts    # Local file system
โ”œโ”€โ”€ validators/
โ”‚   โ””โ”€โ”€ schema-validator.ts # JSON schema validation
โ””โ”€โ”€ utils/
    โ”œโ”€โ”€ logger.ts           # Logging utility
    โ””โ”€โ”€ error-handler.ts    # Error handling

๐Ÿ” Security Notes

  • For S3 storage, ensure proper IAM permissions

  • Use presigned URLs for temporary file access

  • Set appropriate expiry times for download links

  • Validate all user inputs through Zod schemas

๐Ÿ“ License

MIT

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ง Support

For issues and questions, please open an issue on GitHub.

๐ŸŽ‰ Acknowledgments

Built with:

Available Tools

1 tool
generate_excelA

Generate an Excel file from a structured JSON schema.

Use this tool when the user wants to:

  • Create an Excel file

  • Export data to Excel

  • Generate a report/spreadsheet

  • Download data as .xlsx file

The tool accepts a JSON schema describing the structure, data, and formatting of the Excel file.

Supported features:

  • Multiple sheets

  • Custom column widths and formats

  • Cell styling (fonts, colors, borders, alignment)

  • Data validation

  • Conditional formatting

  • Formulas and totals

  • Charts and images

  • Page setup and printing options

  • Freeze panes, auto-filter

  • Merged cells

  • Grouped rows/columns

  • Sheet protection

Layout types:

  • table: Simple data table (default)

  • report: Formatted report with headers and styling

  • form: Form-style layout

  • dashboard: Dashboard with charts

  • calendar: Calendar view

Inputs: sheets (required), file_name, metadata, options.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.6/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of confusion or overlap between tools. The single tool 'generate_excel' has a clear and distinct purpose focused on creating Excel files from JSON schemas.

    Naming Consistency5/5

    Since there is only one tool, naming consistency is inherently perfect. The tool name 'generate_excel' follows a clear verb_noun pattern, and there are no other tools to create inconsistencies.

    Tool Count2/5

    A single tool for a server named 'Dynamic Excel MCP Server' feels thin and under-scoped. While the tool is feature-rich, the domain suggests operations like reading, updating, or analyzing Excel files, which are missing. This limits the server's utility for comprehensive Excel interactions.

    Completeness2/5

    The server is severely incomplete for its implied domain of dynamic Excel operations. It only supports generation from JSON schemas, lacking essential CRUD operations such as reading existing files, updating data, or performing analyses. This creates significant gaps that will hinder agent workflows involving Excel beyond initial creation.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers