Connect Claude Code to the CloudBees CI MCP Router

2 minute read

Claude Code is an AI-powered command-line interface (CLI) tool that integrates with the CloudBees CI MCP Router through the MCP Server plugin, connecting your development environment to CloudBees CI. This enables context-aware code suggestions and automation using real CloudBees CI data, so you can interact with Jenkins resources directly from your development environment.

Prerequisites

Before you begin, ensure that you have:

Connect Claude Code

After completing the prerequisites, connect Claude Code to the CloudBees CI MCP Router using the authentication method you configured.

Connect with OAuth

With OAuth, you do not need to pass credentials to the command line. You sign in once, and the CloudBees CI MCP Router handles the rest.

To connect Claude Code to the CloudBees CI MCP Router:

  1. Open a terminal on the machine where Claude Code is installed.

  2. Run the following command to add CloudBees CI MCP Router to Claude Code:

    claude mcp add ci-mcp-router <router-url> --transport http --client-id ci-mcp-client(1)
    ▼
    1 Replace <router-url> with the MCP endpoint of your CloudBees CI MCP Router: http://localhost:9000/mcp for a local Docker deployment, or https://<cluster-domain>/mcp-router/mcp for a Helm deployment.

    The --client-id ci-mcp-client flag selects the pre-seeded public client. Without it, Claude Code attempts dynamic client registration, which is disabled by default and fails with a 403 error.

  3. Start Claude Code:

    claude
    ▼
  4. Run the /mcp command:

    /mcp
    ▼
  5. Select the ci-mcp-router server. A browser launches with an approval prompt. After you approve, Claude Code reuses the session for later requests.

Connect with an API token

Authenticating with an API token will be deprecated in the future. For new deployments, CloudBees recommends that you use OAuth, which authenticates each request individually rather than relying on a shared token.

To connect Claude Code to the CloudBees CI MCP Router:

  1. Open a terminal on the machine where Claude Code is installed.

  2. Run the following command to add CloudBees CI MCP Router to Claude Code, including the encoded HTTP basic authentication credentials you generated in Authenticate with an API token:

    claude mcp add ci-mcp-router http://localhost:9000/mcp --transport http --header "Authorization: Basic dXNlcm5hbWU6dG9rZW4="(1)
    ▼
    1 Replace dXNlcm5hbWU6dG9rZW4= with your actual encoded credentials.

    Passing the encoded credential directly in this command leaves it in your shell history, and storing it as plain text in your MCP configuration file leaves it exposed to any process that can read that file.

    Claude Code lets you reference an environment variable in the header value instead of the literal credential. For more information, refer to Environment variable expansion in .mcp.json for details.

    If properly configured, a confirmation message similar to the following is returned:

    The CloudBees CI MCP Router has been successfully added to your Claude Code configuration. It's now configured to connect to your local Jenkins instance at http://localhost:9000/mcp with the provided authorization header.
    ▼
  3. Start Claude Code:

    claude
    ▼

    Claude Code connects using the credentials you provided.

Use Claude Code for development tasks

Now that Claude Code is connected to the CloudBees CI MCP Router, you can use the following tools and commands to accelerate your development workflow. For a list of supported tools, refer to CloudBees CI MCP Router tool reference.