Connect Claude to PostgreSQL databases for schema inspection, query execution, and database analysis with read-only safety defaults.
MCP (Model Context Protocol) servers extend Claude's capabilities with external tools and data sources. They provide access to databases, APIs, file systems, and more. Configure MCP servers in .mcp.json or add them via `claude mcp add` command.
Option 1 - CLI Command: claude mcp add postgres -- npx -y @anthropic-ai/mcp-server-postgres "postgresql://user:password@localhost/dbname" Option 2 - Add to .mcp.json Security: By default, the server operates in read-only mode. Replace the connection string with your actual database credentials.
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@anthropic-ai/mcp-server-postgres",
"postgresql://user:password@localhost/dbname"
]
}
}
}Manage Docker containers and images. List, start, stop containers, view logs, and inspect container configurations.