Labsco
NithishNithi logo

Jenkins MCP Server

โ˜… 3

from NithishNithi

MCP Jenkins is a Go-based integration layer designed to connect Model Context Protocol (MCP) tools with Jenkins CI/CD pipelines. This project provides a lightweight, high-performance bridge that enables automated pipeline execution, job management, and status retrieval through MCP-driven workflows.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Jenkins MCP Server

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.

Features

  • 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

Available Tools

Jobs

  • jenkins_list_jobs - List all accessible Jenkins jobs
  • jenkins_get_job - Get detailed job information
  • jenkins_trigger_build - Trigger a new build (supports parameters)

Builds

  • 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

Artifacts

  • jenkins_list_artifacts - List build artifacts
  • jenkins_get_artifact - Download specific artifacts

Queue

  • jenkins_get_queue - View the build queue
  • jenkins_get_queue_item - Get queue item details
  • jenkins_cancel_queue_item - Cancel queued builds

Views

  • jenkins_list_views - List all views
  • jenkins_get_view - Get jobs in a view
  • jenkins_create_view - Create a new view

Server & Nodes

  • jenkins_server_health - Check server health
  • jenkins_list_nodes - List Jenkins nodes
  • jenkins_get_pipeline_script - Retrieve Jenkinsfile content

MCP Client Integration

Claude Desktop

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

Copy & paste โ€” that's it
{
  "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"

Development

Project Structure

Copy & paste โ€” that's it
.
โ”œโ”€โ”€ 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

Building

Copy & paste โ€” that's it
go build -o jenkins-mcp-server .

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

Acknowledgments

Built with the Model Context Protocol Go SDK