askLABSCO SUMMARY
Natural-language SQL with the writes taken away.
Read-only enforcement at the transaction level is what makes this safe to point at a real database: the worst a wrong query does is return the wrong rows. Schema caching and case-sensitivity handling cover the two things that most often break generated SQL, and failures come back as feedback the agent can act on.
What it is
A Go server that sits in front of an existing PostgreSQL database, turns natural-language questions into SQL, and returns the rows. It assumes nothing about your schema and requires no changes to it.
What you get
- ask takes a plain-language question, generates SQL against your schema and returns the result, streaming automatically when the result set is large
- search does free-text search across the database's text columns
- stream handles very large result sets with pagination
- Every query runs in a read-only transaction, so writes and schema changes are blocked outright
- Query timeouts and input validation, so a bad question cannot pin the database
- Mixed-case table names are handled correctly, which is where naive SQL generation usually falls over
- When the generated SQL is wrong it comes back with the offending statement and a suggestion instead of crashing
- A bundled client returns results as a table, JSON or CSV
Requirements
An existing PostgreSQL database and its connection string. SQL generation calls a model, so an API key for it; without one the natural-language path is unavailable. Prebuilt binaries, a container image and Kubernetes manifests are provided, and bearer-token authentication can be switched on for the HTTP endpoint.
Setup effort
Follow the published steps — tar xzf pgmcp_*.tar.gz
USE CASES
Answering a data question without writing the join
Ask in plain language and get the rows, with the generated SQL visible when you need to check it.
Finding a record when you only remember a name
Search across every text column instead of guessing which table holds it.
Exporting a large result
Let the query stream and page through the rows rather than trying to return them all at once.
Letting someone query production safely
Every statement runs in a read-only transaction, so exploratory questions cannot change anything.
3 tools
Listed in project docs. Your client may show a different list.
searchstreamBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation. Write queries (INSERT, UPDATE, DELETE) are blocked. Without OPENAI_API_KEY, ask cannot turn English questions into SQL.
Requires
DATABASE_URL in your environment
Optional
OPENAI_API_KEY in your environment
INSTALLATION
Connect your client
Server setup
Go to https://github.com/subnetmarco/pgmcp/releases and download the binary for your platform
tar xzf pgmcp_*.tar.gz
cd <YOUR_PGMCP_KEY>
export DATABASE_URL="postgres://user:password@localhost:5432/<YOUR_EXISTING_DB>"
export OPENAI_API_KEY="<YOUR_OPENAI_API_KEY>" # Optional
./pgmcp-serverMCP Clients
Cursor
{
"mcpServers": {
"pgmcp": {
"url": "http://localhost:8080/mcp"
}
}
}pgmcp-client
./pgmcp-client -ask "What tables do I have?" -format tableOther routes
Run with Docker
docker run -e DATABASE_URL="postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@<YOUR_DB_HOST>:5432/<YOUR_DB_NAME>" -p 8080:8080 ghcr.io/subnetmarco/pgmcp:latest