> ## 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 Jenkins CI/CD server to enable CloudThinker agents to monitor builds, analyze test results, review pipeline logs, and manage job operations.

<Info>
  This guide requires the [Jenkins MCP Server Plugin](https://github.com/jenkinsci/mcp-server-plugin). Cloud-hosted Jenkins services are not supported.
</Info>

***

## Supported Platforms

| Platform                | Support                     |
| ----------------------- | --------------------------- |
| **Self-hosted Jenkins** | 2.x+ with MCP Server Plugin |

***

## Setup

<Steps>
  <Step title="Access Jenkins">
    Ensure Jenkins is running and accessible. The default MCP port is `9090`.
  </Step>

  <Step title="Configure Root URL">
    Required for the MCP server to return job results. Configure via 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="Add Connection in CloudThinker">
    Navigate to **Connections → Jenkins** and enter:

    * **URL**: `http://<host-ip>:9090`
    * **Username**: `admin`
    * **API Token**: Your admin password
  </Step>
</Steps>

***

## Verify MCP Endpoint

Test before adding to CloudThinker:

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

***

## Required Permissions

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

***

## Agent Capabilities

| Capability           | Description                         |
| -------------------- | ----------------------------------- |
| **Build Monitoring** | List jobs, check build status       |
| **Log Analysis**     | Retrieve and search build logs      |
| **Test Results**     | View test outcomes                  |
| **Pipeline Replay**  | Re-run builds with modified scripts |
| **SCM Integration**  | View Git changes and commits        |
| **Job Management**   | Trigger builds, check queue status  |

### Example Prompts

```bash theme={null}
@alex list all Jenkins jobs and their last build status
@alex show test results for recent builds
@alex search build logs for errors
@alex check queue status and identify stuck builds
```

***

## Troubleshooting

<Accordion title="Connection timeout">
  * Verify Jenkins is running
  * Check port 9090 is accessible
</Accordion>

<Accordion title="Empty job list">
  * Ensure root URL is configured via Script Console
</Accordion>

<Accordion title="Authentication failed">
  * Verify admin password is correct
</Accordion>

***

## Security Best Practices

* **Dedicated user** - Create a dedicated Jenkins user for CloudThinker
* **Token rotation** - Rotate API tokens periodically
* **Minimal permissions** - Grant only required permissions
* **Network isolation** - Use VPN or private endpoints

***

## 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" 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>
