query-executor
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | Python logging level | INFO |
| DATABASES_FILE | No | Path to the databases registry file | databases.json |
| CONNECT_TIMEOUT | No | asyncpg connection timeout in seconds | 10.0 |
| DEFAULT_PROJECT | No | Fallback project when project_id is omitted | default |
| EXPLAIN_TIMEOUT_MS | No | Statement timeout for EXPLAIN ANALYZE in milliseconds | 30000 |
| STAT_STATEMENTS_DEFAULT_LIMIT | No | Default row limit for pg_stat_statements | 20 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| describe_postgres_schemaA | Inspect a PostgreSQL schema and return its full structure as JSON. Call this before writing any query, JOIN, or EXPLAIN — it gives you exact table/column names and indexes so you don't guess. Returns a JSON object:
Large schemas (100+ tables) return a lot of JSON — filter by table_name client-side rather than calling this multiple times. |
| execute_postgresA | Execute a SQL query against a PostgreSQL database and return rows as JSON. Returns: {"rows": [...], "row_count": N} Mode behaviour (per project in databases.json):
Call describe_postgres_schema first to confirm table/column names. If row_count equals your LIMIT, there are likely more rows. |
| explain_postgresA | Run EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) on a query and return the plan. The query executes to collect real timing; results are discarded — only the plan is returned. A statement timeout prevents runaway queries. Returns: {"plan": []} Use before running a slow or unfamiliar query on a large table. Check describe_postgres_schema first to see what indexes exist. Write queries are blocked. |
| list_projectsA | List all configured database projects and their access modes. Call this first when you don't know which project_id to use. Returns every project registered in databases.json, including which one is the default (used when project_id is omitted). Returns a JSON object: { "default_project": "<project_id>", "projects": [ {"project_id": "", "mode": "readonly|readwrite", "is_default": true|false}, ... ] } |
| pg_stat_statementsA | Return the top N most expensive queries from pg_stat_statements. Best starting point for a performance audit — shows which query patterns cost the most cumulative time across the application. Returns: {"rows": [{query, calls, total_exec_sec, mean_exec_sec, max_exec_sec, total_rows, shared_blks_hit, shared_blks_read}], "row_count": N} Query text uses $1/$2 placeholders (pg_stat_statements normalises literals). Requires the pg_stat_statements extension (enabled by default on RDS, Cloud SQL, Supabase; otherwise: CREATE EXTENSION pg_stat_statements). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
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/Nitesh-Nandan/query-executor'
If you have feedback or need assistance with the MCP directory API, please join our Discord server