Expand description
Embedded StackQL MCP server for Rust agentic apps.
StackQL exposes cloud providers (AWS, GitHub, Google, Azure, …) as SQL
tables, served over the Model Context Protocol. This crate acquires the
stackql binary, launches it as an MCP server over stdio, and hands you a
connected rmcp client.
Two acquisition modes behind one API:
- sidecar (default feature): download the platform’s .mcpb bundle at first
run, verify its sha256 against pins baked into the crate, and cache it
under
~/.stackql/mcp-server-bin/(shared with the npm and PyPI wrappers) - vendored (
vendoredfeature): embed the .mcpb withinclude_bytes!and extract on first run - no network at runtime, single shippable binary
use stackql_mcp::{Mode, StackqlMcp};
let server = StackqlMcp::builder()
.mode(Mode::ReadOnly)
.auth(serde_json::json!({"github": {"type": "null_auth"}}))
.start()
.await?;
let tools = server.list_all_tools().await?;
println!("{} tools available", tools.len());
server.shutdown().await?;Macros§
- include_
bundle - Embed the .mcpb bundle named by the compile-time env var
STACKQL_MCP_BUNDLE_FILE, for use withBuilder::bundle_bytes(vendored feature):
Structs§
- Builder
- Configures and starts the embedded server.
- Pin
- A pinned bundle: name and sha256 as published on the GitHub release.
- Running
Server - A running embedded server: the child process handle plus a connected
rmcp client. Derefs to the client, so rmcp peer methods
(
list_all_tools,call_tool, …) are available directly. - Stackql
Mcp - Entry point. See the crate docs for the full example.
Enums§
- Error
- Errors produced while acquiring, verifying, or running the embedded server.
- Mode
- Safety contract for query / mutation / lifecycle tools, enforced
server-side. Maps to
server.modein the server’s--mcp.config. - Platform
- A platform the packaging repo publishes a .mcpb bundle for.
Constants§
- ENV_BIN
- Path to a stackql binary to run directly, skipping acquisition entirely.
- ENV_
BUNDLE - Path to a local .mcpb bundle to extract instead of downloading.
- PINS
- STACKQL_
VERSION - The stackql release this crate version pins (release.yaml in the packaging repo, leading v stripped).
Functions§
- fetch_
bundle - Download the pinned .mcpb bundle for the host platform into the shared cache (verified against the baked sha256 pin) and return its path. Skips the download when a verified copy is already present.