Skip to main content

MCP server that ingests CSV/TSV/Parquet/Excel/JSON files into any SQLAlchemy database

Project description

csv-ingest-mcp

PyPI License: MIT

MCP server for ingesting CSV / TSV / Parquet / Excel / JSON / JSONL files into any SQLAlchemy-supported database (Postgres, MySQL, SQLite, MSSQL, ...). Plug into Claude Desktop, Cursor, Cline, or Continue and let the LLM load tabular data on demand.

Install

uvx csv-ingest-mcp        # one-shot, no global install
# or
pip install csv-ingest-mcp

Quick start (Claude Desktop)

~/.config/Claude/claude_desktop_config.json (Linux) / ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "csv-ingest": {
      "command": "uvx",
      "args": ["csv-ingest-mcp"],
      "env": {
        "CSV_MCP_ALLOWED_DIRS": "/home/you/data",
        "CSV_MCP_DB_URL": "postgresql://user:pass@localhost/mydb"
      }
    }
  }
}

Restart Claude Desktop. The model now has six tools.

Tools

Tool Purpose
ingest_file(path, table, if_exists, sheet, auto_alter, dry_run) Load file into table
upsert_file(path, table, key_columns, sheet, dedupe_source) Key-based replace + insert
list_tables() Database table names
describe_table(table) Schema + row count
ingest_async(path, table, if_exists, auto_alter) Queue large file via Celery
job_status(job_id) Poll Celery job

Configuration

Env var Default Purpose
CSV_MCP_ALLOWED_DIRS (required) :-separated path allowlist
CSV_MCP_DB_URL sqlite:///./csv_ingest.db SQLAlchemy DSN
CSV_MCP_MAX_ROWS 1000000 Per-file row cap
CSV_MCP_CHUNK_SIZE 50000 Streaming chunk rows
CSV_MCP_BROKER_URL redis://localhost:6379/0 Celery broker
CSV_MCP_RESULT_BACKEND redis://localhost:6379/1 Celery backend
CSV_MCP_WATCH_IF_EXISTS append Watcher write mode

Cursor / Cline / Continue

{
  "mcp": {
    "servers": {
      "csv-ingest": {
        "command": "uvx",
        "args": ["csv-ingest-mcp"],
        "env": { "CSV_MCP_ALLOWED_DIRS": "/abs/data" }
      }
    }
  }
}

Async + watcher (optional)

# 1. Redis
docker run -d -p 6379:6379 redis:7

# 2. Celery worker
CSV_MCP_ALLOWED_DIRS=/data CSV_MCP_DB_URL=postgresql://... \
  uv run celery -A csv_ingest_mcp.tasks worker -l info

# 3. File watcher (drops a CSV in /data/inbox -> table auto-created)
CSV_MCP_ALLOWED_DIRS=/data uv run csv-ingest-watch

Docker (self-host)

docker compose up -d

See docker-compose.yml (server + worker + redis).

Security

  • Path allowlist (CSV_MCP_ALLOWED_DIRS) — only listed dirs readable
  • SQL identifier regex — table/column names validated
  • Parametrized inserts (no string concat)
  • Row cap + chunk streaming — bounded memory
  • JSON-only Celery serializer — no pickle RCE

Disclose security issues to: priyank.salot@dbcorp.in

Architecture

See ARCHITECTURE.md for component map, request flows, and publishing approach.

Development

git clone https://github.com/priyak-salot/csv-ingest-mcp
cd csv-ingest-mcp
uv sync
uv run pytest

License

MIT

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

csv_ingest_mcp-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

csv_ingest_mcp-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file csv_ingest_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: csv_ingest_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for csv_ingest_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 66cbee41d362b4bcac32e21137a0016c57adf94083f0dc7c75918443c09ab8a7
MD5 6faf4cae5cddda33e6a9d841c5fd6fd0
BLAKE2b-256 293e8a385762b128898d0b013eadf110e0575517906ce45e2309d2c961b6b63b

See more details on using hashes here.

File details

Details for the file csv_ingest_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: csv_ingest_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for csv_ingest_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e92c7ad861952d70d088b6938b40d83d6c2629a76e80bc836d83a7765457a07
MD5 7f0ba90d272073544f0d66754f912fc3
BLAKE2b-256 3077cfb6e8bc6c6dbc28c20ba6a7dd743203d4a5ff6446bf2b9e930086e64b08

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