Skip to content

Data Management with Natural Language ​

Overview ​

This workshop explores how MCP (Model Context Protocol) servers can act as a bridge between natural language interfaces and traditional relational databases. Instead of writing complex SQL or building custom APIs, you will learn how MCP servers enable LLMs to query, analyze, and manage structured data using plain language.

Goals ​

  • Understand the basics of relational databases
  • Understand what MCP servers are and how they work
  • Connect MCP servers to relational databases
  • Use natural language to query and explore structured data
  • Automatically generate data visualizations using the Auto Visualiser MCP

Prerequisites ​

Before starting, ensure you have the following installed:

  • Goose Desktop – for managing LLM + MCP integrations.
  • Docker Desktop – for running a containerized local Postgres database.
  • npx – for running Node.js-based MCP utilities.
  • uvx – for lightweight Python environment and dependency management.

1. What are Relational Databases? ​

Relational databases store data in tables made up of rows and columns, with clearly defined relationships between tables. They are designed to keep data structured, consistent, and easy to query.

Key concepts include:

  • Tables – collections of related data.
  • Rows – individual records in a table.
  • Columns – named fields that define the data type of each value.
  • Primary keys – unique identifiers for rows.
  • Foreign keys – references that link data across tables.
  • Schemas – logical groupings that organize database objects.

Relational databases like PostgreSQL, MySQL, and SQLite are widely used because they keep data accurate, consistent, and reliable.

Common Types of Relationships ​

Relational databases model how data connects across tables using relationships. The three most common types are:

  • One-to-One (1:1) – A single row in one table relates to a single row in another table. Example: a user and a user profile.

  • One-to-Many (1:N) – One row in a table relates to many rows in another table. This is the most common relationship type. Example: a customer placing many orders.

  • Many-to-Many (N:M) – Many rows in one table relate to many rows in another table, typically implemented using a join (or junction) table. Example: students enrolled in multiple courses.

Understanding these relationships is key to designing schemas and asking effective natural language questions about your data.

2. What are MCP Servers? ​

Model Context Protocol (MCP) servers are middleware systems that:

  • Act as a bridge between LLMs and external tools.
  • Provide structured context to models in real time.
  • Allow LLMs to query databases, APIs, or other external systems.

Learn more here.

3. Set up a Relational Database ​

You will need a running relational database (PostgreSQL recommended) for the rest of this workshop.

  • Follow the guide linked here.

Once your database is running, you should compose a connection string. This string will be used by an MCP server to connect securely to your database.

Example connection string:

DATABASE_URI=postgres://user:password@localhost:5432/mydb

This connection string is made up of several parts:

  • postgres:// – the database protocol (PostgreSQL)
  • user – the database user name
  • password – the password for that user
  • localhost – the database host (where Postgres is running)
  • 5432 – the port Postgres is listening on (default)
  • mydb – the name of the database to connect to

4. Add Postgres MCP ​

Step 1: Open Goose Desktop ​

  1. Launch Goose Desktop on your machine.
  2. Navigate to the Extensions section in the sidebar.

Step 2: Add a New MCP Server Extension ​

  1. Click the Extensions button in the sidebar.

  2. Under Extensions, click Add custom extension.

  3. In the Add custom extension modal, enter the following details:

    • Extension Name: Choose a name (e.g., Postgres MCP)
    • Description: A short description (e.g., Provides natural language access to Postgres)
    • Type: Standard IO
    • Command: uvx postgres-mcp --access-mode=unrestricted
  4. Under Environment variables, add your database connection string:

    • Key: DATABASE_URI
    • Value: postgres://user:password@localhost:5432/mydb
  5. Click the Add button to the right of the variable field.

  6. Click Save Changes to save.

Step 3: Start and Verify the Extension ​

  1. Toggle the Postgres MCP extension On.
  2. Goose Desktop will start the MCP server and manage the connection automatically.
  3. Verify that the Postgres MCP tools appear and are enabled.

For advanced configuration options and troubleshooting, see the official repository: https://github.com/crystaldba/postgres-mcp

5. Populate the Database ​

Use natural language with the Postgres MCP to design your database and add data.

Step 1: Create the schema ​

Use natural language prompts to describe the structure of your database. Think about:

  • What tables you need
  • The columns in each table
  • How tables relate to each other (one-to-one, one-to-many, many-to-many)

Example prompts:

  • One-to-Many (1:N): "Create tables for people and dogs, where each person can have many dogs"
  • Many-to-Many (M:N): "Create tables for doctors and patients, where doctors can have many patients and patients can have many doctors"

The Postgres MCP will translate these instructions into the appropriate database schema.

Step 2: Add data ​

Once the schema exists, use natural language to insert data into your tables.

Example prompts:

  • "Insert 5 sample people with names and ages, and give each person 1–3 dogs"
  • "Insert several doctors and patients, and associate patients with multiple doctors"

After adding data, you should be able to query and visualize it in the next step.

6. Visualize Data ​

Turn query results into charts and visual summaries using the Auto Visualiser MCP.

  1. Ensure the Auto Visualiser MCP is enabled in Goose Desktop.
  2. Use natural language to ask questions about your data (for example: "Show total orders per customer" or "Plot daily revenue over time").
  3. The Auto Visualiser MCP will automatically generate appropriate visualizations (tables, bar charts, line charts) based on the query results.
  4. Iterate by refining your prompt to adjust grouping, filters, or chart types.

7. Summarize and Document Insights ​

Document insights from your data using visualizations.

  1. Using the Auto Visualiser MCP, create three meaningful visualizations or summaries of your data. Aim for visuals that answer real questions, such as:

    • Counts or distributions (e.g., number of dogs per person)
    • Relationships between entities (e.g., doctors and their patients)
    • Trends or comparisons that stand out in your dataset
  2. Take screenshot of each chart.

  3. Paste the screenshots into the Google Doc for this workshop, adding a short caption or sentence explaining what each visualization shows and why it’s interesting.