AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP unreviewed MIT Self-run

Pandas Mcp Server

mcp-marlonluo2018-pandas-mcp-server · by marlonluo2018

MCP server from marlonluo2018/pandas-mcp-server.

No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add mcp-marlonluo2018-pandas-mcp-server

Open-source listing, not yet scanned by AgentStack. Follow the source repository for install instructions.

Security review

⚠ Flagged

1 finding(s); flagged for manual review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures
  • high Dangerous shell/eval execution.

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution Used
  • Environment & secrets Used
  • Dynamic code execution Used

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Reliability & compatibility

Not yet reviewed
0 installs to date
no reviews yet
7mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Pandas Mcp Server? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Pandas-MCP Server

[](https://opensource.org/licenses/MIT) [](https://www.python.org/downloads/) [](https://github.com/psf/black) [](https://github.com/marlonluo2018/pandas-mcp-server)

🚀 Powerful tool for AI-powered data analysis - Through MCP protocol, enables LLMs to safely and efficiently execute pandas code and generate visualizations

[](https://github.com/marlonluo2018/pandas-mcp-server/stargazers)

If you find this project helpful, please consider giving it a ⭐️ star!


A comprehensive Model Context Protocol (MCP) server that enables LLMs to execute pandas code through a standardized workflow for data analysis and visualization.

✨ Key Features

  • 🔒 Secure Execution Environment - Sandboxed code execution prevents malicious operations and protects system security
  • 📊 Intelligent Data Analysis - Automatically extracts file metadata, understands data structure, and provides intelligent analysis suggestions
  • 🎨 Interactive Visualizations - One-click generation of various interactive charts with real-time parameter adjustment
  • 🧠 Memory Optimization - Intelligent memory management supports large file processing with automatic data type optimization
  • 🔧 Easy Integration - Simple configuration for seamless integration with AI assistants like Claude Desktop
  • 📝 CLI Support - Provides command-line interface for convenient testing and development

🎯 MCP Server Overview

The Pandas-MCP Server is designed as a Model Context Protocol (MCP) server that provides LLMs with powerful data processing capabilities. MCP is a standardized protocol that allows AI models to interact with external tools and services in a secure, structured way.

🛠️ Installation

Prerequisites

  • Python 3.10+
  • pip package manager
  • Git (for cloning the repository)

Step 1: Clone the Repository

git clone https://github.com/marlonluo2018/pandas-mcp-server.git
cd pandas-mcp-server

Step 2: Install Dependencies

pip install -r requirements.txt

Step 3: Configure Environment Variables (Optional)

The server supports extensive configuration through environment variables. Copy the example configuration file:

cp .env.example .env

Edit the .env file to customize settings such as:

  • Log levels and file locations
  • File size limits
  • Feature flags (enable/disable chart generation, code execution)
  • Memory monitoring settings
  • Security blacklist extensions

For detailed configuration options, see [CONFIGURATION.md](CONFIGURATION.md).

Step 4: Verify Installation

# Test the CLI interface
python cli.py

# Or test the MCP server directly
python server.py

Dependencies

  • pandas>=2.0.0 - Data manipulation and analysis
  • fastmcp>=1.0.0 - MCP server framework
  • chardet>=5.0.0 - Character encoding detection
  • psutil - System monitoring for memory optimization

Claude Desktop Configuration

Using uvx (Recommended)

uvx is a fast Python package installer and runner that makes it easy to run Python tools without manual environment setup.

Install uvx
# Using pip
pip install uv

# Or using pipx (recommended for isolation)
pipx install uv
uvx Advantages
  • No manual installation: Automatically downloads and runs the package
  • Isolated environments: Each run uses a clean virtual environment
  • Fast: Uses uv's fast dependency resolver
  • Version pinning: Easy to run specific versions
Add this configuration to your Claude Desktop settings:
{
  "mcpServers": {
    "pandas-server": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "/path/to/pandas-mcp-server", "pandas-mcp-server"]
    }
  }
}

Path Format by Operating System:

  • Windows: Use forward slashes (recommended) or escaped backslashes
  • C:/Project/pandas-mcp-server (recommended)
  • C:\\Project\\pandas-mcp-server (escaped backslashes)
  • macOS/Linux: Use forward slashes
  • /Users/username/projects/pandas-mcp-server
  • /home/username/projects/pandas-mcp-server

Note: Replace /path/to/pandas-mcp-server with the absolute path to your pandas-mcp-server directory. The full path is required because Claude Desktop executes commands from its own working directory.

Using Python (Traditional)

Add this configuration to your Claude Desktop settings:

{
  "mcpServers": {
    "pandas-server": {
      "type": "stdio",
      "command": "python",
      "args": ["/path/to/your/pandas-mcp-server/server.py"]
    }
  }
}

Configuration File Location

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Verification

After configuration, restart Claude Desktop. The server should appear in the MCP tools list with four available tools:

  • read_metadata_tool - File analysis
  • interpret_column_data - Column value interpretation
  • run_pandas_code_tool - Code execution
  • generate_chartjs_tool - Chart generation

🔄 Workflow

The pandas MCP server follows a structured workflow for data analysis and visualization:

Step 1: Read File Metadata

LLM calls read_metadata_tool to understand the file structure:

  • Extract file type, size, encoding, and column information
  • Get data types, sample values, and statistical summaries
  • Receive data quality warnings and suggested operations
  • Understand the dataset structure before processing

Step 2: Interpret Column Values (Optional)

LLM calls interpret_column_data to understand specific columns:

  • Extract all unique values from important columns
  • Identify patterns in categorical data
  • Understand the meaning behind codes or abbreviations
  • Key Purpose: Complement metadata by providing deep understanding of column values, which helps LLM generate more accurate and effective pandas code in the next step, especially when working with multiple CSV files

When to Use interpretcolumndata:

  • High Value: Categorical fields with limited unique values (Region, Status, Category)
  • High Value: Code fields that need interpretation (StatusCode "A", "B", "C")
  • High Value: Fields with abbreviations or cryptic values
  • Low Value: ID fields (usually unique values with no patterns)
  • Low Value: Email fields (typically unique identifiers)
  • Low Value: Numeric percentage fields (already self-explanatory)
  • Conditional: Time fields (useful for non-standard formats or categorical time)

Step 3: Execute Pandas Operations

LLM calls run_pandas_code_tool based on metadata and column analysis:

  • Formulate pandas operations using the understood file structure
  • Execute data processing, filtering, aggregation, or analysis
  • Receive results in DataFrame, Series, or dictionary format
  • Get optimized output with memory management

Step 4: Generate Visualizations

LLM calls generate_chartjs_tool to create interactive charts:

  • Transform processed data into Chart.js compatible format
  • Generate interactive HTML charts with customization controls
  • Create bar, line, or pie charts based on data characteristics
  • Output responsive visualizations for analysis presentation

How interpret_column_data Complements read_metadata

The interpret_column_data function is designed to complement the read_metadata_tool by providing deeper insights into column values:

  • read_metadata_tool: Focuses on file structure, data types, and statistical summaries
  • Provides high-level understanding of the dataset
  • Offers sample values and basic statistics
  • Helps LLM understand the overall data architecture
  • interpret_column_data: Focuses on detailed value analysis of specific columns
  • Reveals all unique values and their frequencies
  • Helps LLM understand categorical data patterns
  • Enables more precise filtering and grouping operations
  • Particularly valuable when working with multiple CSV files where consistent value understanding across datasets is crucial

This two-step approach ensures that LLM has both structural and value-level understanding before generating pandas code, resulting in more accurate and effective data analysis operations, especially when processing multiple CSV files.

🚀 MCP Server Tools

The server exposes four main tools for LLM integration:

1. read_metadata_tool - File Analysis

Extract comprehensive metadata from Excel and CSV files including:

  • File type, size, encoding, and structure
  • Column names, data types, and sample values
  • Statistical summaries (null counts, unique values, min/max/mean)
  • Data quality warnings and suggested operations
  • Memory-optimized processing for large files

Purpose: Provides LLM with a high-level understanding of the data structure and characteristics, serving as the foundation for data analysis.

MCP Tool Usage:

{
  "tool": "read_metadata_tool",
  "args": {
    "file_path": "/path/to/sales_data.xlsx"
  }
}

2. interpret_column_data - Column Value Interpretation

Interpret specific columns to understand their value patterns:

  • Extract all unique values with their counts from specified columns
  • Support for single or multiple column interpretation
  • Automatic pattern recognition for common data types
  • Complete value distribution without sampling
  • Support for both CSV (.csv) and Excel (.xlsx, .xls) files
  • Excel worksheet selection capability

Purpose: Complements read_metadata_tool by providing deep insights into column values, enabling LLM to generate more precise filtering, grouping, and analysis operations, especially when working with multiple CSV files that require consistent value understanding across datasets.

Best Use Cases:

  • Most Valuable: Categorical fields with limited unique values (Region, Status, Category)
  • Most Valuable: Code/abbreviation fields that need interpretation (StatusCode "A", "B", "C")
  • Less Valuable: ID fields, email fields, or numeric percentage fields
  • Context-Dependent: Time fields (useful for non-standard formats)
Response Format

The function returns a structured response with the following format:

{
  "columns_interpretation": [
    {
      "column_name": "Region",
      "data_type": "object",
      "total_values": 1000,
      "null_count": 5,
      "unique_count": 4,
      "unique_values_with_counts": [
        ["North", 350],
        ["South", 280],
        ["East", 220],
        ["West", 145]
      ]
    }
  ]
}
Key Features
  • Complete Value Distribution: Returns all unique values with their exact counts
  • Sorted by Frequency: Values are sorted in descending order of occurrence
  • Data Type Analysis: Identifies the underlying data type (object, int64, etc.)
  • Quality Metrics: Provides null count and total values for data quality assessment
  • Multi-column Support: Can analyze multiple columns in a single request

MCP Tool Usage:

{
  "tool": "interpret_column_data",
  "args": {
    "file_path": "/path/to/sales_data.csv",
    "column_names": ["Region", "Status"]
  }
}

Excel File Usage (with optional sheet selection):

{
  "tool": "interpret_column_data",
  "args": {
    "file_path": "/path/to/sales_data.xlsx",
    "column_names": ["Region", "Status"],
    "sheet_name": "Q3_Sales"  // Optional: sheet name or index (default: 0)
  }
}

3. run_pandas_code_tool - Secure Code Execution

Execute pandas operations with:

  • Security filtering against malicious code
  • Memory optimization for large datasets
  • Comprehensive error handling and debugging
  • Support for DataFrame, Series, and dictionary results

Purpose: Leverages insights from both read_metadata_tool and interpret_column_data to execute precise data analysis operations, particularly valuable when processing multiple CSV files with consistent value patterns.

Forbidden Operations

The following operations are blocked for security reasons:

  • System Access: os., sys., subprocess. - Prevents file system and system access
  • Code Execution: open(), exec(), eval() - Blocks dynamic code execution
  • Dangerous Imports: import os, import sys - Prevents specific harmful imports
  • Browser/DOM Access: document., window., XMLHttpRequest - Blocks browser operations
  • JavaScript/Remote: fetch(), eval(), Function() - Prevents remote code execution
  • Script Injection: script, javascript: - Blocks script injection attempts

Requirements:

  • Final result must be assigned to result variable
  • Code should include necessary imports (pandas available as pd)
  • All code goes through security filtering before execution

MCP Tool Usage:

{
  "tool": "run_pandas_code_tool",
  "args": {
    "code": "import pandas as pd\ndf = pd.read_excel('/path/to/data.xlsx')\nresult = df.groupby('Region')['Sales'].sum()"
  }
}

4. generate_chartjs_tool - Interactive Visualizations

Generate interactive charts with Chart.js:

  • Bar charts - For categorical comparisons
  • Line charts - For trend analysis
  • Pie charts - For proportional data
  • Interactive HTML templates with customization controls
Chart Output
  • File Format: All charts are generated as standalone HTML files
  • Save Location: Charts are saved in the ./charts/ directory by default
  • File Naming: Files are automatically named with timestamp and chart type (e.g., bar_chart_20250710_143022.html)
  • Accessibility: HTML files can be opened in any web browser and shared easily

MCP Tool Usage:

{
  "tool": "generate_chartjs_tool",
  "args": {
    "data": {
      "columns": [
        {
          "name": "Region",
          "type": "string",
          "examples": ["North", "South", "East", "West"]
        },
        {
          "name": "Sales",
          "type": "number",
          "examples": [15000, 12000, 18000, 9000]
        }
      ]
    },
    "chart_types": ["bar"],
    "title": "Sales by Region"
  }
}

🚀 Usage

CLI Interface (Testing & Development)

The CLI provides a convenient command-line interface for testing the MCP server functionality without requiring an MCP client:

Interactive Mode
# Using Python
python cli.py

# Using uvx
uvx pandas-mcp-cli

Launches a guided menu system with:

  • Step-by-step workflow guidance
  • Automatic input validation
  • Clear error messages
  • Support for file paths with spaces
Command-Line Mode
# Read metadata
python cli.py metadata data.xlsx
uvx pandas-mcp-cli metadata data.xlsx

# Interpret column values (useful for multiple CSV files)
python cli.py interpret data.csv --columns "Region,Status"
uvx pandas-mcp-cli interpret data.csv --columns "Region,Status"

# Execute pandas code
python cli.py execute analysis.py
uvx pandas-mcp-cli execute analysis.py

# Generate charts
python cli.py chart data.json --type bar --title "Sales Analysis"
uvx pandas-mcp-cli chart data.json --type bar --title "Sales Analysis"
Chart Output Information

When generating charts using the CLI:

  • Output Format: Charts are saved as interactive HTML files
  • Default Location: All charts are saved in the ./charts/ directory
  • File Naming: Automatic naming with timestamp and chart type
  • Viewing Charts: Open the HTML files in any web browser to view interactive visualizations
  • Sharing: HTML files can be easily shared with others

🔍 Code Logic & Architecture

Core Components

1. Server Architecture (server.py)
  • FastMCP Integration: Uses FastMCP framework for MCP protocol implementation
  • Logging System: Unified logging with rotation and memory tracking
  • Tool Registration: Exposes four main tools with proper error handling
  • Memory Monitoring: Tracks memory usage before/after operations
2. Metadata Processing (core/metadata.py)

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.