Back to MCPs
Official
Featured
Config Required
PostgreSQL
A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables Claude to inspect database schemas and execute read-only queries.
databasesqlofficial
2,341 upvotes
89,500 views
by Anthropic
Required Environment Variables
Set these environment variables before using this MCP server:
DATABASE_URL Installation
npx -y @modelcontextprotocol/server-postgres postgres://localhost/mydb
Note: Replace placeholder values (e.g., connection strings, paths) with your own configuration.
How to add to Claude Code
- Open Claude Code settings
Run
claude configor edit~/.claude/config.json - Add the MCP server configuration
{ "mcpServers": { "postgres": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "postgres://localhost/mydb" ] } } }Update the placeholder values above with your actual configuration.
- Restart Claude Code
The MCP server will now be available in your sessions