Skip to content

MCP for Claude Code and Codex

Paste a pull request URL into chat to find the failed step and read the surrounding logs. You can also register a team secret by entering its value in your local browser.

Claude Code and Codex start the Model Context Protocol (MCP) server included in the OpenCI CLI by running openci mcp. On the machine where you run your client, install the CLI with Dart 3.11.5 or later and sign in to OpenCI with your email address and password.

Terminal window
dart install openci_cli_plus
openci login
openci status

Check that openci status shows the team connected to the repository you want to investigate. The MCP server uses that team. For first-time login with multiple teams or switching with openci switch team, see the CLI reference.

Run the commands for your client in a terminal. The plugin includes the MCP server configuration and these skills.

  • investigate-ci helps diagnose failed builds using job status and logs.
  • configure-android-patrol helps write or review Flutter Patrol workflows for Android emulators.
  • configure-flutter-goldens shows how to capture Flutter golden images on Linux and compare them in a Linux pull request workflow for visual regression testing (VRT).
Terminal window
claude plugin marketplace add openci-org/openci
claude plugin install openci@openci-plugins
Terminal window
codex plugin marketplace add openci-org/openci
codex plugin add openci@openci-plugins

Open a new Claude Code or Codex CLI session and use /mcp to check the OpenCI connection. Try this with the URL of a PR that ran on OpenCI.

Which CI step failed on https://github.com/OWNER/REPO/pull/123? Show me the log lines around the error and the dashboard link for that job.

  1. find_jobs takes the PR URL (pr_url) and searches jobs across its commits. To investigate a specific revision, include its full commit SHA (commit_sha). For a build without a PR, supply repository and the full SHA. Use owner/repo for GitHub.com or the HTTPS repository URL for GitHub Enterprise.
  2. get_job_logs takes the selected job_id and returns an excerpt from the current attempt. If a failed step was recorded, its name appears in failed_step. On OpenCI Cloud, dashboard_url opens the job.

If a retry passed, try asking, “Show me the iOS logs from the attempt that failed before the retry.” When that attempt appears in recent_runs, pass its OpenCI run_id along with the job_id. To read more, keep the same job_id and run_id. Pass first_cursor as cursor to read from the start, or next_cursor to continue.

With OpenCI CLI 0.12.0 or later, use find_jobs to select a QUEUED or IN_PROGRESS job in the active team. Pass its job_id and its retry_count as expected_retry_count to cancel_job. A successful call returns CANCELLED. Running workers clean up asynchronously. Repeating the request with the same values targets the same attempt.

With OpenCI CLI 0.11.0 or later, you can start registration by giving the assistant just the secret name.

Open the form to register API_TOKEN for my current OpenCI team.

register_secret opens a one-time form in your local browser. Check the team and name, enter the single-line value in the masked field, and save. Saving replaces the value of an existing secret with the same name. The chat receives the save result, secret name, and team ID. To reference a new name in a workflow, run openci sync --secrets in that checkout. Manage secrets

If you only want the MCP tools, register openci mcp as a local stdio server in your client. Installing the plugin already configures this server.

Claude Code

Terminal window
claude mcp add --scope user --transport stdio openci -- openci mcp

Codex

Terminal window
codex mcp add openci -- openci mcp

Open a new session and use /mcp to check the connection. Claude Code MCP settings · Codex MCP settings

  • Server fails to start. Run openci --version from the terminal you use to launch the client. If the command is missing, add the directory containing the openci executable to PATH and reopen the client. Reading jobs and logs requires CLI 0.9.0 or later. Registering secrets requires 0.11.0 or later. Run openci update to upgrade.
  • No matching jobs. Check the team with openci status. If a search returns next_cursor, follow it with the same search filters, even if the current page is empty.
  • Empty or expired logs. Check the job status and the recorded failure_summary, if available.