
Lagaam
Local MCP guard that blocks agent Trino and Pinot queries before they run if over budget
The repository was last updated 28 days ago and is published under Apache-2.0.
Lagaam is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- Runs
- Locally
- What it can do
- Read-only
- GitHub stars
- 1
- Last commit
Similar MCP servers
Install
You install MCP servers on a computer. Send yourself the link.
Add with the CLI
Run in a terminal
claude mcp add lagaam --env LAGAAM_ALLOWED_TABLES='<LAGAAM_ALLOWED_TABLES>' --env TRINO_PASSWORD='<TRINO_PASSWORD>' --env TRINO_JWT='<TRINO_JWT>' --env PINOT_PASSWORD='<PINOT_PASSWORD>' -- uvx lagaamAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"lagaam": {
"command": "uvx",
"args": [
"lagaam"
],
"env": {
"LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>",
"TRINO_PASSWORD": "<TRINO_PASSWORD>",
"TRINO_JWT": "<TRINO_JWT>",
"PINOT_PASSWORD": "<PINOT_PASSWORD>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"lagaam": {
"command": "uvx",
"args": [
"lagaam"
],
"env": {
"LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>",
"TRINO_PASSWORD": "<TRINO_PASSWORD>",
"TRINO_JWT": "<TRINO_JWT>",
"PINOT_PASSWORD": "<PINOT_PASSWORD>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"lagaam": {
"command": "uvx",
"args": [
"lagaam"
],
"env": {
"LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>",
"TRINO_PASSWORD": "<TRINO_PASSWORD>",
"TRINO_JWT": "<TRINO_JWT>",
"PINOT_PASSWORD": "<PINOT_PASSWORD>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"lagaam": {
"type": "stdio",
"command": "uvx",
"args": [
"lagaam"
],
"env": {
"LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>",
"TRINO_PASSWORD": "<TRINO_PASSWORD>",
"TRINO_JWT": "<TRINO_JWT>",
"PINOT_PASSWORD": "<PINOT_PASSWORD>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add lagaam --env LAGAAM_ALLOWED_TABLES='<LAGAAM_ALLOWED_TABLES>' --env TRINO_PASSWORD='<TRINO_PASSWORD>' --env TRINO_JWT='<TRINO_JWT>' --env PINOT_PASSWORD='<PINOT_PASSWORD>' -- uvx lagaamOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.lagaam]
command = "uvx"
args = ["lagaam"]
env = { LAGAAM_ALLOWED_TABLES = "<LAGAAM_ALLOWED_TABLES>", TRINO_PASSWORD = "<TRINO_PASSWORD>", TRINO_JWT = "<TRINO_JWT>", PINOT_PASSWORD = "<PINOT_PASSWORD>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"lagaam": {
"command": "uvx",
"args": [
"lagaam"
],
"env": {
"LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>",
"TRINO_PASSWORD": "<TRINO_PASSWORD>",
"TRINO_JWT": "<TRINO_JWT>",
"PINOT_PASSWORD": "<PINOT_PASSWORD>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Or run: gemini mcp add -s user -e LAGAAM_ALLOWED_TABLES='<LAGAAM_ALLOWED_TABLES>' -e TRINO_PASSWORD='<TRINO_PASSWORD>' -e TRINO_JWT='<TRINO_JWT>' -e PINOT_PASSWORD='<PINOT_PASSWORD>' lagaam uvx -- lagaam
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "lagaam": { "command": "uvx", "args": [ "lagaam" ], "env": { "LAGAAM_ALLOWED_TABLES": "<LAGAAM_ALLOWED_TABLES>", "TRINO_PASSWORD": "<TRINO_PASSWORD>", "TRINO_JWT": "<TRINO_JWT>", "PINOT_PASSWORD": "<PINOT_PASSWORD>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
LAGAAM_ALLOWED_TABLESComma list of catalog.schema.table grants; the server will not start without itRequiredLAGAAM_ALLOW_ALL_TABLEStrue to run with no grant at all: an explicit opt-out, off by defaultLAGAAM_ENGINEWhich adapter to runTRINO_HOSTTrino coordinator hostTRINO_PORTTrino coordinator portTRINO_USERTrino userTRINO_PASSWORDPassword for TRINO_USER; unset means no login. Not with TRINO_JWTTRINO_JWTJWT to log in with instead of a password; unset means no loginTRINO_HTTP_SCHEMEhttp or https; unset means https once a password or JWT is set, else httpTRINO_VERIFYTLS cert check: true, false, or the path of a CA bundle (PEM)PINOT_CONTROLLER_URLPinot controller URLPINOT_BROKER_URLPinot broker URLPINOT_USERPinot user; unset means no authPINOT_PASSWORDPinot password; unset means no authLAGAAM_AGENT_NAMEIdentity stamped on the audit trailLAGAAM_MAX_SCAN_BYTESScan-bytes budget per query, checked before it runs (default 50 GiB)LAGAAM_MAX_ROWSScanned-row estimate budget per query; unset means ungatedLAGAAM_MAX_INTERMEDIATE_ROWSRows the engine would build at its widest step, not rows returned, so a LIMIT doesn't lower itLAGAAM_MAX_RETURNED_ROWSRows returned to the agent per query, capped at 100000; a bigger LIMIT in the query is lowered to itLAGAAM_QUERY_TIMEOUTWall-clock seconds per queryLAGAAM_METADATA_TTLMetadata cache TTL, secondsLAGAAM_AUDIT_LOGAudit JSONL file path; unset means stderr
About Lagaam
Lagaam is aimed at shared lakehouse clusters, where one agent's missing partition filter or accidental cross join slows everyone else. Instead of limiting a query once it is running, it prices the query from the engine's own EXPLAIN plan first and refuses it with the number and a suggested fix. Queries that cannot be estimated, such as tables without statistics, are refused too.
Only a single SELECT is allowed, checked in the syntax tree. DDL, DML, multiple statements, SELECT * and table-function passthrough are rejected, and a LIMIT is added when missing. Access is limited to a list of granted tables, and the schema tools list_catalogs and describe_table only reveal names the agent is allowed to touch. Defaults include a 50 GiB scan budget, 1,000 returned rows and a 300-second timeout, all adjustable.
Results get warnings for zero rows or truncated pages, and every call is written to a JSONL audit line. The README reports it stopped 11 of 11 risky test queries before execution, and positions it alongside Trino's own limits rather than replacing them.
Tools this server provides (2)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, all 2 tools only read data.
From the server's own tool labels and tool names; not verified by us.
- list_catalogsName suggests: reads
- Lists catalogs scoped to the agent's table grant.
- describe_tableName suggests: reads
- Returns column names, types and row estimates for a granted table.
What it does
- Pre-run cost quote
- Prices scan bytes and widest-step rows from EXPLAIN.
- Read-only enforcement
- Allows a single SELECT, checked in the syntax tree.
- Table grants
- The server will not start without an allowed-table list.
- Grounding tools
- list_catalogs and describe_table are scoped to the grant.
- Result checks
- Warns on empty, truncated or all-NULL results.
- Audit trail
- One JSONL line per call with decision and reason.
Good for
- Give agents Trino access on a shared cluster safely
- Stop accidental cross joins before they run
- Restrict an agent to specific tables
- Audit what agents queried and why it was allowed
Pricing
Open source
Lagaam FAQ
Which engines does Lagaam support?
Trino by default and Apache Pinot via LAGAAM_ENGINE.
How do I install Lagaam?
Run uvx lagaam with LAGAAM_ALLOWED_TABLES and your Trino host set.
How is Lagaam different from Trino's own limits?
Trino limits act during or after execution. Lagaam refuses before the query starts.
What are the default limits?
50 GiB scan budget, 1,000 returned rows, 300-second timeout.
Can I run without a table grant?
Only by setting LAGAAM_ALLOW_ALL_TABLES to true, an explicit opt-out.
Is Lagaam free?
Yes. Lagaam is open source, so you can use and self-host it for free.
How do I add Lagaam to Claude Code?
Run this command in your terminal: claude mcp add lagaam --env LAGAAM_ALLOWED_TABLES='<LAGAAM_ALLOWED_TABLES>' --env TRINO_PASSWORD='<TRINO_PASSWORD>' --env TRINO_JWT='<TRINO_JWT>' --env PINOT_PASSWORD='<PINOT_PASSWORD>' -- uvx lagaam
What are the best alternatives to Lagaam?
The closest alternatives to Lagaam are REA, MCP Toolbox for Databases, redamon, AiSOC and Bernstein.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.


