Skip to main content

Crate stackql_mcp

Crate stackql_mcp 

Source
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 (vendored feature): embed the .mcpb with include_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 with Builder::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.
RunningServer
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.
StackqlMcp
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.mode in 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.

Type Aliases§

Result