Skip to content

FEAT — Verified query catalog for MCP agents #287

Done

Description

@jmmana

Goal

Let data teams publish approved, read-only business queries for MCP agents. A generated query can pass policy checks and still calculate the wrong metric, such as gross sales in place of net sales. A reviewed query gives the team one definition to maintain, test and audit.

First release

  • Git-managed YAML or JSON catalog with a version, stable query IDs, descriptions, PostgreSQL SQL templates, typed parameters and allowed roles.
  • Opt-in MCP discovery and execution tools. Discovery lists the query IDs, descriptions and parameter schemas available to the authenticated role. Execution accepts a query ID and typed values. The server owns the template.
  • Use bound parameters and the existing policy, trusted tenant context, read-only connection, timeout, row limits and configured masks. Catalog approval grants no extra privileges. Audit the query ID, catalog version and decision while excluding parameter values and rows.
  • Start with three runnable PostgreSQL examples, including net sales by month. Preserve the existing MCP query contract.

Acceptance criteria

  • Reject invalid catalog definitions and duplicate IDs at startup. Refuse invalid, missing or extra parameters before execution.
  • PostgreSQL integration tests show that an allowed role receives the correct result, unauthorized roles cannot discover or invoke the query, and tenants receive only their authorized rows.
  • Tests verify configured masks and row limits and check that catalog audit events omit parameter values and rows.
  • CI validates expected business results on fixture data and detects a changed metric definition.
  • English and Spanish docs include setup, an example catalog and the commands to run the fixtures.

References

Snowflake verified queries · Databricks Genie trusted assets

Likely entry points are src/sqlguardllm/mcp_server.py, policy_set.py, audit.py and tests/engines/. This complements #217, which measures remediation hints for generated SQL.

Size estimate: L.

Activity

  1. added
    type:feature
    area:core
    size:l
    lang:python
    p1
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corelang:pythonp1size:ltype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions