Enable the 'Trigger builds remotely' option in the Jenkins job configuration and set an authentication token string (separate from user credentials)
If CSRF protection is enabled (default in modern Jenkins), first fetch a crumb via GET 'http://JENKINS_HOST/crumbIssuer/api/json' with basic auth credentials, extracting 'crumbRequestField' and 'crumb' from the response
Include the crumb as a request header (e.g. 'Jenkins-Crumb: CRUMB_VALUE') in all subsequent POST requests
Trigger the build via POST to 'http://JENKINS_HOST/job/{job-name}/build?token=YOUR_BUILD_TOKEN' (no body for parameterless builds)
For parameterized builds, POST to '/job/{job-name}/buildWithParameters?token=YOUR_BUILD_TOKEN' with URL-encoded parameters in the query string or form body
Known gotchas
CSRF crumbs are session-bound in some Jenkins configurations; if using cookie-based crumbs, the crumb fetch and build trigger must use the same HTTP session (same cookie jar)
The build token is not a user authentication token; the remote trigger endpoint still respects job-level permissions and may require the request to come from an authenticated user with build access
Jenkins may return HTTP 201 immediately for queued builds; the actual queue item and build number are in the 'Location' response header, not the body, and require an additional API call to resolve
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp