loading…
Search for a command to run...
loading…
Loads CSV files into a temporary SQLite database and provides comprehensive data analysis tools via MCP, enabling AI assistants to query, analyze, and export da
Loads CSV files into a temporary SQLite database and provides comprehensive data analysis tools via MCP, enabling AI assistants to query, analyze, and export data using natural language.
A Model Context Protocol (MCP) server that provides comprehensive tools for loading CSV files into a temporary SQLite database and performing advanced data analysis with AI assistance.
pip install mcp-csv-database
git clone https://github.com/Lasitha-Jayawardana/mcp-csv-database.git
cd mcp-csv-database
pip install -e .
Start the server with stdio transport:
mcp-csv-database
Recommended: Auto-load CSV files from a folder using positional argument:
mcp-csv-database /path/to/csv/files
Alternative syntax with explicit flag:
mcp-csv-database --csv-folder /path/to/csv/files
With custom table prefix:
mcp-csv-database /path/to/csv/files --table-prefix sales_
For remote access with HTTP transport:
mcp-csv-database /path/to/csv/files --transport sse --port 8080
Add to your MCP client configuration:
{
"mcpServers": {
"csv-database": {
"command": "mcp-csv-database",
"args": ["/path/to/your/csv/files"]
}
}
}
Alternative configuration with explicit options:
{
"mcpServers": {
"csv-database": {
"command": "mcp-csv-database",
"args": ["--csv-folder", "/path/to/csv/files", "--table-prefix", "analytics_"]
}
}
}
load_csv_folder(folder_path, table_prefix="") - Load all CSV files from a folder with smart separator detectionlist_loaded_tables() - List currently loaded tables with source file informationclear_database() - Clear all loaded data and temporary filesbackup_database(backup_path) - Create complete database backupsexecute_sql_query(query, limit=100) - Execute any SQL query with automatic result formattingget_database_schema() - View complete database schema with column types and sample dataget_table_info(table_name) - Get detailed information about specific tablesget_query_plan(query) - Analyze query execution plans for performance optimizationget_data_summary(table_name) - Comprehensive data overview with insights and data typesget_column_stats(table_name, column_name) - Detailed statistical analysis for specific columnsanalyze_missing_data(table_name) - Complete missing data analysis across all columnsfind_duplicates(table_name, columns="all") - Advanced duplicate detection with configurable column setscreate_index(table_name, column_name, index_name="") - Create indexes for query optimizationexport_table_to_csv(table_name, output_path, include_header=True) - Export tables with custom formatting# Load CSV files
result = load_csv_folder("/path/to/csv/files")
# View what's loaded
schema = get_database_schema()
# Query the data
result = execute_sql_query("SELECT * FROM my_table LIMIT 10")
# Export results
export_table_to_csv("my_table", "/path/to/output.csv")
# Get comprehensive data overview
summary = get_data_summary("sales_data")
# Detailed statistical analysis for specific columns
price_stats = get_column_stats("sales_data", "price")
quantity_stats = get_column_stats("sales_data", "quantity")
# Data quality assessment
missing_analysis = analyze_missing_data("sales_data")
duplicates = find_duplicates("sales_data", "customer_id,product")
# Complex analytical queries
result = execute_sql_query("""
SELECT
category,
COUNT(*) as count,
AVG(price) as avg_price,
SUM(quantity) as total_quantity,
MIN(price) as min_price,
MAX(price) as max_price,
STDDEV(price) as price_stddev
FROM sales_data
GROUP BY category
ORDER BY total_quantity DESC
""")
# Performance optimization
create_index("sales_data", "category")
query_plan = get_query_plan("SELECT * FROM sales_data WHERE category = 'Electronics'")
# Step 1: Load and inspect data
load_csv_folder("/path/to/data")
schema = get_database_schema()
# Step 2: Data quality assessment
missing_data = analyze_missing_data("customers")
duplicates = find_duplicates("customers", "email")
summary = get_data_summary("customers")
# Step 3: Statistical analysis
age_stats = get_column_stats("customers", "age")
income_stats = get_column_stats("customers", "income")
# Step 4: Clean and analyze
clean_data = execute_sql_query("""
SELECT customer_id, name, email, city, age, income
FROM customers
WHERE email IS NOT NULL
AND age BETWEEN 18 AND 100
AND income > 0
""")
The server supports multiple transport methods:
stdio (default): Standard input/outputsse: Server-sent eventsstreamable-http: HTTP streaming# SSE transport
mcp-csv-database --transport sse --port 8080
# HTTP transport
mcp-csv-database --transport streamable-http --port 8080
mcp-csv-database [folder_path] [OPTIONS]
# Positional Arguments:
# folder_path Path to folder containing CSV files (recommended)
# Options:
# --csv-folder PATH Alternative way to specify CSV folder path
# --table-prefix PREFIX Optional prefix for table names (e.g., 'sales_')
# --transport TYPE Transport type: stdio (default), sse, streamable-http
# --port PORT Port for HTTP transport (default: 3000)
# -h, --help Show help message and exit
# Examples:
mcp-csv-database /data/sales # Load CSV files from /data/sales
mcp-csv-database --csv-folder /data --table-prefix t_ # Load with table prefix
mcp-csv-database /data --transport sse --port 8080 # HTTP transport on port 8080
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
get_data_summary(), get_column_stats(), analyze_missing_data(), find_duplicates()Выполни в терминале:
claude mcp add mcp-csv-database -- npx Query your database in natural language
автор: AnthropicRead-only database access with schema inspection.
автор: modelcontextprotocolInteract with Redis key-value stores.
автор: modelcontextprotocolDatabase interaction and business intelligence capabilities.
автор: modelcontextprotocolНе уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории data