MCP server exposing psycopg2 PostgreSQL database adapter functionality
Server has 11 tools with complete input schemas and descriptions, but quality is inconsistent. Naming follows verb_noun convention (connect, close_connection, execute_query). Descriptions are present but generic (avg ~80 chars, below 194-char baseline). Critical gaps: no output schemas documented, no error recovery guidance, no parameter constraints (enums for isolation levels), and hardcoded defaults expose credentials (password='password'). Tool composition is reasonable but lacks pagination for result-heavy operations. No tool annotations (readOnlyHint/destructiveHint). Stateful connection management (_active_connections dict) violates stateless protocol design.
Begin a new transaction.
Close an existing database connection.
Close a database cursor.
Commit the current transaction.
Create a new PostgreSQL database connection.
Create a new database cursor.
Execute a SQL query with multiple parameter sets.
No output schemas documented. LLMs cannot predict return structure for execute_query, get_connection_info, or execute_many. Violates pattern:tool requirement that all tools document return types.
Hardcoded credential defaults (password='password', user='postgres', dbname='test') in connect() expose secrets and violate pattern:secret-injection. Credentials must use server-side injection via environment variables.
set_isolation_level accepts free-form string 'level' parameter. Should be an enum (AUTOCOMMIT, READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE, DEFAULT) to prevent hallucinated values. Violates pattern:constrained-input.
No error recovery guidance. Exceptions raised as generic 'Exception(f"...")' with no actionable next steps. LLMs cannot determine if errors are retryable or user-fixable. Violates pattern:recovery-guide.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 54 | 2026-07-28+ | v2 |
Execute a SQL query.
Get information about a database connection.
Rollback the current transaction.
Set transaction isolation level.
Stateful connection/cursor management (_active_connections, _active_cursors dicts) violates stateless protocol design. MCP 2026-07-28 requires each request to be self-contained; server-side state breaks multi-client scenarios and session isolation.