Complete AI Training

MCP server · Analytics

SQL Query MCP server

by andyWang1688

Let your AI look at your PostgreSQL, MySQL, or Hive database and run safe read-only questions for you.

Flow diagram: you ask your AI “How many customers signed up last month?”, on your own computer the SQL Query MCP server works with your database, and you get back answer in the chat.

This is a small helper that lets your AI assistant look inside a database and answer questions about the data, without ever changing it. It works with PostgreSQL, MySQL, and Hive. It is handy if you often need numbers or lists from a database but don't want to write SQL yourself.

What is an MCP server? The 30-second version

On its own, your AI can only chat. An MCP server is a small helper program that gives your AI a new skill or a connection to an app. This one connects your AI to your database, so when you ask a question, the AI can look up the tables and run a safe read-only query for you. You stay in the chat, and the helper does the database work behind the scenes.

What this MCP server does

You ask your AI something like "how many customers signed up last month". The AI uses this helper to see which tables exist and what columns they have. Then it runs a read-only query, meaning it can only look, not change anything. The helper checks the query is safe first, runs it, and hands the result back. Your AI then explains the answer in plain words in the chat.

Flow diagram: you ask your AI “How many customers signed up last month?”, on your own computer the SQL Query MCP server works with your database, and you get back answer in the chat. Click to zoom

What you can do with it

  • List the databases and tables your AI can see
  • Describe a table's columns, keys, and indexes
  • Run short read-only queries and get results back
  • Start long queries in the background and fetch results later
  • Check how a query would run with a query plan
  • Grab a small sample of rows from a table
  • Export query results to a CSV or Excel file on your machine
  • Import a prepared CSV or Excel file into an existing table

Try asking your AI

  • “What tables are in the crm database?”
  • “Show me the columns of the orders table.”
  • “How many orders were placed last week?”
  • “Give me a sample of 10 rows from the customers table.”
  • “Explain how this query would run: SELECT * FROM orders WHERE status = 'paid'”

What it gives back to you

You get answers in the chat: lists of tables, column names, small samples of rows, counts, and short summaries. For longer queries, your AI can show the results page by page. If you ask for an export, it writes a CSV or Excel file on the machine where the helper runs, and tells you where it saved it.

Before you start

What you need

  • Python 3.10 or newer
  • pipx installed (a tool that installs Python apps cleanly)
  • A config file listing your database connections
  • Your database connection details, stored as environment variables (a kind of password your AI client passes in)

Good to know

It can write files on the machine where it runs and can import a CSV or Excel file into an existing table, so point it only at databases and folders you are comfortable with.

Install it with your AI

Add SQL Query MCP server to your AI, no technical skills needed

You don't install anything by hand. You copy one prompt, paste it into an AI that can work on your computer, and it checks, installs and connects the server for you, asking you when it needs something.

Sign in to get the install prompt

Members get a ready-made prompt that lets the Claude desktop app check SQL Query MCP server, install it and connect it for them, step by step. You don't need any technical skills: you copy, paste and answer a few questions. Your connected AI can also find and install any of the 4,066 MCP servers here for you.

Sign in Become a member

Who it's for

Anyone who needs quick answers from a PostgreSQL, MySQL, or Hive database but doesn't want to write SQL, like analysts, support staff, and operations people.