Safety layer between AI agents and databases logo

Safety layer between AI agents and databases

Free
FreeFree tier
Type
Open Source

About Safety layer between AI agents and databases

faz is an open-source safety layer designed to sit between AI agents and databases, ensuring every query is inspected before execution. It provides a multi-database interface via MCP (Model Context Protocol) and REST API, supporting 14 database types. Every query passes through a five-stage safety pipeline: prompt guard, role-based access control (RBAC), abstract syntax tree (AST) analysis, injection detection, and guardrails. faz offers four MCP tools: list_databases, describe_table, query, and federated_query. Administrators can define granular permissions per table and user, including read, write, append, and full access. The tool logs all actions and returns either query results or a blocked response with a clear explanation. Setup is quick via pip and a command-line wizard.

Key Features

Multi-stage safety pipeline: prompt guard, RBAC, AST analysis, injection detection, guardrails
Supports 14 database types (PostgreSQL, MySQL, SQLite, etc.)
MCP (Model Context Protocol) integration for AI agents like Claude and Cursor
REST API endpoint on localhost:8787
Granular per-table permissions (R, W, RW, RWA, A, none)
Federated query across multiple databases with merged results
Audit trail with blocked request explanations
Interactive CLI wizard for adding databases
Minimal configuration via faz.yaml

Pros & Cons

Pros
  • Comprehensive safety pipeline inspects all queries before execution
  • Easy setup with pip and CLI wizards
  • Supports a wide range of database types (14 databases)
  • Integrates seamlessly with MCP-compatible agents like Claude and Cursor
  • Clear blocked query explanations help debugging
  • Open source with permissive license
Cons
  • Relatively new project with small community (7 stars on GitHub as of data collection)
  • Limited documentation beyond the README
  • Requires manual configuration of database connections and permissions

Best For

AI agents querying production databases with safety guaranteesMulti-database federated queries for data analysis agentsSecure database access for agentic applications (e.g., Cursor, Claude Desktop)Enforcing role-based access control for agent database interactionsPreventing SQL injection and dangerous operations from AI agents

FAQ

What databases does faz support?
faz supports 14 database types including PostgreSQL, MySQL, SQLite, and others, configured through the add-database wizard or directly in faz.yaml.
How does faz ensure safety?
Every query passes through a five-stage pipeline: prompt guard, RBAC, AST analysis, injection detection, and guardrails. The pipeline inspects and blocks dangerous operations before execution.
How do AI agents connect to faz?
Agents can connect via MCP (Model Context Protocol) using `faz mcp install` to auto-configure Claude Desktop and Cursor, or via the REST API at localhost:8787.
What can an agent do with faz?
Agents have four tools: list_databases, describe_table, query (single database), and federated_query (multiple databases). Queries pass the safety pipeline and return results or blocked explanations.
How do I set up permissions?
In faz.yaml, you can set a baseline permission (R, RW, RWA, A, none) and per-table overrides. For example, `readonly_user` with baseline R, but `orders` table set to RW.