Setup
Setup
Quick start
Run the guided setup to configure authentication and your MCP client in one step:
npx @_davideast/stitch-mcp initThe wizard handles authentication, project selection, and MCP client configuration. You can skip prompts with flags:
npx @_davideast/stitch-mcp init --client cursor --transport stdioThe init wizard
The wizard walks through 9 steps:
- Client selection — pick your MCP client (Claude Code, VS Code, Cursor, Gemini CLI, Codex, OpenCode, or Antigravity)
- Auth mode — choose between API key or OAuth
- gcloud install — ensures Google Cloud CLI is installed (OAuth only, skipped for API key)
- Authentication — runs
gcloud auth loginandgcloud auth application-default login(OAuth only) - Transport — choose direct HTTP or stdio proxy connection
- Project selection — pick a Google Cloud project (OAuth only)
- IAM & API enablement — checks IAM role, installs gcloud beta, enables the Stitch API (OAuth only)
- Config generation — generates MCP config for your chosen client
- Connection test — verifies the Stitch API is reachable (OAuth only)
Authentication modes
API key (recommended)
An API key is a single string that authenticates your requests. No gcloud, no token refresh, no project setup.
There are three ways to provide it:
Through the init wizard — select “API Key” when prompted for auth mode. The wizard can store the key in your config file or a .env file for you.
In your MCP client config — add STITCH_API_KEY to the env block (for stdio/proxy) or X-Goog-Api-Key as a header (for HTTP/direct). See Connect your agent for the exact config format for each client.
As an environment variable:
export STITCH_API_KEY="your-api-key"Or in a .env file in your project root:
STITCH_API_KEY=your-api-keyOAuth
OAuth uses Google Cloud credentials for authentication. The init wizard handles the full setup — it installs a bundled gcloud SDK at ~/.stitch-mcp/ (separate from your system gcloud), authenticates you, selects a project, enables the Stitch API, and generates your MCP config.
npx @_davideast/stitch-mcp initSelect “OAuth” when prompted for auth mode.
Manual gcloud
If you already have gcloud installed and configured:
gcloud auth application-default login
gcloud config set project <PROJECT_ID>
gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>Then set STITCH_USE_SYSTEM_GCLOUD=1 in your MCP client config so the proxy uses your system gcloud instead of the bundled one. See Connect your agent for config examples.
Environment variables
See Command Reference — Environment variables for the full list. The most common ones used during setup:
STITCH_API_KEY— API key for direct authentication (skips OAuth)STITCH_PROJECT_ID— Override project IDSTITCH_USE_SYSTEM_GCLOUD— Use system gcloud instead of bundled config
Verifying your setup
Run doctor to check that everything is configured:
npx @_davideast/stitch-mcp doctorAdd --verbose for detailed error information:
npx @_davideast/stitch-mcp doctor --verboseThe 7 checks:
| Check | What it verifies |
|---|---|
| API Key Detected | STITCH_API_KEY is present and non-empty (API key mode) |
| gcloud Installed | gcloud CLI is installed with version >= 400.0.0 (OAuth mode) |
| Authentication | User is authenticated with gcloud (OAuth mode) |
| Application Default Credentials | ADC credentials are configured (OAuth mode) |
| Project Configured | An active Google Cloud project is set (OAuth mode) |
| API Key Connection | Stitch API responds using the API key (API key mode) |
| API Connection | Stitch API responds using OAuth token and project (OAuth mode) |
Special environments
WSL / SSH / Docker
Browser-based OAuth may not work automatically in headless environments. When init detects WSL, SSH, or Docker, it prints the OAuth URL to the terminal. Copy it and open it in a browser on another machine.
Cloud Shell
Cloud Shell is detected automatically. The same copy-the-URL workaround applies.
CI / headless servers
Use API key authentication in CI environments where browser auth isn’t possible.