mcp-data-lens

mcp-data-lens

Enables users to ask questions about their spreadsheets in plain English and receive instant answers using DuckDB-powered analytics, supporting multiple file formats like Excel, CSV, and Parquet.

Category
访问服务器

README

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.

<!-- mcp-name: io.github.cornelcroi/data-lens -->

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选