MCP Server Studio
Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.
Registry name: io.github.Eszetael/postgres-mcp-hardened
Add to claude_desktop_config.json:
{
"mcpServers": {
"postgres-mcp-hardened": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>",
"MCP_STATEMENT_TIMEOUT": "<MCP_STATEMENT_TIMEOUT>",
"MCP_ALLOW_TABLES": "<MCP_ALLOW_TABLES>",
"MCP_AUDIT_LOG": "<MCP_AUDIT_LOG>"
}
}
}
}Run in your terminal:
claude mcp add postgres-mcp-hardened -e DATABASE_URL='<DATABASE_URL>' -e MCP_STATEMENT_TIMEOUT='<MCP_STATEMENT_TIMEOUT>' -e MCP_ALLOW_TABLES='<MCP_ALLOW_TABLES>' -e MCP_AUDIT_LOG='<MCP_AUDIT_LOG>' -- npx -y [email protected]Add to .cursor/mcp.json:
{
"mcpServers": {
"postgres-mcp-hardened": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>",
"MCP_STATEMENT_TIMEOUT": "<MCP_STATEMENT_TIMEOUT>",
"MCP_ALLOW_TABLES": "<MCP_ALLOW_TABLES>",
"MCP_AUDIT_LOG": "<MCP_AUDIT_LOG>"
}
}
}
}Add to .vscode/mcp.json:
{
"servers": {
"postgres-mcp-hardened": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>",
"MCP_STATEMENT_TIMEOUT": "<MCP_STATEMENT_TIMEOUT>",
"MCP_ALLOW_TABLES": "<MCP_ALLOW_TABLES>",
"MCP_AUDIT_LOG": "<MCP_AUDIT_LOG>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"postgres-mcp-hardened": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>",
"MCP_STATEMENT_TIMEOUT": "<MCP_STATEMENT_TIMEOUT>",
"MCP_ALLOW_TABLES": "<MCP_ALLOW_TABLES>",
"MCP_AUDIT_LOG": "<MCP_AUDIT_LOG>"
}
}
}
}| Name | Required | What it is |
|---|---|---|
DATABASE_URL | Yes | Connection string for the role the server connects as. Use a role that cannot write — the server refuses writes twice, but a read-only role is the layer that does not depend on us being correct… |
MCP_STATEMENT_TIMEOUT | No | Server-side statement timeout, e.g. `5s`. A question that would pin the database is cancelled by PostgreSQL, not by hope. |
MCP_ALLOW_TABLES | No | Comma-separated allowlist. A table off the list is refused by name, and hiding it inside a CTE, a view or a join does not help. |
MCP_AUDIT_LOG | No | Path to the tamper-evident audit log. Entries are chained by hash and survive a restart; `--verify-audit` checks the chain against an off-host anchor. |