Skip to main content

MCP server that routes SQL queries through the Greybeam proxy while delegating Cortex Search to upstream Snowflake MCP.

Project description

Greybeam MCP

A single MCP server that lets agents query data through the Greybeam routing layer with Snowflake-compatible tooling.

  • run_snowflake_query — executes SQL via the Greybeam proxy (Snowflake protocol).
  • cortex_analyst — calls Snowflake Cortex Analyst; any returned SQL is executed via Greybeam.
  • cortex_search — delegated to the pinned upstream Snowflake MCP (no SQL, REST only).

Out of scope for v1: Cortex Agent, semantic views, and the upstream object_manager / query_manager / semantic_manager tool families. These are locked off in the child config so a misconfigured deployment can't accidentally expose them.

Quick start

Install and run the setup wizard with uv:

uvx greybeam-mcp init

The init wizard prompts for account, user, proxy host, and auth method; writes a config file at ~/.config/greybeam-mcp.yaml (mode 0600); and prints the exact registration command for Claude Code and Claude Desktop.

For a packaged install, the printed command uses this form:

claude mcp add greybeam -- uvx greybeam-mcp --config ~/.config/greybeam-mcp.yaml

Manual install and run

If you'd rather author the YAML by hand, copy examples/greybeam.yaml to a location of your choice, edit it, chmod 600 it, then:

uvx greybeam-mcp --config /absolute/path/to/greybeam.yaml

From a source checkout, use uv run instead:

uv run greybeam-mcp --config /absolute/path/to/greybeam.yaml

Configuration

The YAML is the single source of truth — it holds account, proxy host, and auth credentials. Pick one auth method (in order of recommendation):

  • private_key_file (path to a PEM key, plus optional private_key_passphrase) — recommended, since Snowflake is deprecating password auth
  • private_key (inline PEM contents) — for environments without a writable disk
  • authenticator: externalbrowser for SSO (requires a SAML2 integration on the account)
  • password — deprecated by Snowflake, avoid for new setups

chmod 600 the file since it contains credentials.

Environment variable fallback

Every field above can also come from an environment variable (SNOWFLAKE_USER, SNOWFLAKE_PRIVATE_KEY_FILE, SNOWFLAKE_PRIVATE_KEY_PASSPHRASE, SNOWFLAKE_PRIVATE_KEY, SNOWFLAKE_AUTHENTICATOR, SNOWFLAKE_PASSWORD). YAML takes precedence; envs fill in unset fields. Useful in container/k8s deployments where secrets are mounted as env vars.

Cortex Analyst auth (v1 limitation)

The Cortex Analyst REST endpoint expects Authorization: Bearer <oauth_or_jwt>. The v1 client supports Bearer (token) directly; the password / Basic-auth branch is test scaffolding and will return 401 against real Snowflake. If you need Cortex Analyst in production today, configure an OAuth access token via the token field in code; broader keypair-JWT support is tracked for v1.1.

Client integration

uvx greybeam-mcp init prints registration snippets pre-filled with your config path. The general shapes:

Claude Code (CLI):

claude mcp add greybeam -- uvx greybeam-mcp --config /absolute/path/to/greybeam.yaml

Start a new claude session to pick it up. Verify with claude mcp list.

Claude Desktop: paste the JSON printed by greybeam-mcp init into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or the equivalent on your platform, then restart the app. The installed-package shape is:

{
  "mcpServers": {
    "greybeam": {
      "command": "uvx",
      "args": ["greybeam-mcp", "--config", "/absolute/path/to/greybeam.yaml"]
    }
  }
}

After a successful install, ask the agent something like "run select 1 on snowflake" — it should pick the run_snowflake_query tool automatically.

Statement-type policy

Greybeam MCP does not enforce statement-type restrictions at the MCP layer. CREATE / DROP / ALTER and other potentially destructive statements are subject to:

  1. Greybeam backend routing and policy.
  2. Your Snowflake role's grants on the target objects.

If you need hard MCP-layer restrictions, scope the Snowflake role tightly or contact Greybeam about backend policy options. This is an intentional v1 divergence from upstream Snowflake MCP, which blocks DDL by default — see the design doc for rationale.

Cancellation

v1 bounds in-flight calls via two driver-level mechanisms inside run_snowflake_query:

  1. cursor.execute(timeout=greybeam.query_timeout) — Snowflake's own query timeout.
  2. Explicit cursor.close() on row-cap / byte-cap exceedance (acquires the driver's _lock_canceling and aborts the in-flight query).

Client-driven cancellation (notifications/cancelled) is not wired in v1. The CancelToken primitive, dispatcher in-flight table, and delegated-cancel forwarding are scaffolding retained and unit-tested so v1.1 can light them up by adding a notifications/cancelled handler.

Development

uv sync --extra dev
uv run pytest

To run the server from a local clone instead of the PyPI package:

uv run greybeam-mcp init

The wizard detects the source checkout and prints registration commands using uv --directory /absolute/path/to/greybeam-mcp run greybeam-mcp ..., so local development can point clients at unpublished changes.

The default suite runs unit + always-on contract tests (no network, no DB). Two test layers are gated behind environment variables:

Contract tests against the real upstream child (requires real Snowflake credentials — placeholders are not enough because the upstream child may validate at startup):

GREYBEAM_RUN_CHILD_CONTRACT=1 \
  SNOWFLAKE_ACCOUNT=... SNOWFLAKE_USER=... SNOWFLAKE_PASSWORD=... \
  uv run pytest tests/contract/

Integration tests against a real Greybeam dev endpoint:

GREYBEAM_RUN_INTEGRATION=1 \
  SNOWFLAKE_ACCOUNT=... SNOWFLAKE_USER=... SNOWFLAKE_PASSWORD=... \
  GREYBEAM_PROXY_HOST=greybeam-dev.example.com \
  uv run pytest tests/integration/

The upstream Snowflake MCP package is pinned at snowflake-labs-mcp==1.4.1 (import name mcp_server_snowflake). Bumping that pin should re-run the child contract snapshot test and re-approve tests/contract/fixtures/child_tools_list.json if the surface drifted.

Design doc: docs/superpowers/specs/2026-04-24-greybeam-mcp-design.md.

Release

Build and verify locally before publishing:

uv build --no-sources
uv run pytest
uv run ruff check src/ tests/

Preferred publish path:

  1. Create a GitHub environment named pypi.
  2. Configure a pending PyPI Trusted Publisher for project greybeam-mcp, this repository, the pypi environment, and .github/workflows/publish.yml.
  3. Create a GitHub release for a tag whose version matches pyproject.toml.

Manual fallback, if Trusted Publishing is not configured yet:

uv publish --token pypi-...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greybeam_mcp-0.1.0.tar.gz (156.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

greybeam_mcp-0.1.0-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file greybeam_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: greybeam_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 156.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for greybeam_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb493954d76161cb3b7f751f89b704b0c82121b1b9b6f31a5e4f5986dc0b9be2
MD5 e1fc55a1300ff6fc42b374839fa46291
BLAKE2b-256 c69095191d006db9489316bf89fd371b23c726f2485ff06a77ee62d8da553d95

See more details on using hashes here.

File details

Details for the file greybeam_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: greybeam_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for greybeam_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e8e1332ac89d56f42d5bc2f7ca3ef546a41583a5591c6685dc7c8d5a95fffad
MD5 07ab6f766f35bb65bed5b3022987daf7
BLAKE2b-256 ec97fa8118272fb3043ffbc9b755eebd55f1f0b8f3ff3cee78551a745e52e56f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page