> ## Documentation Index
> Fetch the complete documentation index at: https://docs.struct.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connections

> Struct CLI reference: connections.

Use the Struct CLI to inspect and configure the workspace from your terminal. Commands run with the permissions of the active login.

Use a claimed workspace with permission to configure connections. Start with the server's catalog rather than guessing flags:

```bash theme={null}
struct connections catalog
struct connections catalog datadog --json
struct connections list --json
```

The catalog supplies required fields, flags, environment variables and permissions for the provider. Provider-specific recipes are in [Integrations](https://docs.struct.ai/integrations/overview.md). Secrets come from environment variables, stdin or a hidden terminal prompt; avoid literal secret arguments that can enter shell history.

For AWS, Azure, Google Cloud, Kubernetes and Snowflake, `struct connect <provider> --print-commands` prints setup/grant commands. An authorized operator executes them with the provider's tools, then completes the connection. The catalog identifies additional required arguments. For example, `struct connect aws --print-commands` includes the External ID made for this workspace; preserve it in the role setup.

## Connect and select resources

| Command | What it does |
| - | - |
| `struct mcp install --client <claude\|cursor\|codex>` | Add Struct to Claude Code, Cursor or Codex using only the server URL; the agent signs in to Struct itself. For Codex it writes `[mcp_servers.struct]` to `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`); then run `codex mcp login struct`. `--print` prints the command, link or configuration instead. |
| `struct mcp url` | Print the Struct MCP server URL for any other MCP client. |
| `struct connect <provider>` | Connect Datadog, Grafana, Loki, Prometheus, Axiom, Better Stack, Mezmo, SumoLogic or Render with its API key, for example `DATADOG_API_KEY=… DATADOG_APP_KEY=… struct connect datadog --site us5`. Struct checks the key with the tool, saves it and tests the saved connection; `connection.health` says whether the access Struct needs is there. `struct connections catalog <provider>` lists each tool's flags and environment variables. Secrets come from environment variables, stdin (`--api-key-stdin` and the like, or `--stdin`) or a hidden prompt; a secret given as a flag works with a warning. `--name` and `--instructions` are optional. Connecting the same account again updates its connection (`"created": false`). Needs permission to change connections. |
| `struct connect postgres\|planetscale\|bigquery` | Connect a database, for example `PGPASSWORD=… struct connect postgres --host db.example.com --database app --user struct_reader`, `PLANETSCALE_PASSWORD=… struct connect planetscale --host … --database … --user …` or `struct connect bigquery --project my-project --key-file sa.json`. Struct connects to the database first and saves nothing if that fails (`credentials_rejected`, `missing_access`, `connection_failed`). Passwords come from environment variables; `--connection-string-env <NAME>` reads a whole PostgreSQL connection string from the variable you name (any secret takes `--<flag>-env <NAME>`). `--test-only` checks the values and saves nothing. For an [SSH tunnel](https://docs.struct.ai/integrations/ssh-tunnels.md#connect-from-the-cli), `--trust-host-key SHA256:…` names the bastion key you checked; without it the command exits `3` with the fingerprint Struct read. BigQuery needs the Pro plan (`plan_required`). See [PostgreSQL](https://docs.struct.ai/integrations/postgresql.md), [PlanetScale](https://docs.struct.ai/integrations/planetscale.md) and [BigQuery](https://docs.struct.ai/integrations/bigquery.md). |
| `struct connect snowflake` | Connect Snowflake with a key pair Struct makes and keeps (you never see the private key). First `struct connect snowflake --print-commands --account myorg-myaccount [--user STRUCT_READER] [--warehouse COMPUTE_WH]` prints the setup SQL with the public key and a key pair ID (`sfk_…`, valid 24 hours); run all of it in Snowsight as an admin. Then `struct connect snowflake --account myorg-myaccount --user STRUCT_READER --key-pair sfk_… --name "Snowflake"` tests the key and saves the connection (nothing is saved if the test fails; run the SQL and try again with the same key pair). Without `--key-pair` (or `SNOWFLAKE_KEY_PAIR`) it exits `2` with `missing_fields`. `--test-only` checks without saving. See [Snowflake](https://docs.struct.ai/integrations/snowflake.md). |
| `struct connections rotate <id> --print-commands`, `struct connections rotate <id> --key-pair sfk_…` | Replace a Snowflake connection's key without downtime. `--print-commands` makes a new key pair for that connection and prints the `ALTER USER … SET RSA_PUBLIC_KEY_2` (or `RSA_PUBLIC_KEY`) statement that adds it next to the current key; run it in Snowsight. `--key-pair` then tests the new key, switches to it and tells you how to remove the old one. No secret is read (`--stdin` is refused). |
| `struct connect custom-mcp --url <url> --auth none\|bearer\|header\|oauth` | Connect a remote MCP server, for example `MCP_AUTH_VALUE=… struct connect custom-mcp --url https://mcp.example.com/mcp --auth bearer --name "Docs MCP"`. The token or header value comes from `MCP_AUTH_VALUE`; a custom header also takes `--auth-header-name`. Struct lists the server's tools first and saves nothing if that fails (`connection_failed`). With `--auth oauth` the CLI prints a sign-in link (and opens it when this machine has a browser), waits up to 10 minutes while you approve Struct on the MCP server, then saves; the sign-in works only for you, in this workspace, for this URL. A declined sign-in exits `1` with `oauth_failed`, an expired one with `oauth_session_expired`. See [Custom MCP connectors](https://docs.struct.ai/integrations/custom-mcp.md). |
| `struct connections enable <id>`, `struct connections disable <id>` | Include a custom MCP server in agent runs, or keep it out without removing it. |
| `struct connections ssh-host-key --ssh-host <host>` | Show an SSH bastion's host key fingerprint, read without logging in, to check before `--trust-host-key`. `--ssh-port` (default 22); for a bastion behind an EC2 Instance Connect Endpoint, `--ssh-endpoint-id`, `--ssh-instance-id` and `--ssh-aws-connection <id>` instead of `--ssh-host`. |
| `struct connect github\|slack\|sentry\|linear\|jira\|asana\|notion` | Connect an app you approve in a browser. Prints the link first, opens it when this machine has a browser, then waits. Open it in a browser signed in to Struct as the same user the CLI is logged in as: it works once, in that one browser, for 10 minutes. An app that is already connected says so (GitHub still applies `--repo` if supplied); `--reauth` reconnects it (same organization, site or workspace). When your login reaches several, choose in the browser or pass `--org` (GitHub, Sentry), `--site` (Jira) or `--workspace` (Asana). `--repo owner/name` (GitHub) also sets the default repository. `--no-browser`, `--timeout <seconds>` (default 600). Linear, Jira and Asana need the Pro plan (`plan_required`). Needs the configure permission. |
| `struct notion pages <connection-id>` / `configure <connection-id>` | Notion is in private preview and read-only; check availability with `struct connections catalog notion`. Connecting grants no page access until you configure it: `pages` lists the configured roots, or explores candidates with `--scope workspace` (optionally `--query`), and `configure --root <page-id> --mode read` saves page roots and tools, keeping omitted settings. See [Notion](https://docs.struct.ai/integrations/notion). |
| `struct github repos`, `struct github set-repo <owner/name>` | List the repositories the Struct GitHub App can access (`*` marks the default), or set the default; it must be one the app can access (`repository_not_found`). |
| `struct sentry orgs`, `struct sentry set-org <slug>` | List the organizations the connected Sentry user belongs to, or choose the one Struct reads (`organization_not_found` otherwise). |
| `struct slack channels list`, `struct slack channels join <channel>` | Search the workspace's channels (`--query <text>`, `--archived`, `--limit <1-100>`, `--cursor`), or have Struct's bot join a public channel by id, `#name` or link (safe to repeat; invite it to private channels in Slack: `private_channel`). |

## Inspect, test and maintain

| Command | What it does |
| - | - |
| `struct connections list` | List configured connections and health; inspect `--help` for filters |
| `struct connections show <id>` | Read a connection's fields, health and missing permissions without revealing secrets |
| `struct connections test <id>` | Test a saved connection; inspect the returned `ok` and `health`, not only the exit code |
| `struct connections test --provider <provider> --field key=value` | Test supplied fields without saving; use `--field-file key=path` for file input and documented secret inputs |
| `struct connections grant-command <id>` | Print available instructions for granting missing provider permissions |
| `struct connections update <id>` | Change supported non-secret fields; use `--help` for the provider-specific options |
| `struct connections rotate <id>` | Replace credentials using the provider's supported secret input or key-pair flow |
| `struct connections remove <id> --yes` | Remove a connection; confirm its effect before running in a setup script |

A healthy connection proves the access that was checked. It does not prove application telemetry arrived or a monitor delivered an alert. Do not add grants just because a broad provider role would make a test pass; use the [permission catalog](https://docs.struct.ai/reference/permission-changes.md).

## Three different MCP uses

* **Struct MCP in your current client:** `struct mcp install` supplies Struct's product server URL; the client performs its own OAuth. For Codex, run `codex mcp login struct`; in Claude Code, use `/mcp` to sign in.
* **A custom MCP server connected to Struct:** `struct connect custom-mcp` lets Struct use that server's tools. It is an integration with separate credentials.
* **Documentation search:** use the docs site's MCP, Markdown and indexes to read documentation. They do not authenticate you to a Struct workspace.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.