Skip to content
MCP server

sprocguard

Capture what a SQL Server stored procedure does today and verify changes against it

Runs locally
Install

sprocguard is an MCP server for databases. It runs locally on your machine and is started by your AI client.

Platforms
CLI, Windows, Linux
Runs
Locally
Version
0.3.0
Listing updated

Similar MCP servers

Install

Run in a terminal

claude mcp add sprocguard --env SPROCGUARD_ODBC='<SPROCGUARD_ODBC>' --env SPROCGUARD_PASSWORD='<SPROCGUARD_PASSWORD>' -- uvx sprocguard

Add to claude_desktop_config.json

{
  "mcpServers": {
    "sprocguard": {
      "command": "uvx",
      "args": [
        "sprocguard"
      ],
      "env": {
        "SPROCGUARD_ODBC": "<SPROCGUARD_ODBC>",
        "SPROCGUARD_PASSWORD": "<SPROCGUARD_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "sprocguard": {
      "command": "uvx",
      "args": [
        "sprocguard"
      ],
      "env": {
        "SPROCGUARD_ODBC": "<SPROCGUARD_ODBC>",
        "SPROCGUARD_PASSWORD": "<SPROCGUARD_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "sprocguard": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "sprocguard"
      ],
      "env": {
        "SPROCGUARD_ODBC": "<SPROCGUARD_ODBC>",
        "SPROCGUARD_PASSWORD": "<SPROCGUARD_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "sprocguard": {
      "command": "uvx",
      "args": [
        "sprocguard"
      ],
      "env": {
        "SPROCGUARD_ODBC": "<SPROCGUARD_ODBC>",
        "SPROCGUARD_PASSWORD": "<SPROCGUARD_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "sprocguard": {
      "command": "uvx",
      "args": [
        "sprocguard"
      ],
      "env": {
        "SPROCGUARD_ODBC": "<SPROCGUARD_ODBC>",
        "SPROCGUARD_PASSWORD": "<SPROCGUARD_PASSWORD>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • SPROCGUARD_CONFIGPath to sprocguard.toml (defaults to ./sprocguard.toml in the working directory)
  • SPROCGUARD_ODBCODBC connection string; overrides the connection in sprocguard.toml
  • SPROCGUARD_PASSWORDSQL login password, only when the config uses user/password_env

About sprocguard

Stored procedures often hold business rules with no tests, and an AI agent asked to optimise one can quietly change a rounding rule or an error path. sprocguard records characterization (golden master) baselines: result sets, return values, OUTPUT parameters, errors raised, and rows inserted, updated or deleted in each written table, including via called procedures and triggers.

Each case runs twice so values that change by themselves, such as IDENTITY values, NEWID() and run-time dates, are detected and ignored. Verification then reports each behaviour difference and exits with code 2 if something changed. Its safety model rolls every execution back inside a nested transaction, refuses databases outside allowed_databases, and by default refuses procedures that send mail, call xp_cmdshell or use linked servers.

It is also a CLI and a GitHub Action, and a Claude Code plugin ships a skill teaching the inspect, design cases, capture, change, verify loop. It needs Python 3.11 and an ODBC driver; use a development database because captures briefly hold locks.

Tools this server provides (6)

Taken from the project documentation; the running server may differ.

inspect_procedure
Parameters, tables read and written, related procedures and triggers, and risks.
suggest_cases
Real parameter values from related tables plus edge values.
capture_baseline
Records current behaviour; refuses to overwrite unless asked.
verify_procedure
Re-runs cases and lists every difference.
generate_tsqlt_tests
Turns a baseline into tSQLt tests.
list_baselines
Lists captured baselines.

What it does

Behaviour baselines
Records result sets, errors and table changes for each parameter case.
Automatic noise filtering
Running each case twice flags values like IDENTITY and NEWID() to ignore.
Clear diff reports
Lists every changed row, value or error compared to the baseline.
Rollback safety
Executions run in a transaction that is always rolled back.
Allow-listed databases
Refuses to connect to databases not listed in allowed_databases.
tSQLt export
Turns a baseline into tSQLt tests for read-only procedures.

Good for

  • Check an AI-edited stored procedure still behaves the same
  • Block a pull request that changes procedure behaviour
  • Generate characterization tests for an untested procedure
  • Find which tables a procedure and its triggers write to

sprocguard FAQ

Does sprocguard change my data?

No. Every execution runs inside a transaction that is always rolled back, though captures hold locks briefly so a development database is advised.

What does sprocguard require?

Python 3.11 or newer and Microsoft ODBC Driver 17 or 18 for SQL Server.

Which procedures are refused?

By default those that send e-mail, run xp_cmdshell, start jobs or use OPENROWSET, OPENQUERY or linked servers.

How is sprocguard used with agents?

Run sprocguard serve as an MCP server or install the Claude Code plugin that includes an agent skill.

How do I add sprocguard to Claude Code?

Run this command in your terminal: claude mcp add sprocguard --env SPROCGUARD_ODBC='<SPROCGUARD_ODBC>' --env SPROCGUARD_PASSWORD='<SPROCGUARD_PASSWORD>' -- uvx sprocguard

What are the best alternatives to sprocguard?

The closest alternatives to sprocguard are Scribase, PrufGate, Guard, GuardLayer and Prober.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers