query
Run a read-only SQL query
One read-only SQL tool over a Postgres database, with nothing else in the way.
LABSCO SUMMARY
There is a single tool, query, taking a sql string, and the description says read-only and stops there. Anything a client might otherwise reach through a typed helper — which tables exist, what a column holds, how large a result will be — has to be written as SQL and sent through that same call, so the model's SQL is the interface. The trade reads cleanly in both directions: nothing here can write, and nothing here will describe the schema for you either.
A single-tool PostgreSQL server: query takes a sql string and runs it read-only against the database named in the connection string the server was started with.
A PostgreSQL database you can reach and its connection string; the server itself takes no separate credentials.
One command — docker run -i --rm mcp/postgres postgresql://host.docker.internal:5432/mydb
USE CASES
Write the SQL, send it, read the rows back — the connection is already fixed to one database and nothing here can write to it.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
queryRun a read-only SQL query
BEFORE YOU INSTALL
1 tool when we connected.
docker on PATH
CONTEXT COST
Rated by the size of the one tool definition that rides along on every turn
INSTALLATION
Add the block to your client, or run the command directly.
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"
]
}
}
}docker run -i --rm mcp/postgres postgresql://host.docker.internal:5432/mydb