SQLGuard Ninja v0.4.0
Highlights
- MCP server.
sqlninja mcp --policy ... --role ... --tenant ... exposes validate_sql, explain_policy_decision, inspect_query_cost and get_policy_capabilities to MCP-compatible agents over stdio. It is built on the official MCP Python SDK (2.x).
- Security model. The identity is fixed by the operator at start-up, and tools take no role, tenant, credential or connection-string arguments. The server never executes SQL or connects to a database, withholds internal detail, and does not reveal ungranted tables or columns. Inputs are size-capped and calls are rate-limited.
- Verified with a real client. The end-to-end test launches the server as a subprocess and uses the SDK's
stdio_client and ClientSession to discover and call the tools, including a forged role argument.
Notes
- Remote (Streamable HTTP) transport is not enabled. A remote deployment needs an authenticated gateway that binds each caller to an identity (see the MCP guide).
- Known limitations are unchanged: all benchmark results are internal (issues #5 and #6), only PostgreSQL and SQLite are supported, and there is no guarantee against SQL injection or data leakage.
Installation
python -m pip install "sqlguard-ninja[mcp]==0.4.0"
PyPI: https://pypi.org/project/sqlguard-ninja/0.4.0/