learntodriveai.dev/Data Science/First MCP Connection: DuckDB Integration
Data ScienceProject 086 unitsVerified on 16 October 2026

First MCP Connection: DuckDB Integration

Budi HartonoOwner and Operations Manager · Shrimp farm · Sidoarjo, Indonesia
Text message · from Budi
I want to know if the water quality data explains why some harvests are better. … I just want to understand my ponds better.
Chat with Budi

What you hand back

  • A DuckDB database joining sensor and production data
  • Water quality aggregates per pond and cycle
  • A note on the SID-003 calibration drift
  • A note on why the sensor-pond comparison is confounded
  • A plain-language findings summary for the farm owner

6 units

  1. Unit 1: Budi's message and the data

    Read the farm owner's message, profile both datasets, and find that the sensor IDs and pond names do not match.

    Open unit 1
  2. Unit 2: Connecting DuckDB via MCP

    Load both CSVs into DuckDB and connect Claude Code to the database through an MCP server.

    Open unit 2
  3. Unit 3: The connected analysis

    Join sensor readings to production records for the three sensor ponds, using per-cycle water quality aggregates.

    Open unit 3
  4. Unit 4: Data path verification

    Check the queries and join logic, find the drifting SID-003 sensor, and spot the flaw in the vendor's dashboard query.

    Open unit 4
  5. Unit 5: Analysis and interpretation

    Run the correlations on clean data, explain the sensor-pond confound, and frame what six observations can support.

    Open unit 5
  6. Unit 6: Translate and deliver

    Write the findings in a farmer's terms, handle the feed data request, and push the finished project.

    Open unit 6
Read the full brief

Sensor readings live in one system; production records live in another. For a shrimp farm in East Java you build a multi-source analysis that connects them to test whether water quality explains harvest variation across eight ponds.

The discipline skills: loading CSVs into DuckDB, joining sensor data to production records with correct key mapping, profiling and correlating across sources, and communicating practical findings to a non-technical farmer.

The AI-direction lesson: for the first time, you connect AI to an external database via MCP. Instead of describing your data and having AI work from your description, AI reads the schema and queries the data directly. The output quality improves immediately -- but verification changes too. When AI makes its own data access decisions -- which tables to scan, which columns to join on, which filters to apply -- you need to verify the query path, not just the statistical result. The skill is learning what to check when AI has direct access to the data.

Your Role

You deliver the analysis, and the analytical work is familiar -- profiling, joining, correlating. What changes is how AI accesses the data. That shift changes what AI can do and what you need to verify.

What's New

Last time, you built AI infrastructure — authored CLAUDE.md and AGENTS.md, encoded your analytical conventions, and experienced the difference between a cold-start session and one where AI loads those conventions from its first prompt.

This time, you connect AI to the data itself. The MCP connection lets AI query Budi's database directly — exploring tables, reading schemas, running SQL. The output quality difference between "AI works from your description" and "AI works from the actual data" is immediate.

The hard part is not the connection. It is learning what to verify when AI makes its own data access decisions — which tables to scan, which columns to join on, which filters to apply. Verification now extends to the data path, not just the statistical output.

Tools

  • Python 3.11+ via your conda "ds" environment
  • Jupyter Notebook for the analysis
  • DuckDB — a lightweight analytical database (new)
  • DuckDB MCP server — connects Claude Code to the database (new)
  • pandas for data handling
  • statsmodels for hypothesis tests
  • scipy for statistical tests
  • matplotlib / seaborn for visualization
  • Claude Code as the AI you direct
  • Git / GitHub for version control

Materials

You receive:

  • Sensor readings from three ponds (6 months of hourly water quality data)
  • Production records for all eight ponds (2 years of per-cycle harvest data)
  • A data dictionary describing both datasets
  • The SQL query behind the sensor vendor's dashboard (reviewed in Unit 4)
  • No pre-built database — you load the CSVs into DuckDB as part of the work
  • No methodology template — you structure the analysis yourself
Materials · 5 files
Start Project 8

You work at a computer with a terminal. Signed in, your place is saved.