Postgres MCP server
Postgres MCP server. Exposed over MCP by the mcp postgresql demo mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.
A FastMCP server that enables LLMs to connect and interact with PostgreSQL databases. This project demonstrates how to use the Model Context Protocol (MCP) to allow Language Models to query and explore database schemas and tables.
Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.
Everything the assistant can do here goes through one of these:
query_database — Execute SQL queries against the database (SELECT queries only)You will need 6 environment variables: APP_NAME, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.
Plenty of database access servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. MCP PostgreSQL Demo's toolset — query_database — is a fair guide to whether it matches your workflow. It is maintained by Tibiritabara; worth a glance at recent repository activity before you build anything load-bearing on it.
SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.
| Tool | What it does |
|---|---|
| query_database | Execute SQL queries against the database (SELECT queries only) |
{
"mcpServers": {
"postgres-mcp-server": {
"command": "/path/to/your/venv/bin/mcp",
"args": ["run", "/path/to/your/postgres-mcp/src/main.py"],
"env": {
"APP_NAME": "mcp-demo",
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_USER": "postgres",
"DB_PASSWORD": "postgres",
"DB_NAME": "postgres"
}
}
}
}Configuration as documented by the project. Restart the client after saving.
| Variable | Description | Required |
|---|---|---|
| APP_NAME | Configuration value read at startup. | Optional |
| DB_HOST | Endpoint or connection string the server talks to. | Optional |
| DB_PORT | Configuration value read at startup. | Optional |
| DB_USER | Configuration value read at startup. | Optional |
| DB_PASSWORD | Configuration value read at startup. | Optional |
| DB_NAME | Configuration value read at startup. | Optional |
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.