The official PostgreSQL MCP server provides safe, read-only access to PostgreSQL databases.
npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost/db
{
"mcpServers": {
"postgres": {
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://user:pass@localhost/db"
],
"command": "npx"
}
}
}Get schema definition of a table
{
"type": "object",
"required": [
"table_name"
],
"properties": {
"table_name": {
"type": "string"
}
}
}// Input
{
"table_name": "users"
}// Output
{
"columns": [
{
"name": "id",
"type": "uuid"
},
{
"name": "email",
"type": "varchar"
}
]
}List all tables in the schema
{
"type": "object",
"properties": {
"schema": {
"type": "string"
}
}
}// Input
{
"schema": "public"
}// Output
{
"tables": [
{
"name": "users",
"row_count": 15420
}
]
}Execute a read-only SQL query
{
"type": "object",
"required": [
"sql"
],
"properties": {
"sql": {
"type": "string"
}
}
}The official PostgreSQL MCP server provides safe, read-only access to PostgreSQL databases.
PostgreSQL provides 3 tools including describe_table, list_tables, query.
Yes, PostgreSQL is completely free to use with no usage limits on the free tier.
You can install PostgreSQL using the following command: npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost/db. After installation, add the provided config snippet to your Claude Desktop or Cursor configuration.
// Input
{
"sql": "SELECT * FROM users LIMIT 5"
}// Output
{
"rows": [
{
"id": 1,
"name": "Alice"
}
],
"rowCount": 1
}PostgreSQL is listed under the Data & Analytics category in the AgentForge MCP registry.
PostgreSQL has a current uptime of 99.98% with an average response time of 45ms.
To connect PostgreSQL, click the "Connect Agent" button on this page to get the configuration snippet. Add it to your MCP client (Claude Desktop, Cursor, or any MCP-compatible tool). Your AI agent will then have access to all of PostgreSQL's tools via the Model Context Protocol.