query-postgresLABSCO SUMMARY
A read-only window onto a live database.
The validation and the timeout are the whole design: an agent can explore real data and answer questions from it with no path to writing, and no runaway query holding a connection open.
What it is
An MCP server with one tool that runs SELECT queries against a PostgreSQL database. The connection string is passed on the command line when the client launches it, queries are validated so that only SELECT gets through, and anything still running after 10 seconds is cut off.
What you get
- A SELECT query executed against your database, with its rows returned
- Statements other than SELECT rejected before they reach the database
- A 10 second timeout on every query
Requirements
Node.js v14 or later, and a PostgreSQL connection string passed as an argument in the client config - it sits in that file in plain text, so point it at a role that only has read access. Build once with npm run build; the client then launches dist/index.js.
Setup effort
Build from source — git clone https://github.com/RathodDarshil/mcp-postgres-query-server.git
USE CASES
Answering a data question without writing the SQL yourself
Ask in words; the query is composed, run and the rows come back.
Exploring a schema you have not seen before
Query the catalogue tables the same way you would query the data.
Checking whether the data matches what the app is showing
Read the rows directly instead of trusting the screen.
Building a one-off report from a table you rarely touch
Iterate on the query in conversation until the numbers are right.
Letting an agent look at real data without risking a write
Only SELECT passes validation, so the worst outcome is a wrong answer rather than a changed row.
1 tool
Listed in project docs. Your client may show a different list.
BEFORE YOU INSTALL
What to know first
Tools you get
1 tool named in the project's documentation.
Requires
Node.js
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
# Clone the repository
git clone https://github.com/RathodDarshil/mcp-postgres-query-server.git
cd mcp-postgres-query-server
# Install dependencies
npm install
# Build the project
npm run buildMCP Clients
Claude Desktop
{
"mcpServers": {
"postgres-query": {
"command": "node",
"args": [
"<YOUR_PATH_TO_MCP_POSTGRES_QUERY_SERVER>/dist/index.js",
"postgresql://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@<YOUR_DB_HOST>:<YOUR_DB_PORT>/<YOUR_DB_NAME>"
]
}
}
}