stackql-mcp
Embedded StackQL MCP server for Rust agentic apps. StackQL exposes cloud providers (AWS, GitHub, Google, Azure, and more) as SQL tables; this crate acquires the stackql binary, launches it as an MCP server over stdio, and hands you a connected rmcp client.
Quickstart
use ;
async
Run it: cargo run --example minimal. The github provider in null_auth mode needs no cloud credentials.
Acquisition modes
Two ways to get the server binary, both behind the same API:
- sidecar (default feature): downloads the platform's
.mcpbbundle at first run, verifies its sha256 against pins baked into the crate, and caches it. Subsequent starts are offline. - vendored (
vendoredfeature): embed the bundle in your binary and extract it on first run - no network at runtime, a single shippable binary:
let server = builder
.bundle_bytes
.start
.await?;
Bundles are published per release at stackql/stackql by packaging/mcpb, which also owns this crate. The crate version equals the stackql release it embeds (pin the minor: stackql-mcp = "0.10"), and its per-platform sha256 pins come from platforms.json, rendered by packaging/mcpb/scripts/render-platforms.sh from the published .mcpb.sha256 release assets - the same manifest the npm, PyPI and other SDK wrappers use. Downloads go through https://releases.stackql.io with User-Agent: stackql-mcp-server-cargo/<version>. Platforms: linux-x64, linux-arm64, windows-x64, darwin-universal.
Safety modes
The server enforces a safety contract per session; the crate defaults to the most restrictive.
| Mode | Allows |
|---|---|
Mode::ReadOnly (default) |
SELECT and metadata tools only |
Mode::Safe |
reads plus non-destructive mutations |
Mode::DeleteSafe |
safe plus deletes |
Mode::FullAccess |
everything, including lifecycle provisioning |
Escalation is an explicit caller opt-in via .mode(...).
Cache and overrides
The binary cache is shared with the StackQL npm and PyPI wrappers: ~/.stackql/mcp-server-bin/<version>/<platform>/. Existing cache entries are used before any download.
Env overrides:
STACKQL_MCP_BIN: path to a stackql binary to run directly (skips acquisition)STACKQL_MCP_BUNDLE: path to a local.mcpbto extract instead of downloading
Builder equivalents: .binary(path), .bundle_path(path), plus .approot(path) to relocate StackQL's application root (default ~/.stackql).
If you bring your own MCP stack, Builder::command() returns a std::process::Command preloaded with the canonical launch arguments instead of starting anything.
Demo apps
The demo apps that used to live alongside this crate (auditron, a terminal compliance copilot, and stackql-agent, a rig-based agent) now live in stackql-labs and depend on the published crate. The vendored single-binary path they use is fetch_bundle + include_bundle!:
BUNDLE=
STACKQL_MCP_BUNDLE_FILE=
Development
&&
MSRV: 1.88 (set by rmcp 1.x).
License
MIT