postgres-mcp
Click on "Deploy 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 show me the first 5 rows from the orders 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.
Getting started
Setup
Create .env file with your postgres db vars
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "<table>",
"DB_USER": "<user>",
"DB_PASSWORD": "<password>"npm inpm run buildEnsure your server script is executable:
chmod +x ./dist/server.js
Ensure the shebang line at the top of your compiled server.js:
#!/usr/bin/env node
Setup cursor mcp server:
In cursor go to: Settings > MCP Servers
{
"mcpServers": {
"postgres": {
"command": "node",
"args": ["./dist/server.js"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "<db_name>",
"DB_USER": "<db_user>",
"DB_PASSWORD": "<password>"
}
}
}
}To test run in terminal:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | node dist/server.jsOnce you add it in cursor settings, restart cursor and then reopen and make sure it loads
To chat
Start a new chat and tell it to use your MCP server
Give me the first record in the table
Do not read my local code files - use the database MCP server instead.
Available Tools
3 toolsdescribe_tableC
Get the schema of a specific table
Inputs: table_name (required).
list_tablesA
List all tables in the database
Inputs: no named parameters.
query_databaseC
Execute a SQL query on the PostgreSQL database
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have clearly distinct purposes: listing tables, describing a table's schema, and executing arbitrary SQL. There is no overlap in their intended use, making selection unambiguous.
All tools follow a consistent snake_case verb_noun pattern (describe_table, query_database, list_tables). This is predictable and readable.
Three tools is minimal but appropriate for a database query interface; each tool serves a distinct, necessary function. The count is slightly low but well-scoped.
The set covers the core workflow of exploring and querying a database: list tables, inspect schema, and run SQL (which can handle reads and writes). Some auxiliary functions like listing schemas or databases are absent but can be achieved via query_database.
Maintenance
Related MCP Connectors
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with PostgreSQL databases through MCP tools, with GitHub OAuth authentication and role-based access control.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with PostgreSQL databases through a standardized MCP interface, supporting SQL queries, schema inspection, and database management.MIT
- AlicenseNot gradedqualityDmaintenanceAsk your database questions in plain English. Connects PostgreSQL databases to MCP clients and answers with real, structured data instead of guesses.MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language querying of PostgreSQL via MCP, combining SQL, vector search, and knowledge graph with automatic routing and token-aware curation.Apache 2.0