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.
Built with TypeScript, the official MCP SDK, and pg. Exposes a Streamable HTTP endpoint so it can be used remotely or locally with Claude Desktop / Claude Code.
โจ What it does
Once connected, you can ask Claude things like:
"What tables do I have?"
"Show me the last 10 rows from orders"
"Insert a new user with email test@example.com"
"Update order 42 to status shipped"
"Delete all sessions where status = expired"
Related MCP server: CnosDB MCP Server
๐ ๏ธ 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. Clone and install
git clone https://github.com/santisanti13/postgres-mcp-server.git
cd postgres-mcp-server
npm install2. Configure your database
Set the DATABASE_URL environment variable to point to your Postgres instance:
export DATABASE_URL=postgresql://localhost/your_database3. Build and run
npm run build
DATABASE_URL=postgresql://localhost/your_database npm startThe server starts at http://localhost:3000/mcp.
๐ Connect to Claude
Claude Desktop / Claude Code
Add to your MCP config:
{
"mcpServers": {
"postgres": {
"url": "http://localhost:3000/mcp"
}
}
}Restart Claude and start asking questions about your database in plain language.
๐งช Test it manually
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Should return the list of available tools.
โ ๏ธ 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.
๐๏ธ Built with
TypeScript + Express
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
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