mcp-postgres
Allows querying and inspecting a PostgreSQL database schema, including listing tables, describing columns, and executing read-only SQL queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-postgresshow me the columns of the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-postgres
An MCP server that connects to a PostgreSQL database and exposes schema inspection and safe query execution as tools and resources — ready to plug into Claude Desktop or any MCP-compatible client.
Tools
Tool | Description |
| List all tables in the public schema |
| Show columns, types, and nullability for a table |
| Execute a SELECT query and return results (mutating statements are blocked) |
Related MCP server: @yawlabs/postgres-mcp
Resources
URI | Description |
| Full schema dump — all tables with their columns |
Setup
1. Clone and install
git clone <repo-url>
cd mcp-postgres
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .2. Configure environment
cp .env.example .env
# Edit .env — set DATABASE_URL to your PostgreSQL connection string3. Run the server
mcp-postgresOr directly:
python -m mcp_postgres.serverClaude Desktop Integration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"postgres": {
"command": "/path/to/.venv/bin/mcp-postgres",
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
}
}
}
}Project Structure
src/mcp_postgres/
__init__.py — package marker
db.py — psycopg2 connection context manager
server.py — FastMCP server, tools, and resourcesSecurity
run_query rejects any statement that does not begin with SELECT. This prevents accidental or malicious data modification through the MCP interface.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables natural language querying of PostgreSQL databases through the Model Context Protocol. It translates user questions into validated SQL, executes read-only queries safely, and returns results to MCP-compatible clients like Claude Desktop.-
- AlicenseAqualityAmaintenanceQuery and manage PostgreSQL databases from Claude Code, Cursor, and any MCP client, with read-only by default and built-in schema introspection, EXPLAIN, and performance diagnostics.237,1394MIT
- AlicenseAqualityBmaintenanceExposes PostgreSQL query execution, EXPLAIN, and schema inspection tools to MCP-compatible clients like Claude Desktop.31MIT
- FlicenseNot gradedqualityDmaintenanceConnects AI assistants to PostgreSQL databases, enabling schema inspection and SQL query execution through MCP tools.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/garvjoshi1111/mcp-postgres'
If you have feedback or need assistance with the MCP directory API, please join our Discord server