learntodriveai.dev/Data Science/First MCP Connection: DuckDB Integration
Data Science·Project 08·6 units

First MCP Connection: DuckDB Integration.

**Track:** Data Science

§ 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