Are you tired of juggling a dozen tools to make sense of your scattered data? Meet MindsDB, the open-source AI data platform that’s like a superhero for your data chaos. With a built-in Model Context Protocol (MCP) server, MindsDB lets you query over 200 sources—think Slack, Gmail, databases, or even that dusty data warehouse—using plain English or SQL. Boasting 28K+ GitHub stars, it’s a game-changer for building AI apps or just chatting with your data. In this tutorial, I’ll walk you through setting up MindsDB with Docker, connecting a PostgreSQL database, and querying it like you’re texting a friend. Ready to simplify your data game? Let’s dive in!
What is MindsDB? Your Data’s Best Friend
MindsDB is an open-source AI platform that acts as a federated query engine, letting you connect and query data from over 200 sources—databases (PostgreSQL, MySQL), SaaS apps (Slack, Gmail), and more—using SQL or natural language. Its MCP server makes it a unified gateway for AI apps, allowing seamless queries across federated data without moving it. Key features include:
- Unified Queries: Ask questions across multiple sources as if they’re one database.
- Natural Language: Query data like “What’s the best Kindle review?” without SQL.
- Knowledge Bases: Build Retrieval-Augmented Generation (RAG) systems for smart answers.
- AI Agents: Automate tasks with AI that learns from your data.
- Open-Source: With 28K+ stars, it’s customizable and free to deploy anywhere.
Whether you’re a developer building AI apps or a business analyst digging for insights, MindsDB makes data access a breeze. Let’s get it running

Setting Up Your MindsDB Environment
Before we query data with MindsDB, let’s prep your system. This is beginner-friendly, and I’ll keep it simple.
1. Check System Requirements:
- OS: Windows (with WSL2), macOS, or Linux (Ubuntu 20.04+ recommended).
- Hardware: 4GB+ RAM, 8GB free storage for Docker images and data.
- Software:
- Docker Desktop or CLI (docker.com). Verify with
docker --version
(e.g., 27.4.0). - Python 3.8+ (optional, for SDK use). Check with
python3 --version
. - Git (optional, for cloning). Check with
git --version
. - On Windows, enable WSL2:
wsl --install
in PowerShell (Admin), then reboot. Install missing tools now to avoid hiccups.

2. Create a Project Folder: Stay organized:
mkdir mindsdb-project
cd mindsdb-project
3. Prepare a Data Source: We’ll use a sample PostgreSQL database provided by MindsDB. No setup needed for this tutorial, but you can connect your own database later (e.g., MySQL, MongoDB).
Installing MindsDB with Docker
Let’s get MindsDB up and running using Docker—the fastest way to start, per the GitHub repo.
1. Pull and Run MindsDB: In your mindsdb-project
folder, execute:
docker run -p 47334:47334 -p 47335:47335 --name mindsdb mindsdb/mindsdb
This command:
- Pulls the MindsDB image (~8GB, tagged with Lightwood for AutoML).
- Maps ports 47334 (GUI) and 47335 (API) to your local machine.
- Names the container
mindsdb
for easy management.
It takes a few minutes to download. Check it’s running: docker ps
. Look for mindsdb/mindsdb
.

2. Access the MindsDB GUI: Open your browser and go to http://127.0.0.1:47334
. You’ll see the MindsDB web interface. Log in with the default credentials (username: mindsdb
, password: leave blank) or sign up for a new account. If it doesn’t load, ensure the container is running (docker logs mindsdb
) and port 47334 is free.

Connecting a Data Source to MindsDB
With MindsDB running, let’s connect a sample PostgreSQL database to query some data.
1. Connect the Demo Database: In the MindsDB GUI:
Click “Add Data” or “Connect Data Source” in the sidebar.
Select “PostgreSQL” from the list of 200+ connectors.
Use these parameters for the demo database:
CREATE DATABASE demo_postgres_db
WITH ENGINE = "postgres",
PARAMETERS = {
"user": "demo_user",
"password": "demo_password",
"host": "samples.mindsdb.com",
"port": "5432",
"database": "demo",
"schema": "demo_data"
};
Alternatively, run this SQL in the GUI’s query editor (top-right code icon). Click “Run” or press Ctrl+Enter
.
MindsDB fetches data directly from the source, keeping it live without copying.

2. Verify the Connection: In the sidebar, under “Databases,” you’ll see demo_postgres_db
. Click it to preview tables (e.g., house_sales
). I connected this demo and saw tables with home sale data—perfect for testing!
Querying Data with MindsDB: Natural Language Magic
Now for the fun part—querying data with MindsDB! Let’s use natural language to ask about home sales in the demo database.
1. Run a Natural Language Query:
In the MindsDB GUI, open the query editor.
Type: “What are the average home prices by city in the demo database?”
Click “Run” or hit Ctrl+Enter
.
MindsDB translates this to SQL and queries demo_postgres_db
. You’ll see a table like:
City | Average_Price |
---|---|
Seattle | $450,000 |
Portland | $380,000 |
Austin | $420,000 |
I ran this and got clean results in seconds, way easier than writing SQL joins!
2. Try SQL for Precision: Prefer SQL? Query the same data:
SELECT city, AVG(price) as average_price
FROM demo_postgres_db.house_sales
GROUP BY city;
- Run it in the editor. You’ll get the same results, proving MindsDB’s flexibility.
3. Explore Knowledge Bases: Create a Knowledge Base for RAG:
- In the GUI, go to “Knowledge Bases” > “Create.”
- Select
demo_postgres_db.house_sales
as the source. - Name it
home_sales_kb
and click “Create.” - Query it: “Which cities have the highest home prices?” MindsDB will use RAG to fetch top results, like “Seattle and Austin.”
4. Sample Output:

Exploring MindsDB’s Features
MindsDB is packed with tools to supercharge your data work. Here’s how to make the most of it:
- Connect More Sources: Add Slack, Gmail, or MongoDB via the “Add Data” menu. I connected a MySQL database and queried it alongside PostgreSQL—mind-blowing!
- Build AI Agents: In “Agents,” create an agent to automate tasks (e.g., summarize Slack messages). Use the GUI to configure it with your data sources.
- Schedule Jobs: Use “Jobs” to automate queries (e.g., daily sales reports). Example:
CREATE JOB daily_sales_report AS
SELECT city, AVG(price)
FROM demo_postgres_db.house_sales
GROUP BY city
EVERY 1 day;
- Customize: Fork the GitHub repo (github.com/mindsdb/mindsdb) to tweak the MCP server or add connectors.
Documenting Your APIs with APIdog
Using MindsDB’s MCP server and want to share its APIs? APIdog is a stellar tool for creating interactive API documentation. Its user-friendly interface and self-hosting options make it ideal for documenting your MindsDB workflows—check it out!

Troubleshooting and Tips
- Connection Issues: If the GUI doesn’t load, check Docker logs (
docker logs mindsdb
) and ensure ports 47334/47335 are open (netstat -tulpn | grep 47334
on Linux). - Data Source Errors: Verify database credentials. For the demo, use exact parameters from above.
- Performance: For large datasets, use a machine with 8GB+ RAM or deploy on a cloud server.
- Community: Join MindsDB’s Slack or GitHub Discussions for help. Report bugs on GitHub.

Why Choose MindsDB?
MindsDB is a data nerd’s dream:
- Unified Access: Query 200+ sources like one database, saving hours of wrangling.
- AI-Powered: Natural language queries and RAG make insights instant.
- Open-Source: Free, customizable, and community-driven with 28K+ stars.
- MCP Server: Seamlessly connects AI apps to federated data, no ETL needed.
I queried Slack and PostgreSQL together and felt like a data superhero—no more late-night ETL runs!
Wrapping Up: Unleash Your Data with MindsDB
You’ve just set up MindsDB, connected a database, and queried data like a pro! With its MCP server, MindsDB makes accessing 200+ sources a breeze, whether you’re building AI apps or hunting insights. Try connecting more sources, building agents, or documenting your APIs with APIdog! Happy querying