LABSCO SUMMARY
Give it a read-only role and the rest takes care of itself.
Direct query execution is the most useful thing you can hand an assistant that is writing code against a schema, and also the sharpest — this server does not restrict statements, so the database role you connect with is the boundary. Parameterised queries and connection pooling are the right foundations; the certificate path is there for managed databases that will not take an unencrypted connection.
What it is
An MCP server that executes SQL queries against a PostgreSQL database. It takes a connection string, keeps a pool open, and runs the queries a model composes — built with the Cursor agent chat in mind, so the database becomes context the assistant can consult while writing code.
What you get
- Custom SQL executed against the connected database
- Parameterised queries, so values are bound rather than concatenated into the statement
- Configurable timeouts on query execution
- Connection pooling with connection timeouts and connection-string validation
- TLS supported through
POSTGRES_SSL_CERT_PATH, for databases that require a certificate
Requirements
Node.js 18.0.0 or higher, a reachable PostgreSQL server, and network access to it. Install through the Smithery CLI in one command, or clone the repository and run npm install then npm run build and point the client at the built entry point. The connection string goes in POSTGRES_CONNECTION_STRING; the package is postgresql-mcp-server, version 0.2.0.
Setup effort
One command plus credentials — npx -y @smithery/cli install @1Levick3/postgresql-mcp-server --client claude, then supply credentials
USE CASES
Checking a schema while writing code against it
Query the real tables in the editor instead of guessing at column names.
Answering a data question without a client
Run the SELECT in the conversation and read the rows back inline.
Testing a query before it goes in the codebase
Execute it with bound parameters and see what actually comes back.
Connecting to a managed database that requires TLS
Point the certificate path at the root certificate and connect over an encrypted link.
BEFORE YOU INSTALL
What to know first
Requires
- Node.js >= 18.0.0
- POSTGRES_CONNECTION_STRING in your environment
Optional
POSTGRES_SSL_CERT_PATH in your environment
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
Build from source
git clone https://github.com/1Levick3/postgresql-mcp-server.git
cd postgresql-mcp-server
npm install
npm run buildnpx
npx -y @smithery/cli install @1Levick3/postgresql-mcp-server --client claudeMCP Clients
Claude Desktop
{
"mcpServers": {
"postgresql-mcp": {
"command": "node",
"args": [
"/Users/1Levick3/Desktop/postgresql-mcp-server/build/index.js"
],
"disabled": false,
"alwaysAllow": [],
"env": {
"POSTGRES_CONNECTION_STRING": "<YOUR_POSTGRES_CONNECTION_STRING>",
"POSTGRES_SSL_CERT_PATH": "/Users/1levick3/Desktop/root.crt"
}
}
}
}For the manual install. /Users/1Levick3/Desktop/postgresql-mcp-server is the author's own folder; yours is the full path of your own clone. <YOUR_POSTGRES_CONNECTION_STRING> is your PostgreSQL connection string. POSTGRES_SSL_CERT_PATH is optional: point it at your database's CA certificate, or remove the line if you don't need one.
The path /Users/1Levick3 in the block above is on the machine of whoever wrote it, not on yours.