mcpdata Request an invite

Answers / Get data into your AI

How do I turn a folder of CSV files into tables my AI can query?

Recipe verified on Ran on a private test instance
Short answer

Point cdb-localdata at the folder: every CSV becomes a table named after the file, under a namespace you choose (shop.orders, shop.customers, ...). Your AI lists them with list_tables and queries each one; new and changed files arrive on the next sync.

Steps

  1. Connect your assistant to your instance (this writes, so it needs your own instance with a ReadWrite key from the accounts portal; the public demo is read-only). In Claude Code:
    claude mcp add --transport http mcpdata https://[you].mcpdata.org/mcp --header "Authorization: Bearer $CDB_API_KEY"

    Replace [you] with your instance's name. Other apps: Connect your AI.

  2. Install the client and sign it in.
    pip install https://[you].mcpdata.org/help/download/cdb-0.3.4-py3-none-any.whl
    cdb-localdata login --to https://[you].mcpdata.org
  3. Add the folder and sync it. The sample folder shop holds orders.csv, customers.csv and products.csv:
    cdb-localdata add ./samples/shop --to https://[you].mcpdata.org --namespace shop
    cdb-localdata sync
  4. Ask your question. Give your AI this prompt:
    Using mcpdata, list the tables under shop, then total the quantity per category in shop.orders.
What your AI does: the tool calls it makes for this prompt, and what came back
list_tables() → 10 tables: mycsv.orders_mixed_dates, shop.orders, shop.customers, shop.products
query(table_name="shop.orders", group_by=["category"], agg=[{"func": "sum", "column": "quantity", "alias": "units"}], sort=[{"column": "units", "desc": true}]) → 12 rows
What you should get · the recipe's real result from its last run
categoryunits
Storage1,508
Monitors1,484
Audio1,470
Cameras1,396
Tablets1,373
Networking1,372
Phones1,348
Smart Home1,334
Laptops1,288
Accessories1,191
Software1,156
Gaming1,132

The assistant needs mcpdata connected (step 1) to run the query.

Why this works

One table per file keeps the structure you already have, so the AI can find things by name. Subfolders become part of the name (shop.2025.orders), and a file that's deleted locally can be dropped from the server too.

Related questions