MCP server for getting schema information from a PostgreSQL database
Mcp pg schema mcp server connects MCP Pg Schema to AI assistants that speak the Model Context Protocol. MCP server for getting schema information from a PostgreSQL database.
A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
Once connected, the assistant can call these 4 tools directly:
query — Execute read-only SQL queries against the connected databaseInput — sql (string): The SQL query to executeTools — The Tools tool exposed by this serverResources — The server provides schema information for each table in the database:Setup follows the standard MCP pattern: clone or install the server, then register it in your client's configuration file and restart the client. The configuration snippets on this page cover Claude Desktop, Claude Code and Cursor.
Database servers turn schema archaeology and ad-hoc reporting into conversation, which is why they tend to be the second or third server people install. MCP Pg Schema sits in that group, and the shape of its toolset — query, Input, Tools among others — tells you what it is really for. Worth comparing against the other databases servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.
| Tool | What it does |
|---|---|
| query | Execute read-only SQL queries against the connected database |
| Input | sql (string): The SQL query to execute |
| Tools | The Tools tool exposed by this server. |
| Resources | The server provides schema information for each table in the database: |
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"]
}
}
}Configuration as documented by the project. Restart the client after saving.
Read-only SQL access to Postgres — let your assistant inspect schemas and answer questions from real data.
Manage your whole Supabase project in conversation — database, auth, storage, Edge Functions and branches.
Query, modify and analyse local SQLite databases in conversation — the fastest way to chat with a data file.
Metabase ships its own MCP endpoint — search your BI content, build and run queries, and save questions and dashboards without leaving the chat.
Official MongoDB server covering data, schemas and Atlas management — from find queries to spinning up clusters.
Serverless Postgres with database branching — point your assistant at Neon and let it work on disposable copies.