Database MCP Server: Give Claude Code Direct Access to Your Data
Queryline's built-in MCP server lets Claude Code browse schemas, run queries, and create analytical notebooks — all from your terminal. One toggle, one command, free.
Your AI coding assistant can write migrations, debug queries, and explain joins. But ask it about the actual data in your database and it's guessing. It can't see your schema. It doesn't know your column names. It has no idea that your users table has a deleted_at field that half your team forgets to filter on.
That changes today. Queryline now ships with a built-in MCP server that gives Claude Code (and any MCP-compatible tool) direct, read-only access to your databases.
What is MCP?
MCP (Model Context Protocol) is an open standard that lets AI assistants connect to external tools. Instead of copying and pasting your schema into a chat window, your assistant connects to an MCP server and gets structured access to real data.
Think of it like a USB port for AI. The assistant provides the intelligence. The MCP server provides the data. Neither needs to know how the other works internally.
What Queryline Exposes
Queryline's MCP server includes 14 tools across three categories:
Database Exploration
Your assistant can browse your databases the same way you would in the GUI:
- list_connections — see all your configured databases
- connect — connect to a specific database
- list_schemas — explore schemas in a connected database
- list_tables — list tables in a schema
- describe_table — get columns, primary keys, foreign keys, and indexes
- sample_data — preview rows from any table
This means your assistant can answer questions like "what columns does the orders table have?" or "show me the foreign key relationships in the billing schema" without you copying anything.
Read-Only Queries
- query — execute SELECT statements against your database
Mutations are blocked. Every query is read-only with an automatic LIMIT of 1,000 rows. Your production data stays safe while your assistant gets the context it needs to write better code.
Ask it to "find all users who signed up in the last 7 days but haven't created a project" and it will write and run the query against your actual database, not a hallucinated schema.
Spaces — Analytical Notebooks
This is where it gets interesting. Queryline has a feature called Spaces — persistent analytical notebooks where you can import tables, write SQL, and document your findings. The MCP server exposes these too:
- list_spaces — see existing Spaces
- create_space — create a new Space
- get_space — get the full Space definition
- import_table — pull a table from any connection into a Space
- add_sql_cell — add a SQL query cell
- add_markdown_cell — add documentation
- execute_cell — run a query and get results
So you can tell Claude Code: "Create a Space that analyzes our monthly active users trend, import the users and sessions tables, and build a report." It will create the notebook, import data, write the SQL cells, add markdown documentation, and execute everything — giving you a persistent, shareable analytical report.
Setup: One Toggle, One Command
In Queryline, open Settings and enable the MCP server. That's it on the app side.
Then connect from your terminal:
claude mcp add --transport http queryline http://localhost:7865/mcp
Your next Claude Code session will have full database access through Queryline.
The server uses token-based authentication — Queryline generates a token when you enable the MCP server, and it's included automatically when you connect. No credentials are exposed to the AI assistant. Your database passwords stay in macOS Keychain where they belong.
Why This Is Free
Most database tools that add AI features charge extra for them. That makes sense when they're running their own LLM or embedding model. But MCP flips the architecture: the intelligence comes from your AI assistant (Claude Code, Cursor, Windsurf — whatever you use). Queryline just opens the door to your data.
There's no AI model running inside Queryline. No API costs to pass on to you. The MCP server is a thin layer that translates your assistant's requests into database operations. It's infrastructure, not intelligence — so it's free.
This is the whole point of MCP as a protocol. Your tools expose capabilities. Your AI provides the reasoning. Nobody needs to reinvent the wheel, and nobody needs to charge you twice.
What You Can Actually Do
Here are real workflows that work right now:
Debug data issues: "Why is user 4521's subscription showing as expired? Check the subscriptions table and the payments table."
Understand unfamiliar schemas: "I just joined this project. Walk me through the database schema and explain how orders relate to invoices."
Write migrations with context: "Add a last_login_at column to the users table. Show me the current schema first so we don't break anything."
Build reports: "Create a Space that tracks weekly signups by referral source. Import the users table, write the aggregation queries, and add a description of what each metric means."
Review data before deploys: "Before I deploy this migration, sample 10 rows from the affected tables so I can verify the data looks right."
Supported Databases
Queryline supports PostgreSQL, MySQL, and SQLite — so the MCP server works with all three. Connect to your local dev database, a staging server, or (carefully) production. The read-only enforcement means you can point it at production without worrying about accidental writes.
Getting Started
- Download Queryline if you haven't already (free, macOS)
- Add your database connections
- Enable the MCP server in Settings
- Run
claude mcp add --transport http queryline http://localhost:7865/mcp - Start a Claude Code session and ask about your data
14 MCP tools, token-based auth, read-only by default. Built with Rust for reliability, shipped in ~3,000 lines of code.
Queryline is a free, native database client for macOS supporting PostgreSQL, MySQL, SQLite, and Firestore. View on GitHub.