Skip to main content
Glama

PostgreSQL MCP Server

AGPL 3.0
582
99
  • Linux
  • Apple

pg_execute_query

Execute PostgreSQL SELECT queries, count rows, or check data existence with optional parameters and safety limits. Designed for efficient PostgreSQL database management and data retrieval.

Instructions

Execute SELECT queries and data retrieval operations - operation="select/count/exists" with query and optional parameters. Examples: operation="select", query="SELECT * FROM users WHERE created_at > $1", parameters=["2024-01-01"]

Input Schema

NameRequiredDescriptionDefault
connectionStringNoPostgreSQL connection string (optional)
limitNoMaximum number of rows to return (safety limit)
operationYesQuery operation: select (fetch rows), count (count rows), exists (check existence)
parametersNoParameter values for prepared statement placeholders ($1, $2, etc.)
queryYesSQL SELECT query to execute
timeoutNoQuery timeout in milliseconds

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "connectionString": { "description": "PostgreSQL connection string (optional)", "type": "string" }, "limit": { "description": "Maximum number of rows to return (safety limit)", "type": "number" }, "operation": { "description": "Query operation: select (fetch rows), count (count rows), exists (check existence)", "enum": [ "select", "count", "exists" ], "type": "string" }, "parameters": { "default": [], "description": "Parameter values for prepared statement placeholders ($1, $2, etc.)", "items": {}, "type": "array" }, "query": { "description": "SQL SELECT query to execute", "type": "string" }, "timeout": { "description": "Query timeout in milliseconds", "type": "number" } }, "required": [ "operation", "query" ], "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HenkDz/postgresql-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server