Skip to content

FEAT-007 — sqlguardllm protect: guard the database MCP server you already use in one command #216

Done

Description

@jmmana

Parent epic: #214
Priority: P0

Problem

Direct competitors (safedb-mcp, sql-shield, mcp-read-only-sql) ask users to replace their database MCP server. The audience is in the servers people already run: MCP Toolbox for Databases (~17k stars), dbhub (~4k) and Postgres MCP Pro (~3.5k). sqlguardllm proxy (#172) can already guard dbhub, Postgres MCP Pro and a SQL Server server, but setting it up takes a policy, a map and a hand-edited client config. Most people stop before that.

Proposal

sqlguardllm protect            # dry run: shows what it found and the diff it would apply
sqlguardllm protect --apply    # writes policy.yaml, map.yaml and the new client config (with a backup)
sqlguardllm protect --undo     # restores the backup
  1. Find MCP client configs: Claude Desktop, Cursor (~/.cursor/mcp.json, .cursor/mcp.json) and VS Code (.vscode/mcp.json and user settings).
  2. Recognize known database servers by command and package: dbhub, Postgres MCP Pro and MCP Toolbox for Databases. Read the DSN from args or env.
  3. Draft a policy with Policy.from_database(): every table it finds and a row limit. Columns whose names look personal or secret (email, phone, ssn, password, token, secret, iban, card, birth…) are proposed as hidden or masked, with the reason shown. Run lint --strict on the draft.
  4. Wrap the server: rewrite the client entry so it launches sqlguardllm proxy … -- <original command>. Keep a timestamped backup.
  5. Add examples/proxy/mcp-toolbox.yaml for MCP Toolbox's prebuilt execute_sql tool, and verify the tool name against the current release.

Security impact

  • Dry run by default. Nothing is written without --apply, and --undo always works from the backup.
  • Never print or log credentials: mask passwords in DSNs in every output, including the diff.
  • The draft policy is a starting point. The output says so and lists every table it exposes.
  • Unknown servers are reported and left untouched. Unmapped tools stay hidden and refused (proxy default).

Acceptance criteria

  • protect, protect --apply and protect --undo work for Claude Desktop, Cursor and VS Code configs, with fixture tests for each.
  • dbhub, Postgres MCP Pro and MCP Toolbox are recognized, with an end-to-end test on PostgreSQL for at least dbhub.
  • PII name heuristics tested on a fixture schema, EN and ES column names included.
  • No credential appears in stdout, stderr or files other than the client config itself (test).
  • Docs: "Protect the database MCP server you already use in one command" (EN / ES), with a 30-second demo.

Files

  • src/sqlguardllm/protect.py (new) · cli.py · introspect.py · examples/proxy/mcp-toolbox.yaml (new) · docs/PROXY.md

Size

L

Activity

  1. added
    type:feature
    area:security
    area:cli
    area:integrations
    size:l
    lang:python
    p0
    on Dec 1, 2026
  2. added a commit that references this issue on Dec 1, 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:cliarea:integrationsarea:securitylang:pythonp0size:ltype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions