Pre-flight query cost & result-size guardrails for AI agents across BigQuery and Snowflake
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Documented (README)
claude mcp add cost-guard-mcp -- uvx cost-guard-mcp{
"mcpServers": {
"cost-guard-mcp": {
"command": "uvx",
"args": ["cost-guard-mcp"]
}
}
}MCP Servers overview
# cost-guard-mcp
<!-- mcp-name: io.github.mcpsmiths/cost-guard-mcp -->
Pre-flight query cost & result-size guardrails for AI agents, across BigQuery and Snowflake — before the query ever runs.
## Why
An AI agent using a warehouse MCP can silently trigger a full-table scan that costs hundreds of dollars, or return millions of rows that flood its own context window. No existing warehouse MCP tells the agent "how much will this cost" or "how much data will this return" *before* running the query.
## What makes this different
- **Every cost estimate discloses its accuracy tier** — `PRECISE` (BigQuery `dryRun`), `UPPER_BOUND` (Snowflake `EXPLAIN`), or `HEURISTIC` (Databricks, not yet shipped) — so your agent never over-trusts a heuristic number.
- **Per-call bounds** — `run_query_bounded` takes `max_bytes_billed` / `max_rows` / `max_estimated_cost_usd` on each call; no shared session state required.
- **Zero infrastructure** — a single local stdio process. No database, no gateway, no Docker Compose.
## Tools
- `describe_engine_capabilities(engine)` — what's exact vs. approximate for this engine.
- `estimate_query_cost(engine, sql, warehouse?)` — pre-flight cost estimate, tagged with its accuracy tier.
- `run_query_bounded(engine, sql, max_bytes_billed?, max_rows?, max_estimated_cost_usd?)` — refuses to run if the estimate exceeds your bound.
## Setup
### BigQuery
Set `GOOGLE_APPLICATION_CREDENTIALS` to a service-account key file path (or run `gcloud auth application-default login`).
### Snowflake
Set `SNOWFLAKE_ACCOUNT`, `SNOWFLAKE_USER`, `SNOWFLAKE_ROLE` (required — no default, never `ACCOUNTADMIN`), and either `SNOWFLAKE_PRIVATE_KEY_PATH` (preferred) or `SNOWFLAKE_PASSWORD` (discouraged).
### A note on credentials with MCP hosts
Whatever MCP client/host you use (Claude Desktop, etc.) spawns this server as its own subprocess — it does **not** automatically inherit your shell's environment variables, even if they're set in your `.zshrc`/`.bashrc`. Put them directly in the host's server config instead. For Claude Desktop's `claude_desktop_config.json`:
```json
{
"mcpServers": {
"cost-guard-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cost-guard-mcp", "cost-guard-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json",
"BIGQUERY_PROJECT": "your-project-id",
"SNOWFLAKE_ACCOUNT": "your-account",
"SNOWFLAKE_USER": "your-user",
"SNOWFLAKE_ROLE": "your-role",
"SNOWFLAKE_PRIVATE_KEY_PATH": "/path/to/rsa_key.p8"
}
}
}
}
```
## Install
Not yet published to PyPI — for now, clone and run directly:
```bash
git clone https://github.com/mcpsmiths/cost-guard-mcp.git
cd cost-guard-mcp
uv sync
uv run cost-guard-mcp
```
Once published, `uvx cost-guard-mcp` will work as a one-line install.
## Known limitations
- Databricks is not yet supported (deferred past v1).
- Snowflake's `UPPER_BOUND` estimate excludes Cortex AI Function ("AI Credits") cost.
- BigQuery Editions/capacity-billed projects cannot get a dollar estimate — only a byte count (capacity billing has no fixed $/byte rate).
## License
MIT
What people ask about cost-guard-mcp
What is mcpsmiths/cost-guard-mcp?
+
mcpsmiths/cost-guard-mcp is mcp servers for the Claude AI ecosystem. Pre-flight query cost & result-size guardrails for AI agents across BigQuery and Snowflake It has 0 GitHub stars and its last recorded update is dated 2026-09-12.
How do I install cost-guard-mcp?
+
You can install cost-guard-mcp by cloning the repository (https://github.com/mcpsmiths/cost-guard-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is mcpsmiths/cost-guard-mcp safe to use?
+
Our security agent has analyzed mcpsmiths/cost-guard-mcp and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains mcpsmiths/cost-guard-mcp?
+
mcpsmiths/cost-guard-mcp is maintained by mcpsmiths. The last recorded GitHub activity is dated 2026-09-12, with 0 open issues.
Are there alternatives to cost-guard-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy cost-guard-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/mcpsmiths-cost-guard-mcp)<a href="https://claudewave.com/repo/mcpsmiths-cost-guard-mcp"><img src="https://claudewave.com/api/badge/mcpsmiths-cost-guard-mcp" alt="Featured on ClaudeWave: mcpsmiths/cost-guard-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
The fastest path to AI-powered full stack observability, even for lean teams.