Analyze CSV and Parquet files using natural language with Claude
MCP File Analyzer: Complete Setup & Usage Guide
This guide will walk you through setting up a Model Context Protocol (MCP) server that can analyze CSV and Parquet files, and connecting it to Claude Desktop for natural language data analysis.
🎯 What You'll Build
A powerful data analysis tool that allows Claude to:
- 📊 Read and analyze CSV/Parquet files
- 📈 Generate statistical summaries
- 👀 Show data previews and structure
- 🔧 Create sample datasets
- 💬 Answer natural language questions about your data
What is MCP?
Model Context Protocol (MCP) is a standardized way to connect AI assistants like Claude to external tools and data sources. It allows you to:
- 🔐 Give Claude access to your local files (securely)
- 🛠️ Create custom tools that Claude can use
- 🔄 Build reusable AI workflows
- 🏠 Keep your data secure and local (no API keys needed!)
Quick Start
⚡ For the Impatient
# Clone or create project directory
mkdir mcp-file-analyzer && cd mcp-file-analyzer
# Set up virtual environment
python3 -m venv .venv && source .venv/bin/activate
# Install dependencies
pip install mcp>=1.0.0 pandas>=2.0.0 pyarrow>=10.0.0
# Create and test the server (copy main.py and client.py from this repo)
python main.py # Start server (Ctrl+C to stop)
python client.py # Test the connection
# Configure Claude Desktop (see detailed steps below)
Prerequisites
Before you begin, make sure you have:
- Python 3.8 or higher installed
- pip (Python package manager)
- Claude Desktop installed (download here)
- macOS, Windows, or Linux (Claude Desktop support varies)
Check your Python version:
python3 --version # Should be 3.8+
Project Setup
Step 1: Create Project and Virtual Environment
# Create project directory
mkdir mcp-file-analyzer
cd mcp-file-analyzer
# Create virtual environment
python3 -m venv .venv
# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
Step 2: Install Dependencies
Create requirements.txt:
# Core dependencies for MCP File Analyzer
mcp>=1.0.0
pandas>=2.0.0
pyarrow>=10.0.0
# HTTP client dependencies (optional)
httpx>=0.27.0
# Development dependencies (optional)
# pytest>=7.0.0
# black>=23.0.0
# flake8>=6.0.0
Install dependencies:
pip install -r requirements.txt
Step 3: Create Project Files
Your project needs these core files:
- main.py - The MCP server
- client.py - Testing client
- requirements.txt - Dependencies
- run_mcp_server.sh - Launcher script for Claude Desktop
- claude_desktop_config.json - Claude Desktop configuration
Step 4: Create Helper Scripts
Create activate_env.sh for easy environment activation:
#!/bin/bash
echo "🚀 Activating virtual environment..."
source .venv/bin/activate
echo "✅ Virtual environment activated!"
echo "📦 Installed packages:"
pip list --format=columns
echo ""
echo "🎯 Quick start commands:"
echo " - Run MCP server: python main.py"
echo " - Run demo client: python client.py"
echo " - Interactive client: python client.py interactive"
Make it executable:
chmod +x activate_env.sh
Claude Desktop Integration
🎯 Method 1: Direct Integration (Recommended)
Step 1: Create Launcher Script
Create run_mcp_server.sh:
#!/bin/bash
# MCP Server Launcher for Claude Desktop
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Change to the script directory
cd "$SCRIPT_DIR"
# Activate the virtual environment
source .venv/bin/activate
# Run the MCP server
python main.py
Make it executable:
chmod +x run_mcp_server.sh
Step 2: Create Claude Desktop Configuration
Create claude_desktop_config.json:
{
"mcpServers": {
"file_analyzer": {
"command": "/ABSOLUTE/PATH/TO/YOUR/PROJECT/run_mcp_server.sh",
"args": []
}
}
}
Important: Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT with your actual project path. Get it with:
pwd # Copy this output
Step 3: Install Configuration in Claude Desktop
Copy the configuration to Claude Desktop:
macOS:
cp claude_desktop_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows:
copy claude_desktop_config.json %APPDATA%\Claude\claude_desktop_config.json
Linux:
cp claude_desktop_config.json ~/.config/clau
Tools (2)
analyze_fileProvides statistical summaries and structure exploration for CSV or Parquet files.preview_dataShows a preview of the data contained within a file.Configuration
{"mcpServers": {"file_analyzer": {"command": "/ABSOLUTE/PATH/TO/YOUR/PROJECT/run_mcp_server.sh", "args": []}}}