pg-readonly-mcp
A read-only Postgres MCP server that parses SQL rather than pattern-matching it. It uses sqlglot to build a syntax tree to ensure only read shapes (SELECT, UNION, etc.) are allowed and checks that the database connection role lacks write privileges, preventing the bypass found in the official Anthropic reference server.
Package and access
Local package with source-attributed installation metadata. Koskamo does not execute packages during review.
What you can do with it
- Allow AI agents to query Postgres databases safely
- Prevent accidental data modification by agents
- Audit database schema and data without write risks
Source and maintenance
- Maintenance checked
Packages and installation
Source-provided package data. Koskamo has not executed or live-probed this package.
pg-readonly-mcp 0.1.1
{
"version": "0.1.1",
"transport": "stdio",
"identifier": "pg-readonly-mcp",
"registryType": "pypi",
"environmentVariables": [
{
"name": "PG_READONLY_MCP_DSN",
"format": "string",
"isRequired": true,
"description": "Postgres connection string for a role that holds only SELECT. The server refuses to start otherwise."
}
]
}Tools
Reported by the attributed source; not independently observed by Koskamo.
Connect from your client
Each snippet configures the same source-provided package; replace placeholders before use.
Cursor
{
"mcpServers": {
"pg-readonly-mcp": {
"command": "uvx",
"args": [
"pg-readonly-mcp==0.1.1"
],
"env": {
"PG_READONLY_MCP_DSN": "<YOUR_PG_READONLY_MCP_DSN>"
}
}
}
}Cline
{
"mcpServers": {
"pg-readonly-mcp": {
"command": "uvx",
"args": [
"pg-readonly-mcp==0.1.1"
],
"env": {
"PG_READONLY_MCP_DSN": "<YOUR_PG_READONLY_MCP_DSN>"
}
}
}
}VS Code
{
"servers": {
"pg-readonly-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"pg-readonly-mcp==0.1.1"
],
"env": {
"PG_READONLY_MCP_DSN": "<YOUR_PG_READONLY_MCP_DSN>"
}
}
}
}Claude Desktop
{
"mcpServers": {
"pg-readonly-mcp": {
"command": "uvx",
"args": [
"pg-readonly-mcp==0.1.1"
],
"env": {
"PG_READONLY_MCP_DSN": "<YOUR_PG_READONLY_MCP_DSN>"
}
}
}
}Let your agent find its tools
Find servers like pg-readonly-mcp from your agent. Add Koskamo once to search the index for endpoints, access requirements, and client setup. Public discovery needs no key.