A Model Context Protocol (MCP) server implementation in Go that provides programmatic access to Jenkins CI/CD functionality. This server enables AI assistants and other MCP clients to interact with Jenkins instances through a standardized protocol interface.
- Complete Jenkins API Coverage: List jobs, trigger builds, monitor status, retrieve logs and artifacts
- MCP Protocol Compliant: Full implementation of the Model Context Protocol specification
- Secure Authentication: Username and API token authentication with TLS/SSL support
- Robust Error Handling: Automatic retry with exponential backoff for transient failures
- Production Ready: Comprehensive error handling, logging, and timeout management
- Multi-Instance Support: Optional tool prefixing for running multiple Jenkins servers
go install github.com/NithishNithi/go-jenkins-mcp/cmd/jenkins-mcp-server@latestgit clone https://github.com/NithishNithi/go-jenkins-mcp.git
cd go-jenkins-mcp
go build -o jenkins-mcp-server .Download the latest release from the releases page.
- Go 1.23.6 or later (for building from source)
- Access to a Jenkins instance
- Jenkins username and API token
# Required
JENKINS_URL=https://jenkins.example.com
JENKINS_USERNAME=your-username
JENKINS_API_TOKEN=your-api-token-here
# Optional
JENKINS_TIMEOUT=30s # Request timeout (default: 30s)
JENKINS_TLS_SKIP_VERIFY=false # Skip TLS verification (default: false)
JENKINS_CA_CERT=/path/to/ca.crt # Custom CA certificate path
JENKINS_MAX_RETRIES=3 # Maximum retry attempts (default: 3)
JENKINS_RETRY_BACKOFF=1s # Initial retry backoff (default: 1s)
JENKINS_TOOL_PREFIX=prod # Tool name prefix for multi-instance setupsNote: JENKINS_TOOL_PREFIX allows you to run multiple Jenkins MCP servers simultaneously by prefixing tool names (e.g., prod_jenkins_list_jobs, staging_jenkins_list_jobs).
Create a config.yaml file:
jenkins:
url: https://jenkins.example.com
username: your-username
apiToken: your-api-token-here
toolPrefix: prod # Optional prefix for tool names
# Optional settings
timeout: 30s
tls:
skipVerify: false
caCert: /path/to/ca.crt
retry:
maxAttempts: 3
backoff: 1sRun with config file:
jenkins-mcp-server --config /path/to/config.yaml- Log in to Jenkins
- Click your name in the top right corner
- Click "Configure"
- Under "API Token", click "Add new Token"
- Copy the generated token
# Using environment variables
export JENKINS_URL=https://jenkins.example.com
export JENKINS_USERNAME=your-username
export JENKINS_API_TOKEN=your-token
jenkins-mcp-server
# Using configuration file
jenkins-mcp-server --config config.yaml- jenkins_list_jobs - List all accessible Jenkins jobs
- jenkins_get_job - Get detailed job information
- jenkins_trigger_build - Trigger a new build (supports parameters)
- jenkins_get_build - Get build status and details
- jenkins_get_build_log - Retrieve console output
- jenkins_get_running_builds - Get all currently running builds
- jenkins_stop_build - Stop a running build
- jenkins_list_artifacts - List build artifacts
- jenkins_get_artifact - Download specific artifacts
- jenkins_get_queue - View the build queue
- jenkins_get_queue_item - Get queue item details
- jenkins_cancel_queue_item - Cancel queued builds
- jenkins_list_views - List all views
- jenkins_get_view - Get jobs in a view
- jenkins_create_view - Create a new view
- jenkins_server_health - Check server health
- jenkins_list_nodes - List Jenkins nodes
- jenkins_get_pipeline_script - Retrieve Jenkinsfile content
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"jenkins": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "JENKINS_URL=https://jenkins.example.com",
"-e", "JENKINS_USERNAME=your-username",
"-e", "JENKINS_API_TOKEN=your-api-token",
"-e", "JENKINS_TOOL_PREFIX=prod",
"ghcr.io/nithishnithi/jenkins-mcp-server:latest"
]
}
}
}Restart Claude Desktop, then ask:
- "List all Jenkins jobs"
- "Trigger a build for the main-pipeline job"
- "Show me the latest build status for my-app"
- "Get the build log for build #42"
- Verify
JENKINS_URLis correct and accessible - Check network connectivity and firewall rules
- Ensure Jenkins is running
- Verify API token is valid
- Check username is correct
- Regenerate API token if needed
- Set
JENKINS_TLS_SKIP_VERIFY=truefor testing only - Provide custom CA certificate via
JENKINS_CA_CERT - Update system CA certificates
- Verify Jenkins user has appropriate permissions
- Check job-level permissions in Jenkins
- Increase
JENKINS_TIMEOUTvalue - Check Jenkins server performance
- Verify network latency
- Verify binary path in configuration
- Check environment variables are properly set
- Restart MCP client after changes
- Ensure binary has execute permissions:
chmod +x jenkins-mcp-server
export LOG_LEVEL=debug
jenkins-mcp-server.
├── internal/
│ ├── config/ # Configuration management
│ ├── jenkins/ # Jenkins API client
│ └── mcp/ # MCP server implementation
├── main.go # Application entry point
├── go.mod # Go module definition
├── Dockerfile # Docker image definition
└── README.md # This file
go build -o jenkins-mcp-server .Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for your changes
- Submit a pull request
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- MCP Protocol: Model Context Protocol
Built with the Model Context Protocol Go SDK