Skip to main content

Install Bitrise MCP Server in OpenAI Codex

PrerequisitesClick to copy link​

  1. The latest version of OpenAI Codex installed (the CLI or the IDE extension; see the official Codex documentation)
  2. A Bitrise account
  3. For local setup: Go (>=1.25) installed and a Bitrise PAT

Bitrise MCP Server ConfigurationClick to copy link​

Codex stores MCP servers in a config.toml file, under one [mcp_servers.<name>] table per server. The Codex CLI, the IDE extension, and the Codex desktop app share the same configuration.

  • Global configuration: ~/.codex/config.toml where ~ is your home directory
  • Project-specific: .codex/config.toml in your project directory (Codex loads it for trusted projects only)

You can edit the file by hand or use the codex mcp commands. Start a new Codex session for manual changes to take effect.

The remote server uses OAuth to authenticate you against your Bitrise account. No token to copy or paste.

  1. Add the server:
    codex mcp add bitrise --url https://mcp.bitrise.io
    Or add it to ~/.codex/config.toml yourself:
    [mcp_servers.bitrise]
    url = "https://mcp.bitrise.io"
  2. Sign in:
    codex mcp login bitrise
    Codex opens your browser. Log in to Bitrise (or confirm your existing session) and approve the consent screen. On a machine without a browser, run codex mcp login bitrise --no-browser and open the URL it prints.
  3. Verify that Codex works: Verification.

Fallback: PAT-based authenticationClick to copy link​

If OAuth sign-in doesn't work in your setup, use a Personal Access Token.

  1. Create a Bitrise API Token under Account Settings → Security.
  2. Export the token as an environment variable. To keep it available in every new terminal, add the line to your shell profile, such as ~/.zshrc:
    export BITRISE_TOKEN=your_token_here
  3. Reference the variable in ~/.codex/config.toml. Codex sends its value as a bearer token, so the token itself never goes into the file:
    [mcp_servers.bitrise]
    url = "https://mcp.bitrise.io"
    bearer_token_env_var = "BITRISE_TOKEN"
  4. Restart the Codex app server from a shell where BITRISE_TOKEN is set, so that it picks up the variable:
    codex app-server daemon restart
  5. Verify that Codex works: Verification. Start codex from the same shell.
note

The Codex CLI connects to a background app server, which keeps the environment it was started with. If you export BITRISE_TOKEN after the app server started, Codex doesn't see it until you restart the app server, and opening a new terminal doesn't change that (see the app server daemon README). See also Server shows as failed.

Local Server Setup (Go required)Click to copy link​

The local server runs in stdio mode and authenticates with a Personal Access Token (no browser OAuth flow in stdio mode).

  1. Add Bitrise to Codex. You have two options:

    • Store the token in config.toml. Run:
    codex mcp add bitrise --env BITRISE_TOKEN=YOUR_BITRISE_PAT -- go run github.com/bitrise-io/bitrise-mcp/v2@v2

    Codex writes the token into ~/.codex/config.toml as plain text, under [mcp_servers.bitrise.env], and passes it to the server when it starts. You don't need to export anything in your shell. Anyone who can read the file can read your token, so keep the file private and don't share or commit it.

    • Keep the token out of config.toml. Add the server to ~/.codex/config.toml without the token:
    [mcp_servers.bitrise]
    command = "go"
    args = ["run", "github.com/bitrise-io/bitrise-mcp/v2@v2"]
    env_vars = ["BITRISE_TOKEN"]

    Codex forwards BITRISE_TOKEN from the environment of the Codex app server, so the token stays in your shell environment. Export the token:

    export BITRISE_TOKEN=your_token_here

    Restart the app server from the same shell so that it picks up the variable:

    codex app-server daemon restart
    note

    The Codex CLI connects to a background app server, which keeps the environment it was started with. If you export BITRISE_TOKEN after the app server started, Codex doesn't see it until you restart the app server, and opening a new terminal doesn't change that (see the app server daemon README). See also Server shows as failed.

  2. Verify that Codex works: Verification. With option B, start codex from the same shell.

VerificationClick to copy link​

  1. Check the configured servers:
    codex mcp list
  2. Check the connection in Codex: start Codex with codex, then type /mcp in the composer to see the connected servers and their tools.
  3. Test with a prompt:
    List my Bitrise projects

Advanced configurationClick to copy link​

See Tools for enabling/disabling specific toolsets. To change the toolsets, add the toolset query parameter to the server URL (for the local server, set the ENABLED_TOOLSET environment variable instead):

[mcp_servers.bitrise]
url = "https://mcp.bitrise.io/?toolset=apps,builds,workspaces"

If a task needs a tool from a toolset you haven't enabled, the agent can call list_toolset to find out which toolset to add.

Codex also supports per-server settings such as startup_timeout_sec (default 10 seconds), tool_timeout_sec (default 60 seconds), and the enabled_tools and disabled_tools lists. See the Codex MCP documentation for the full list.

TroubleshootingClick to copy link​

Authentication IssuesClick to copy link​

  • OAuth flow doesn't open a browser: Run codex mcp login bitrise --no-browser and open the URL manually, or fall back to PAT-based authentication
  • Token expired (PAT): Generate a new Bitrise token, update the environment variable, and restart the app server with codex app-server daemon restart
  • Authentication failed: Run codex mcp login bitrise again, or remove the server with codex mcp remove bitrise and repeat the setup
  • Check that a PAT is valid: The Bitrise API takes the token without a Bearer prefix. A 200 response means the token is valid:
    curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: $BITRISE_TOKEN" https://api.bitrise.io/v0.1/me

Configuration IssuesClick to copy link​

Server shows as failedClick to copy link​

If /mcp in Codex shows bitrise: failed (0 tools) and you use a PAT or the local server, the Codex app server probably doesn't have your environment variable. The app server runs in the background and keeps the environment it was started with, so a variable you export later is invisible to it. Run codex doctor to confirm: it reports bearer token env var BITRISE_TOKEN is not set.

  1. Check that the variable is exported in your current shell:
    env | grep -c '^BITRISE_TOKEN='
    The output is 1 when it's exported.
  2. Restart the app server from that shell, then start codex again from the same shell:
    codex app-server daemon restart

If the server still fails, stop the app server with codex app-server daemon stop and start codex again.

Other configuration issuesClick to copy link​

  • Invalid TOML: Check the syntax of ~/.codex/config.toml. Each server needs its own [mcp_servers.<name>] table
  • Project-level config ignored: Codex loads .codex/config.toml only for trusted projects
  • Server doesn't start in time: Raise startup_timeout_sec for the server. The go run command can take longer than the 10-second default on its first run
  • Tools not appearing: Run /mcp in Codex to check the server status, then restart Codex