Skip to main content

Spreadsheet analysis MCP server with natural language queries powered by DuckDB

Project description

Data Lens

Ask questions about your spreadsheets in plain English. Get instant answers.

PyPI version Python 3.11+ License: MIT

What is Data Lens?

Stop wrestling with pivot tables and SQL queries. Data Lens transforms your spreadsheets into a conversational AI assistant. Just ask questions in plain English and get instant, accurate answers powered by DuckDB.

With Data Lens: "What's the average sales by region?" → Get answer instantly

No SQL knowledge required. No formula errors. Just questions and answers.

See It In Action

Demo coming soon - spreadsheet analysis in action

Why Data Lens?

  • 🗣️ Natural Language - Ask questions like you'd ask a person
  • ⚡ Instant Results - DuckDB-powered analytics, no waiting
  • 🔒 100% Local - Your data never leaves your machine
  • 🆓 Completely Free - No API keys, no subscriptions, no limits
  • 📊 Multiple Formats - Excel, CSV, TSV, Parquet - we handle them all

Features

  • Multiple file formats: Excel (.xlsx), CSV (.csv), TSV (.tsv), Parquet (.parquet)
  • Multi-sheet Excel support: Each sheet becomes a separate table
  • Smart schema detection: Automatic column type inference
  • SQL safety: Blocks destructive operations (DROP, DELETE, UPDATE)
  • Sample data preview: See examples before querying
  • In-memory performance: Fast DuckDB-powered analytics

Try It Out

Want to test Data Lens immediately? The repository includes sample datasets you can use:

Sample Files

Download these files from the repository or create your own:

  1. sample_ecommerce_data.csv - E-commerce orders with products, regions, payments
  2. sample_employee_data.csv - Employee records with departments, salaries, performance
  3. sample_stock_prices.csv - Stock market data with prices and sectors

Quick Test Queries

Once you've configured Data Lens, try these conversations:

E-commerce Analysis:

You: Load sample_ecommerce_data.csv

You: What's the total revenue by region?

Result:

  • North America: $2,153.96
  • Europe: $578.97
  • Asia: $399.85

Employee Analysis:

You: Load sample_employee_data.csv

You: What's the average salary by department?

Result:

  • Engineering: $76,666.67
  • Marketing: $73,500
  • Sales: $71,500
  • Finance: $70,000
  • HR: $68,000

Stock Market Analysis:

You: Load sample_stock_prices.csv

You: Which company had the highest trading volume?

Result:

  • Tesla (TSLA): 91.5M average volume

These examples demonstrate Data Lens's ability to instantly analyze data without any SQL knowledge!

Quick Setup

Claude Desktop

Add to your Claude Desktop config:

{
  "mcpServers": {
    "mcp-data-lens": {
      "command": "uvx",
      "args": ["mcp-data-lens"]
    }
  }
}

Reload: Settings → Developer → Reload MCP Servers

Kiro IDE

Add to .kiro/settings/mcp.json:

{
  "mcpServers": {
    "mcp-data-lens": {
      "command": "uvx",
      "args": ["mcp-data-lens"],
      "autoApprove": ["list_tables", "list_columns", "preview_rows"]
    }
  }
}

Reload: Command Palette → "MCP: Reload Servers"

Other MCP Clients

For Cursor, Continue.dev, or any MCP-compatible client, see SETUP.md for detailed configuration instructions.

Example Conversations

Business Analysis

You: Load sales_data.xlsx and show me revenue by region

Claude: I've loaded your sales data. Here's the revenue breakdown:
- North America: $2,456,789
- Europe: $1,892,345
- Asia Pacific: $3,124,567

Asia Pacific is your top-performing region with 43% of total revenue.

You: Which products sold best in Europe?

Claude: Top 5 products in Europe by revenue:
1. Premium Widget Pro - $487,234
2. Standard Widget - $312,456
3. Widget Plus - $245,123
4. Mini Widget - $198,765
5. Widget Starter - $156,432

Data Exploration

You: I've uploaded customer_data.csv. What insights can you find?

Claude: I've analyzed your customer data (2,847 customers). Here are key insights:

- Average customer lifetime value: $3,245
- 68% of customers are in the 25-45 age group
- Email marketing has 3.2x higher conversion than other channels
- Top 10% of customers generate 41% of total revenue

Would you like me to dig deeper into any of these?

You: Show me monthly growth trends

Claude: Monthly customer acquisition:
- January: 234 new customers (+12% vs Dec)
- February: 267 new customers (+14% vs Jan)
- March: 312 new customers (+17% vs Feb)

You're seeing accelerating growth - Q1 ended 33% higher than it started.

Quick Questions

You: Load inventory.csv. How many items are below reorder level?

Claude: 47 items are currently below their reorder levels.
Here are the most critical (< 25% of reorder level):
- SKU-2847: 12 units (need 100)
- SKU-1923: 8 units (need 75)
- SKU-3456: 15 units (need 90)

You: Export a list of all items to reorder

Claude: Here's the full list of 47 items needing reorder:
[Table with SKU, Current Stock, Reorder Level, Qty Needed]

More examples: See USAGE_GUIDE.md for detailed workflows and query patterns.

Available Tools

The server exposes 8 tools for data analysis:

Tool Description
load_file Load a spreadsheet file into DuckDB
list_files Show currently loaded files
list_tables List all available tables
list_columns Show columns for a specific table
preview_rows Display first N rows of a table
get_schema Get full schema with types and sample values
run_sql Execute a SQL query (read-only)
clear_all Reset database and clear all data

Supported File Formats

  • Excel (.xlsx): Multi-sheet support, each sheet becomes a table
  • CSV (.csv): Single table, auto-detects delimiters
  • TSV (.tsv): Tab-separated values
  • Parquet (.parquet): Columnar format, native DuckDB support

Limitations

  • Single-file mode: Loading a new file replaces the previous dataset
  • Read-only: Only SELECT queries allowed, no data modification
  • No JOINs across files: Only one file active at a time

MCP Registry

Data Lens is published to the official Model Context Protocol Registry as io.github.cornelcroi/data-lens.

Install with:

uvx data-lens

Technical deep-dive: See TECHNICAL.md for architecture details, DuckDB internals, and performance characteristics.

FAQ

How is this different from Excel formulas? Excel requires you to write formulas and know cell references. Data Lens lets you ask questions in plain English. Instead of =AVERAGEIF(B:B,"North",C:C), just ask "What's the average for North region?"

What about other SQL clients? Traditional SQL clients require you to know SQL syntax. Data Lens translates your questions into SQL automatically. You get the power of SQL without learning it.

Is my data secure? 100% secure. Everything runs locally on your machine. Data Lens never sends your data anywhere. No cloud, no API calls, completely private.

What file size can it handle? Data Lens uses in-memory analytics, so it's limited by your RAM. Most spreadsheets under 100MB work great. For larger datasets, consider using database connections (roadmap feature).

Can I use this in production? Yes! Data Lens is production-ready. It's read-only by design (no DROP/DELETE/UPDATE), so it's safe for production data. Use it for reporting, analysis, and insights.

Why DuckDB? DuckDB is like SQLite for analytics - fast, embedded, and needs no setup. It handles complex queries on millions of rows instantly. Perfect for spreadsheet analysis.

Troubleshooting

Installation Issues

Command not found: uvx

pip install uv

Import errors

pip install --upgrade data-lens

File Loading Issues

  • Verify file format is supported (.xlsx, .csv, .tsv, .parquet)
  • Check file path is absolute or relative to current directory
  • Ensure file is not corrupted or password-protected

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_data_lens-0.0.3.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_data_lens-0.0.3-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_data_lens-0.0.3.tar.gz.

File metadata

  • Download URL: mcp_data_lens-0.0.3.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_data_lens-0.0.3.tar.gz
Algorithm Hash digest
SHA256 972b2d92c7d2ad7069192da028c93250bc5c05e3fa30f729042ee8c39577a66a
MD5 c1d8e613897d1082cd77ba097290328f
BLAKE2b-256 85c4c13c14244182fd6c5554ffcfa7677709ecbb988cc76ba8211a8af62ebbdb

See more details on using hashes here.

File details

Details for the file mcp_data_lens-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mcp_data_lens-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_data_lens-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cbd2f6a220adfd0eaa816ffb2aace9e222b17696a7544d4c3a72fbe3f71dd8b5
MD5 4435b9d89bb065b1db993f10c1e848ae
BLAKE2b-256 bdf2d4373bb9b34df05d01eb61bf7e5c3e5f8318756882624292fbc73c7e1f45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page