read-only-local-postgres-mcp-server — Claude Code MCP server
Connect PostgreSQL to an agent over MCP and run queries that cannot write to the database. Useful for asking questions about tables and records in plain language.
claude mcp add read-only-local-postgres-mcp-server -- npx -y @hovecapital/read-only-postgres-mcp-serverWhat read-only-local-postgres-mcp-server does
This MCP server lets Claude Code query PostgreSQL and returns results as JSON. You can switch database connections at runtime. Set DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD as environment variables for the connection.
Before a query runs, the server validates its SQL and uses a transaction marked READ ONLY. Writes through this connection are blocked. You need Node.js version 16 or later and a PostgreSQL server; with mise, configure the full path to the Node.js executable.
What it helps with
- inspect the tables in a PostgreSQL database
- retrieve database records through natural-language requests
- run SQL that cannot modify data
- switch to another database connection at runtime
Example prompts for the agent
- List the tables in my PostgreSQL database.
- Show rows from
customerswithout changing anything. - Connect to another PostgreSQL database and find its order tables.
How to install read-only-local-postgres-mcp-server
Platform CLI
claude mcp add read-only-local-postgres-mcp-server -- npx -y @hovecapital/read-only-postgres-mcp-serverPlatform CLI
codex mcp add read-only-local-postgres-mcp-server -- npx -y @hovecapital/read-only-postgres-mcp-serverConfig file
{
"mcpServers": {
"read-only-local-postgres-mcp-server": {
"command": "npx",
"args": [
"-y",
"@hovecapital/read-only-postgres-mcp-server"
]
}
}
}Config file
{
"servers": {
"read-only-local-postgres-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@hovecapital/read-only-postgres-mcp-server"
]
}
}
}Platform CLI
gemini mcp add read-only-local-postgres-mcp-server npx -y @hovecapital/read-only-postgres-mcp-serverStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about read-only-local-postgres-mcp-server
How do I install read-only-local-postgres-mcp-server in Claude Code?
Run claude mcp add read-only-local-postgres-mcp-server -- npx -y @hovecapital/read-only-postgres-mcp-server, set the PostgreSQL connection environment variables, then restart Claude Code.
What does read-only-local-postgres-mcp-server do?
It gives Claude Code an MCP connection for querying PostgreSQL and returns the results as JSON. SQL is validated, and queries run in read-only transactions.
What does the server need to run?
It requires Node.js version 16 or later, a PostgreSQL server, and connection settings for the host, port, database, username, and password.