postgres-mcp-server
Provides tools for listing tables, describing tables, selecting rows, inserting rows, updating rows, and deleting rows in a PostgreSQL database using natural language.
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., "@postgres-mcp-serverlist all tables in the database"
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.
postgres-mcp-server
An MCP (Model Context Protocol) server that lets Claude query and manipulate a PostgreSQL database using natural language.
Architecture
User (natural language) → Claude → Your MCP Server → PostgreSQL
│
pool.query()
│
information_schema
+ your tablesClaude never talks to Postgres directly. It calls a tool (e.g. select_rows),
the MCP server validates and parameterizes the request, runs it against
pg, and returns the result as text Claude can reason about and present back
to the user.
Related MCP server: mcp-sequel
Tools
Tool | Description |
| List all tables in the |
| Show columns, types, nullability and defaults for a table |
| SELECT rows with optional |
| INSERT a row, returns the inserted record |
| UPDATE rows matching a |
| DELETE rows matching a |
Setup
1. Install dependencies
git clone https://github.com/santisanti13/postgres-mcp-server.git
cd postgres-mcp-server
npm install2. Environment variables
DATABASE_URL=postgresql://user:pass@host:5432/db
PORT=30003. Build and run
npm run build
npm startThe server starts at http://localhost:3000/mcp.
Connect to Claude
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:3000/mcp"]
}
}
}Usage example
User: What tables do I have, and show me the last 5 rows of "orders"
Claude calls: list_tables({})
→ Returns: ["customers", "orders", "products", ...]
Claude calls: select_rows({ table: "orders", limit: 5, order_by: "created_at desc" })
→ Returns: [{ id: 102, customer_id: 7, total_cents: 4900, ... }, ...]
Claude presents the results as a formatted table.User: Mark order 42 as shipped
Claude calls: update_rows({
table: "orders",
data: { status: "shipped" },
where: "id = 42"
})
→ Returns: "Updated 1 row(s)."Tech stack
Node.js + TypeScript
@modelcontextprotocol/sdk— MCP serverpg— PostgreSQL clientexpress— HTTP transport (Streamable HTTP)
Notes
This server gives Claude read and write access to your database. Use a dedicated database/user with restricted permissions for production use.
update_rowsanddelete_rowsaccept raw SQLWHEREclauses — be careful when granting access to untrusted clients.
Related projects
ads-waste-auditor-mcp— a companion MCP that audits ad spend (Google Ads / Meta Ads via Windsor.ai) for wasted budget, simulates reallocation, and pauses underperforming entities.
About
mcp conversational inputs & outputs over PostgreSQL.
Author
Built by Santi — SaaS builder, EdTech & GovTech.
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.
Latest Blog Posts
- 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/santisanti13/postgres-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server