STACK
MENU
DOCS / MCP / MCP SETUP

Connect STACK

Connect STACK to your AI client, sign in, and start using it.

Guided setup

bash
npx @getstackrun/cli setup

The setup command detects supported clients, lets you choose one or several, configures https://mcp.getstack.run/mcp, and guides you through OAuth. It does not request or handle provider credentials.

Claude Code

bash
claude mcp add --transport http --scope user stack https://mcp.getstack.run/mcp

Open /mcp in Claude Code and authenticate.

OpenAI Codex

bash
codex mcp add stack --url https://mcp.getstack.run/mcp
codex mcp login stack

Other MCP clients

Add a remote Streamable HTTP server named stack with this endpoint:

text
https://mcp.getstack.run/mcp

STACK is listed in the official MCP Registry. Use the registry entry when your client can install registered remote servers directly.

Use OAuth for a person signing in through an MCP client. Automated fleet workers use a short-lived agent session. Keep provider sign-in and credential entry in the Console, provider browser flow or CLI stdin.

OAuth discovery

text
GET https://mcp.getstack.run/.well-known/oauth-protected-resource
GET https://api.getstack.run/.well-known/oauth-authorization-server
  • The MCP resource advertises the STACK authorization server.
  • The client registers, creates a PKCE challenge, and opens the authorization page.
  • You sign in and approve the requested scopes.
  • The client exchanges the code and rotates its refresh token as needed.

Verify the session

Ask the client to list your STACK agents. An empty list is a successful response. A status label or completed browser page does not prove that the MCP call works.

Headless fallback

A fleet worker requests a session with its local agent key, then passes the returned access token as the MCP bearer token. Sessions last up to five minutes. Request a fresh session and reconnect when one expires. The worker keeps its existing Mission and usage.

See MCP Authentication Troubleshooting for discovery, refresh revocation, 401, and 403 errors.

An approved provisioner includes fleet_policy_id when requesting its session. That session can enroll workers for the named policy. Each worker proves possession of its own private key and requests its own session after enrollment.

Workloads using SPIFFE or WIMSE can enroll through the workload endpoints when their issuer, audience and exact subject are listed in the fleet policy. The workload token establishes who may enroll. The new agent's signed challenge proves which key it controls.

stack | Docs