Home / Market / Cost Guard MCP

Cost Guard MCP

Pre-flight query cost and result-size guardrails for AI agents on BigQuery, Snowflake, Databricks

mcp★ 045 dlmcp-registryMIT configuration; upstream service license appliesInstall in CosmosUpstream Source

Documentation & Preview

{ "mcpServers": { "mcp-cost-guard-mcp-d9afd01f3e0a3edf05d7": { "command": "uvx", "args": [ "--from", "cost-guard-mcp==0.6.0", "cost-guard-mcp" ], "env": { "GOOGLE_APPLICATION_CREDENTIALS": "${ENV_GOOGLE_APPLICATION_CREDENTIALS}", "SNOWFLAKE_ACCOUNT": "${ENV_SNOWFLAKE_ACCOUNT}", "SNOWFLAKE_USER": "${ENV_SNOWFLAKE_USER}", "SNOWFLAKE_ROLE": "${ENV_SNOWFLAKE_ROLE}", "SNOWFLAKE_SECONDARY_ROLES": "${ENV_SNOWFLAKE_SECONDARY_ROLES}", "SNOWFLAKE_PRIVATE_KEY_PATH": "${ENV_SNOWFLAKE_PRIVATE_KEY_PATH}", "SNOWFLAKE_PRIVATE_KEY_PASSPHRASE": "${ENV_SNOWFLAKE_PRIVATE_KEY_PASSPHRASE}", "SNOWFLAKE_PASSWORD": "${ENV_SNOWFLAKE_PASSWORD}", "SNOWFLAKE_EDITION": "${ENV_SNOWFLAKE_EDITION}", "DATABRICKS_SERVER_HOSTNAME": "${ENV_DATABRICKS_SERVER_HOSTNAME}", "DATABRICKS_HTTP_PATH": "${ENV_DATABRICKS_HTTP_PATH}", "DATABRICKS_TOKEN": "${ENV_DATABRICKS_TOKEN}", "DATABRICKS_CLIENT_ID": "${ENV_DATABRICKS_CLIENT_ID}", "DATABRICKS_CLIENT_SECRET": "${ENV_DATABRICKS_CLIENT_SECRET}", "COST_GUARD_ALLOW_MULTI_STATEMENT_SQL": "${ENV_COST_GUARD_ALLOW_MULTI_STATEMENT_SQL}", "COST_GUARD_ALLOW_WRITE_STATEMENTS": "${ENV_COST_GUARD_ALLOW_WRITE_STATEMENTS}", "COST_GUARD_MAX_IN_FLIGHT_QUERIES": "${ENV_COST_GUARD_MAX_IN_FLIGHT_QUERIES}", "COST_GUARD_DATABRICKS_ALLOW_WAREHOUSE_START": "${ENV_COST_GUARD_DATABRICKS_ALLOW_WAREHOUSE_START}", "COST_GUARD_SNOWFLAKE_ALLOW_WAREHOUSE_RESUME": "${ENV_COST_GUARD_SNOWFLAKE_ALLOW_WAREHOUSE_RESUME}" } } }, "setup": { "fields": [ { "id": "ENV_GOOGLE_APPLICATION_CREDENTIALS", "label": "GOOGLE_APPLICATION_CREDENTIALS", "description": "BigQuery: path to a service-account key file (Application Default Credentials). Required to use the bigquery engine.", "required": false, "secret": true, "default": "" }, { "id": "ENV_SNOWFLAKE_ACCOUNT", "label": "SNOWFLAKE_ACCOUNT", "description": "Snowflake: account identifier. Required to use the snowflake engine.", "required": false, "secret": false, "default": "" }, { "id": "ENV_SNOWFLAKE_USER", "label": "SNOWFLAKE_USER", "description": "Snowflake: username. Required to use the snowflake engine.", "required": false, "secret": false, "default": "" }, { "id": "ENV_SNOWFLAKE_ROLE", "label": "SNOWFLAKE_ROLE", "description": "Snowflake: role to assume. Required to use the snowflake engine; has no default and must never be ACCOUNTADMIN (ACCOUNTADMIN, SECURITYADMIN and ORGADMIN are rejected before any Snowflake connection is opened - the check runs when the Snowflake configuration is first loaded, on the first Snowflake tool call; the server process itself starts regardless, so a bad role surfaces as a failed check_credentials or a tool error, not as a startup exit).", "required": false, "secret": false, "default": "" }, { "id": "ENV_SNOWFLAKE_SECONDARY_ROLES", "label": "SNOWFLAKE_SECONDARY_ROLES", "description": "Snowflake: secondary roles activated at login. NONE (default) means only SNOWFLAKE_ROLE is active in the session; ALL is the explicit opt-out that activates every role granted to SNOWFLAKE_USER.", "required": false, "secret": false, "default": "" }, { "id": "ENV_SNOWFLAKE_PRIVATE_KEY_PATH", "label": "SNOWFLAKE_PRIVATE_KEY_PATH", "description": "Snowflake: path to an RSA private key file for key-pair auth (preferred over SNOWFLAKE_PASSWORD). Either this or SNOWFLAKE_PASSWORD is required to use the snowflake engine.", "required": false, "secret": true, "default": "" }, { "id": "ENV_SNOWFLAKE_PRIVATE_KEY_PASSPHRASE", "label": "SNOWFLAKE_PRIVATE_KEY_PASSPHRASE", "description": "Snowflake: passphrase for an encrypted SNOWFLAKE_PRIVATE_KEY_PATH key file, if the key is encrypted.", "required": false, "secret": true, "default": "" }, { "id": "ENV_SNOWFLAKE_PASSWORD", "label": "SNOWFLAKE_PASSWORD", "description": "Snowflake: password (discouraged; prefer SNOWFLAKE_PRIVATE_KEY_PATH). Either this or SNOWFLAKE_PRIVATE_KEY_PATH is required to use the snowflake engine.", "required": false, "secret": true, "default": "" }, { "id": "ENV_SNOWFLAKE_EDITION", "label": "SNOWFLAKE_EDITION", "description": "Snowflake: account edition that sets the USD/credit price of estimates - standard (default), enterprise, business_critical or vps. The per-call edition argument can only raise it.", "required": false, "secret": false, "default": "" }, { "id": "ENV_DATABRICKS_SERVER_HOSTNAME", "label": "DATABRICKS_SERVER_HOSTNAME", "description": "Databricks: SQL warehouse server hostname (e.g. my-workspace.cloud.databricks.com, no scheme, no trailing slash). Required to use the databricks engine.", "required": false, "secret": false, "default": "" }, { "id": "ENV_DATABRICKS_HTTP_PATH", "label": "DATABRICKS_HTTP_PATH", "description": "Databricks: SQL warehouse HTTP path (from the warehouse's Connection Details tab, e.g. /sql/1.0/warehouses/<warehouse-id>). Required to use the databricks engine.", "required": false, "secret": false, "default": "" }, { "id": "ENV_DATABRICKS_TOKEN", "label": "DATABRICKS_TOKEN", "description": "Databricks: personal access token (simplest auth option). Either this or DATABRICKS_CLIENT_ID + DATABRICKS_CLIENT_SECRET is required to use the databricks engine.", "required": false, "secret": true, "default": "" }, { "id": "ENV_DATABRICKS_CLIENT_ID", "label": "DATABRICKS_CLIENT_ID", "description": "Databricks: OAuth machine-to-machine service-principal client ID (preferred for automated use). Requires DATABRICKS_CLIENT_SECRET as well.", "required": false, "secret": false, "default": "" }, { "id": "ENV_DATABRICKS_CLIENT_SECRET", "label": "DATABRICKS_CLIENT_SECRET", "description": "Databricks: OAuth machine-to-machine service-principal client secret. Requires DATABRICKS_CLIENT_ID as well.", "required": false, "secret": true, "default": "" }, { "id": "ENV_COST_GUARD_ALLOW_MULTI_STATEMENT_SQL", "label": "COST_GUARD_ALLOW_MULTI_STATEMENT_SQL", "description": "Set to 1 to let estimate_query_cost/run_query_bounded accept text containing more than one SQL statement. Off by default: the cost cap is only known to cover the single statement the dry run/EXPLAIN priced. Skips only this server's scanner: Snowflake still rejects multi-statement text (sessions are pinned to MULTI_STATEMENT_COUNT=1), and only a single SELECT/WITH/VALUES statement is wrapped in a LIMIT subquery - a script runs unwrapped and its row cap (max_rows, default 1000) is enforced by the paged fetch.", "required": false, "secret": false, "default": "" }, { "id": "ENV_COST_GUARD_ALLOW_WRITE_STATEMENTS", "label": "COST_GUARD_ALLOW_WRITE_STATEMENTS", "description": "Set to 1 (exactly that value) to let estimate_query_cost/run_query_bounded accept statements that are not reads. Off by default: only text whose first keyword (after comments and opening parentheses) is SELECT, WITH, VALUES, SHOW, DESCRIBE, DESC or EXPLAIN is estimated or run - a WITH must be followed by a SELECT or VALUES - because warehouse rows re-enter the model's context and can steer the next call. The gate is defence in depth: the authorisation boundary is the credential's grants (deploy a read-only principal). With COST_GUARD_ALLOW_MULTI_STATEMENT_SQL=1 every statement in the text must be a read, so BigQuery scripts (DECLARE/SET/BEGIN) need both opt-outs. Any other value leaves the gate on.", "required": false, "secret": false, "default": "" }, { "id": "ENV_COST_GUARD_MAX_IN_FLIGHT_QUERIES", "label": "COST_GUARD_MAX_IN_FLIGHT_QUERIES", "description": "Maximum number of run_query_bounded calls allowed in flight at once (positive integer, default 8). A cancelled call keeps its slot until its warehouse query completes or the 120 s watchdog fires; a call over the cap fails with a tool error naming this variable before any warehouse connection is opened.", "required": false, "secret": false, "default": "" }, { "id": "ENV_COST_GUARD_DATABRICKS_ALLOW_WAREHOUSE_START", "label": "COST_GUARD_DATABRICKS_ALLOW_WAREHOUSE_START", "description": "Set to true (exactly that value) to let the read-only Databricks tools (check_credentials, estimate_query_cost) open a session on a SQL warehouse that is not RUNNING, which starts the warehouse and bills compute until it auto-stops. Off by default: the server first reads the warehouse's state through the Warehouses API (GET /api/2.0/sql/warehouses/<id>, CAN_VIEW/CAN_USE suffices) and, unless it is RUNNING - also when the state cannot be read - check_credentials returns ok=false and estimate_query_cost returns no byte or dollar figure, without opening a session. run_query_bounded is not gated: its own pre-execution estimate and the execution may start the warehouse. Any other value leaves the guard on.", "required": false, "secret": false, "default": "" }, { "id": "ENV_COST_GUARD_SNOWFLAKE_ALLOW_WAREHOUSE_RESUME", "label": "COST_GUARD_SNOWFLAKE_ALLOW_WAREHOUSE_RESUME", "description": "Set to true (exactly that value) to let the read-only Snowflake tools run SELECT CURRENT_REGION(), the INFORMATION_SCHEMA.QUERY_HISTORY read and check_credentials' session-context SELECT on a warehouse that is not STARTED, which can resume a suspended AUTO_RESUME warehouse and bill compute until it auto-suspends. Off by default: those statements are skipped unless the pinned warehouse's SHOW WAREHOUSES state is STARTED (also skipped when no warehouse is pinned or the state cannot be read), and the QUERY_HISTORY read is skipped whenever estimate_query_cost is called without a warehouse argument; estimate_query_cost then prices at Gen1 rates with the byte-tier heuristic and says so in a caveat, and check_credentials returns ok=true with a detail built from the SHOW WAREHOUSES row. USE WAREHO", "required": false, "secret": false, "default": "" } ], "requirements": [ "安装 Python 与 uv / uvx" ] }, "provenance": { "registryServer": "io.github.mcpsmiths/cost-guard-mcp", "registryVersion": "0.6.0", "registryUrl": "https://registry.modelcontextprotocol.io/v0.1/servers/io.github.mcpsmiths%2Fcost-guard-mcp/versions/0.6.0", "repository": null, "sourceCommit": null, "namespaceRepositoryOwnerMatched": false, "officialRegistryNamespaceVerified": true, "package": { "registry": "pypi", "identifier": "cost-guard-mcp", "version": "0.6.0", "wheelSha256": "b78bbf09dd27b64ba136879b530a4cb55afb608e9bf30d16f7811e6cd85e9eab", "registryNameMatched": "io.github.mcpsmiths/cost-guard-mcp", "checkedAt": "2026-11-04T17:26:21.609Z" }, "scope": "Install configuration verified; dependency implementation and remote behavior have not been audited" } }