> ## 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 your Jenkins server so agents can read jobs, builds, logs, and test results, and trigger builds through your Approvals

Connect Jenkins and CloudThinker agents can list jobs, read build logs and test results, explain why a build failed, and trigger a build through your workspace's Approvals. CloudThinker talks to the **Jenkins MCP Server plugin** on your server and signs in with a **Jenkins username and API token**.

## Prerequisites

* A Jenkins server that CloudThinker can reach from the internet, with admin access to install plugins. For a server behind a firewall, allowlist CloudThinker's egress IPs. These docs don't publish CloudThinker's egress IP list: ask your CloudThinker contact, or [contact us](https://cloudthinker.io/contact). See [Reaching private services](https://docs.cloudthinker.io/guide/connections/overview.md#reaching-private-services) for other options.
* The [MCP Server plugin](https://plugins.jenkins.io/mcp-server/) installed. It adds the endpoint CloudThinker calls, at `<your-jenkins-url>/mcp-server/mcp`.
* A Jenkins user for CloudThinker, with the permissions in [Required permissions](#required-permissions).
* The **Admin** role in your CloudThinker workspace, which can add and edit connections. See [Roles](https://docs.cloudthinker.io/guide/security/roles.md).

## Setup

**1. Install the MCP Server plugin**

In Jenkins, go to **Manage Jenkins → Plugins → Available plugins**, search for **MCP Server**, install it, and restart Jenkins if asked.

**2. Set the Jenkins URL**

Go to **Manage Jenkins → System** and fill in **Jenkins URL** under **Jenkins Location** with the address people use to reach Jenkins, for example `https://jenkins.acme.com/`. Click **Save**.

The plugin builds job and build links from this value. If it's empty or set to `localhost`, agents get broken links.

**3. Create an API token**

Sign in to Jenkins as the CloudThinker user and open `<your-jenkins-url>/user/<username>/security` (on older Jenkins versions, `/user/<username>/configure`). Under **API Token**, click **Add new Token**. Name it `cloudthinker`, click **Generate**, and copy the token. Jenkins shows it only once.

**4. Add the connection in CloudThinker**

In the sidebar, click **More → Workspace settings → Connections**. On the **Builtin Connections** tab, search for **Jenkins**, click **Connect**, and fill in the fields from [Connection details](#connection-details). Click **Connect**.

CloudThinker tests the connection by calling the MCP endpoint with your username and token. A wrong URL, a rejected token, or a missing plugin shows an error instead of **Connected**.

**Success state:** Jenkins shows **Connected** on the **Builtin Connections** tab.

> [!NOTE]
>
> The test doesn't check the user's job permissions. Run the verify prompt below to confirm agents can see your jobs.

## Connection details

The dialog shows the fields under these exact names.

| Field | Description | Example |
| - | - | - |
| `JENKINS_URL` | Base URL of your Jenkins server, without `/mcp-server/mcp`. CloudThinker adds that path | `https://jenkins.acme.com` |
| `JENKINS_USER` | The Jenkins username the token belongs to | `cloudthinker` |
| `JENKINS_API_TOKEN` | The API token you generated for that user | `<your-api-token>` |

If you leave out the scheme, CloudThinker uses `https://`. On a public address, CloudThinker always connects over HTTPS, even when you enter `http://`, so your server needs a valid TLS certificate there.

## Required permissions

Grant the CloudThinker user these permissions in your Jenkins authorization strategy (for example **Matrix-based security** under **Manage Jenkins → Security**):

| Permission | Needed for |
| - | - |
| **Overall / Read** | Signing in and listing jobs |
| **Job / Read** | Reading builds, logs, test results, and changes |
| **Job / Discover** | Seeing jobs in folders and views |
| **View / Read** | Reading views |
| **Job / Build** | Optional: triggering builds |

The token acts with exactly this user's permissions. Leave out **Job / Build** for a read-only connection. The user doesn't need **Overall / Administer**, and none of the agent tools read Jenkins credentials or secrets.

> [!TIP]
>
> Use a dedicated Jenkins user for CloudThinker instead of an admin account. If you use folder-level permissions, grant access only to the folders agents should see.

## Agent capabilities

Reads run without asking. Triggering a build is a write, so it goes through your Approvals first.

Every change an agent makes goes through your workspace's [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md) first. On the default **Auto · Rules + AI · Ask me** mode, AI judgment can let a safe change run without asking — and an Allow Rule can too, once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace. Choose **Manual** to approve every change yourself.

| Capability | What agents can do |
| - | - |
| **Jobs** | List jobs and show the last build status of each |
| **Build logs** | Read and search build logs to find the failing step |
| **Test results** | Read test outcomes and point to the failing tests |
| **Changes** | Show the commits and SCM changes that went into a build |
| **Trigger builds** | Start a build, through your Rules and Approval mode. Agents can pass build parameters, taken from your request |

### Verify the connection

```text theme={null}
List the Jenkins jobs you can reach and the result of the last build for each
```

A working connection returns your real job names and results. An empty list usually means the user lacks **Job / Read** or **Job / Discover**.

### Example prompts

```text theme={null}
Why did the last build of payments-api fail? Show the failing step and the error from the log
Which tests failed in the last 5 builds of the main pipeline, and are any of them flaky?
Which commits went into the latest build of web-frontend?
```

## Troubleshooting

> [accordion] This connection did not respond in time. Try connecting again.
>
> CloudThinker can't reach your Jenkins server. Check that the URL opens from outside your network and that your firewall allows inbound HTTPS from CloudThinker's egress IPs. Don't use `localhost` or an address that only resolves inside your network.

> [accordion] The provider rejected these credentials. Update them, then connect again.
>
> The username or token is wrong, or the token was revoked. Confirm that `JENKINS_USER` is the user who generated the token, and generate a new token if needed. To replace it, select **Jenkins** in **More → Workspace settings → Connections**, click the pencil icon, click **Replace…** under **Credentials**, and click **Save and test**.

> [accordion] The provider endpoint was not found. Check the connection settings.
>
> The MCP Server plugin isn't installed or enabled, or `JENKINS_URL` points at the wrong path. Install the plugin and enter only the base URL. If Jenkins runs under a path such as `/jenkins`, include it: `https://ci.acme.com/jenkins`.

> [accordion] The job list is empty or links are broken
>
> The user lacks **Job / Read** or **Job / Discover**, or **Jenkins URL** is empty or set to `localhost`. Fix the permissions, set **Jenkins URL** under **Manage Jenkins → System**, and ask again.

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

- **Limit network exposure.** Allow inbound traffic to Jenkins only from the sources that need it, and keep the Jenkins UI behind your normal access controls.
- **Keep builds approval-gated.** Grant **Job / Build** only if agents should start builds, and choose **Manual** if a person should see every build CloudThinker starts.

## Related

> [card] [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md)
>
> Decide which agent actions run on their own and which wait for you

> [card] [Connections Overview](https://docs.cloudthinker.io/guide/connections/overview.md)
>
> See every tool CloudThinker connects to and how connections work


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.