> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Jenkins

> Connect Jenkins CI/CD server to CloudThinker for build pipeline monitoring, job analysis, and deployment tracking

Connect your self-hosted Jenkins server to enable CloudThinker agents to monitor builds, analyze test results, review pipeline logs, and manage job operations. Jenkins authenticates with a **username and API token** over the Jenkins MCP Server Plugin.

***

## Prerequisites

* A **self-hosted Jenkins** instance running version 2.x or later (cloud-hosted Jenkins is not supported).
* The **[Jenkins MCP Server Plugin](https://github.com/jenkinsci/mcp-server-plugin)** installed on your server; the default MCP port is `9090`.
* Admin access to Jenkins to configure the root URL and create credentials.

<Info>
  Cloud-hosted Jenkins services are not supported. This connection requires the Jenkins MCP Server Plugin.
</Info>

***

## Setup

<Steps>
  <Step title="Configure the root URL">
    The MCP Server Plugin requires Jenkins to have a root URL configured to return correct job links. Run the following in the Jenkins Script Console:

    ```bash theme={null}
    COOKIE_JAR=/tmp/jenkins_cookies
    CRUMB=$(curl -s -c $COOKIE_JAR -u "admin:<password>" \
      'http://<host-ip>:9090/crumbIssuer/api/json' | python3 -c "import json,sys; print(json.load(sys.stdin)['crumb'])")

    curl -s -X POST "http://<host-ip>:9090/scriptText" \
      -b $COOKIE_JAR -u "admin:<password>" -H "Jenkins-Crumb: $CRUMB" \
      --data-urlencode "script=
    import jenkins.model.JenkinsLocationConfiguration
    def loc = JenkinsLocationConfiguration.get()
    loc.setUrl('http://<host-ip>:9090/')
    loc.save()
    println('Root URL set to: ' + loc.getUrl())
    "
    ```
  </Step>

  <Step title="Verify the MCP endpoint">
    Confirm the plugin is running before connecting:

    ```bash theme={null}
    curl -s http://<host-ip>:9090/mcp-health/
    ```
  </Step>

  <Step title="Add the connection in CloudThinker">
    Navigate to **Connections → Jenkins** and enter:

    * **URL**: `http://<host-ip>:9090`
    * **Username**: `admin`
    * **API Token**: your Jenkins admin password or API token

    Click **Connect**. CloudThinker verifies the credentials and shows a **Connected** status.
  </Step>
</Steps>

***

## Connection details

| Field         | Description                         | Example                     |
| ------------- | ----------------------------------- | --------------------------- |
| **URL**       | Base URL of your Jenkins instance   | `http://192.168.1.100:9090` |
| **Username**  | Jenkins username                    | `admin`                     |
| **API Token** | Jenkins admin password or API token | —                           |

***

## Required permissions

Grant the Jenkins user the following permissions:

* **Overall**: Read
* **Job**: Read, Discover
* **View**: Read

<Tip>
  Create a dedicated Jenkins user for CloudThinker with only these permissions. Keep write operations (trigger builds, replay pipelines) approval-gated.
</Tip>

***

## Agent capabilities

Once connected, agents can monitor and investigate your Jenkins pipelines.

| Capability           | Description                                                 |
| -------------------- | ----------------------------------------------------------- |
| **Build monitoring** | List jobs and check build status                            |
| **Log analysis**     | Retrieve and search build logs                              |
| **Test results**     | View test outcomes                                          |
| **SCM integration**  | View Git changes and commits                                |
| **Job controls**     | Trigger builds and replay pipelines — **requires approval** |

### Verify the connection

```text theme={null}
@alex list all Jenkins jobs and show the last build status for each
```

### Example prompts

```text theme={null}
@alex search Jenkins build logs for errors in the last 10 builds and #recommend fixes
@alex show test results for the main project's recent builds and #report failures
@alex check the Jenkins build queue and identify any stuck jobs
```

***

## Troubleshooting

<Accordion title="Connection timeout">
  Verify Jenkins is running and that port 9090 is reachable from CloudThinker. Use the host IP address (not `localhost`) in the URL field.
</Accordion>

<Accordion title="Empty job list">
  The root URL has not been configured or the Script Console command failed. Re-run the Script Console command in Setup and reconnect.
</Accordion>

<Accordion title="Authentication failed">
  The username or API token is incorrect, or the user lacks the required permissions. Verify the credentials and that the Jenkins user has Overall Read, Job Read, and View Read access.
</Accordion>

***

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **Dedicated user** — create a dedicated Jenkins user for CloudThinker scoped to only the jobs and views it needs.
- **Network isolation** — restrict Jenkins port 9090 to CloudThinker's IP range or use a VPN; avoid exposing the Jenkins UI to the public internet.

***

## Related

<CardGroup cols={2}>
  <Card title="MCP Connections" icon="https://mintcdn.com/cloudthinker/aLd-ttc-SCW-aFky/images/icons/mcp.svg?fit=max&auto=format&n=aLd-ttc-SCW-aFky&q=85&s=c89b6087a9d233901dea5e354452eff6" href="/guide/connections/mcp" width="24" height="24" data-path="images/icons/mcp.svg">
    Connect custom tools via Model Context Protocol
  </Card>

  <Card title="Kubernetes Connection" icon="https://mintcdn.com/cloudthinker/aLd-ttc-SCW-aFky/images/icons/kubernetes.svg?fit=max&auto=format&n=aLd-ttc-SCW-aFky&q=85&s=7c03292954ff635a1994623a5c39971b" href="/guide/connections/kubernetes" width="24" height="24" data-path="images/icons/kubernetes.svg">
    Connect Kubernetes clusters
  </Card>
</CardGroup>
