This MCP server has critical definition quality gaps. The single tool 'generate_query' has a basic description and input schema, but lacks crucial details for safe agentic use. The tool accepts free-form SQL generation without structured validation, error classification, or output documentation. There is no evidence of MCP protocol implementation, the codebase appears to be a standalone Python module with no MCP server scaffolding (no transport, no tool registration framework, no resource/prompt/logging handlers). The tool definitions are inferred from example_usage.py rather than explicitly registered via MCP. This is a Python class, not an MCP server.
Tools (1)
generate_queryread onlyauthsource verified48/100
Interprets schema context and generates appropriate database statements.
Implement this as a proper MCP server using the MCP SDK (e.g., mcp Python SDK). Add transport layer (HTTP SSE or Streamable HTTP), tool registration, resource handlers, and MCP protocol compliance.
Document the complete output schema for generate_query. Define the structure of returned 'generated_query' and 'safety_assessment' fields with types, constraints, and examples. Explicitly document that 'generated_query' is a string containing SQL/query text, and 'safety_assessment' contains 'is_safe' (boolean) and 'contains_destructive_operations' (boolean).
Expand tool description from 35 chars to 150-250 chars. Include: what the tool does (translates natural language to SQL), when to use it (user asks for database query), what it returns (generated query + safety check), and any limitations (must provide schema context).
Add enum constraint to 'dialect' parameter: ['postgresql', 'mysql', 'mongodb', 'sqlite', 'mariadb']. Update description: 'SQL dialect to target. Must be one of: postgresql, mysql, mongodb, sqlite, mariadb.'
Enhance parameter descriptions: (1) 'question': 'Natural language question about the database (10-500 chars). E.g., "Show top 10 orders from last 30 days."'. (2) 'schema': 'Database schema definition in text or YAML format (50-5000 chars). Include table names, column names, types, and primary keys. E.g., "Table: orders\n- id (int)\n- total_amount (decimal)\n- created_at (timestamp)"'. (3) 'dialect': as above.
Replace mock-mode fallback with explicit configuration. Document that API_KEY must be set; if not provided, raise a clear error: 'DB_QUERY_API_KEY not set. Configure via environment variable or constructor.' Remove hardcoded default query behavior.
Score history
Overall score trend
First recorded score · v2 rubric
36/100
Scored
Grade
Overall
Spec posture
Rubric
2026-09-23
F
36
2026-07-28+
v2
Parameter Descriptions Lack Detail and Constraints
SQL Injection Prevention is Naive and Insufficient
generate_query
Implement robust input sanitization. Current check for ['drop', 'delete', 'truncate', 'alter'] is naive and easily bypassed (e.g., case variations, comments). Use a proper SQL parser (e.g., sqlparse) to validate that the question does not encode destructive intent. Return detailed error: 'Query contains restricted operation: DROP. This tool generates read-only queries only.'
Add error classification and recovery guidance. When validation fails, return: '{"error": "Invalid query", "reason": "Question contains destructive operation: DROP", "nextStep": "Rephrase as a SELECT query without DROP, DELETE, or TRUNCATE.", "retryable": false}'. When schema is malformed: '{"error": "Invalid schema format", "reason": "Schema is missing table definitions", "nextStep": "Provide schema as TABLE_NAME\n- COLUMN (TYPE)\n format.", "retryable": true}'.
Add permission/scope declaration. Explicitly document: 'This tool generates read-only queries only. It cannot generate INSERT, UPDATE, DELETE, DROP, ALTER, or TRUNCATE statements. Use scope: read:database:query.'
Implement pagination and result limiting in the response if the tool might return multiple query suggestions. Cap at 1 primary query + up to 2 alternatives. Document: 'Returns primary generated query plus up to 2 alternative formulations.'
Log all invocations with user context, input parameters (question, schema, dialect), generated query, safety assessment, and timestamp. Mask sensitive schema details (e.g., redact actual column values if schema contains data samples).