devops-mcps


Namedevops-mcps JSON
Version 0.8.2 PyPI version JSON
download
home_pageNone
SummaryA FastMCP-based, Readonly MCP server for DevOps
upload_time2025-07-25 22:21:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords devops mcp python cli jenkins azure github
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DevOps MCP Server

[![PyPI version](https://badge.fury.io/py/devops-mcps.svg)](https://badge.fury.io/py/devops-mcps)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Coverage](https://img.shields.io/badge/coverage-93.77%25-brightgreen.svg)](https://github.com/huangjien/devops-mcps)

A [FastMCP](https://github.com/modelcontextprotocol/fastmcp)-based MCP server providing a suite of DevOps tools and integrations.

This server operates in a read-only manner, retrieving data for analysis and display without modifying your systems. It's designed with safety in mind for DevOps environments.

Certified by [MCP Review](https://mcpreview.com/mcp-servers/huangjien/devops-mcps)

## Features

The DevOps MCP Server integrates with various essential DevOps platforms:

### GitHub Integration

-   **Repository Management**: Search and view repository details.
-   **File Access**: Retrieve file contents from repositories.
-   **Issue Tracking**: Manage and track issues.
-   **Code Search**: Perform targeted code searches.
-   **Commit History**: View commit history for branches.
-   **Public & Enterprise Support**: Automatically detects and connects to both public GitHub and GitHub Enterprise instances (configurable via `GITHUB_API_URL`).

### Jenkins Integration

-   **Job Management**: List and manage Jenkins jobs.
-   **Build Logs**: Retrieve and analyze build logs.
-   **View Management**: Access and manage Jenkins views.
-   **Build Parameters**: Inspect parameters used for builds.
-   **Failure Monitoring**: Identify and monitor recent failed builds.

### Artifactory Integration

-   **Repository Browsing**: List items (files and directories) within Artifactory repositories.
-   **Artifact Search**: Search for artifacts by name or path across multiple repositories using Artifactory Query Language (AQL).
-   **Item Details**: Retrieve metadata and properties for specific files and directories.
-   **Authentication**: Supports both token-based and username/password authentication.

## Installation

Install the package using pip:

```bash
pip install devops-mcps
```

## Usage

Run the MCP server directly:

```bash
devops-mcps
```

### Transport Configuration

The server supports two communication transport types:

-   `stdio` (default): Standard input/output.
-   `stream_http`: HTTP streaming transport.

**Local Usage:**

```bash
# Default stdio transport
devops-mcps

# stream_http transport (runs HTTP server on 127.0.0.1:3721/mcp by default)
devops-mcps --transport stream_http
```

**UVX Usage:**

If using [UVX](https://github.com/modelcontextprotocol/uvx), first install the tools:

```bash
uvx install
```

Then run:

```bash
# Default stdio transport
uvx run devops-mcps

# stream_http transport
uvx run devops-mcps-stream-http
```

## Configuration

Configure the server using environment variables:

**Required:**

```bash
# GitHub
export GITHUB_PERSONAL_ACCESS_TOKEN="your_github_token"
# Optional: For GitHub Enterprise, set your API endpoint
# export GITHUB_API_URL="https://github.mycompany.com"

# Jenkins
export JENKINS_URL="your_jenkins_url"
export JENKINS_USER="your_jenkins_username"
export JENKINS_TOKEN="your_jenkins_api_token_or_password"

# Artifactory
export ARTIFACTORY_URL="https://your-artifactory-instance.example.com"
# Choose ONE authentication method:
export ARTIFACTORY_IDENTITY_TOKEN="your_artifactory_identity_token"
# OR
export ARTIFACTORY_USERNAME="your_artifactory_username"
export ARTIFACTORY_PASSWORD="your_artifactory_password"
```

**Optional:**

```bash
# Jenkins Log Length (default: 5120 bytes)
export LOG_LENGTH=10240

# MCP Server Port for stream_http transport (default: 3721)
export MCP_PORT=3721

# Dynamic Prompts (optional)
export PROMPTS_FILE="example_prompts.json"
```

**Note**: `LOG_LENGTH` controls the amount of Jenkins log data retrieved. Adjust as needed.

**Alternative: Using .env file**

You can also create a `.env` file in the project root directory instead of setting environment variables manually:

```bash
# .env file
GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token_here
PROMPTS_FILE=example_prompts.json
# Add other optional environment variables as needed
```

The server will automatically load environment variables from the `.env` file when it starts.

### Dynamic Prompts

The server supports loading custom prompts from a JSON file. Set the `PROMPTS_FILE` environment variable to the path of your prompts configuration file.

**Prompts File Format:**

```json
{
  "prompts": [
    {
      "name": "github_repo_analysis",
      "description": "Analyze a GitHub repository for DevOps insights",
      "template": "Please analyze the GitHub repository {{owner}}/{{repo}} and provide insights on:\n\n1. Repository structure and organization\n2. CI/CD pipeline configuration\n3. Code quality indicators\n4. Security considerations\n5. Documentation quality\n\n{{#include_issues}}Also include analysis of recent issues and their resolution patterns.{{/include_issues}}",
      "arguments": [
        {
          "name": "owner",
          "description": "GitHub repository owner",
          "required": true
        },
        {
          "name": "repo",
          "description": "GitHub repository name",
          "required": true
        },
        {
          "name": "include_issues",
          "description": "Include analysis of repository issues",
          "required": false
        }
      ]
    }
  ]
}
```

### Using Prompts

The DevOps MCP Server provides dynamic prompts that help you perform common DevOps tasks. Here's how to use the available prompts:

#### Available Prompts

1. **`quick_repo_check`** - Comprehensive repository health assessment with security analysis
2. **`daily_check`** - Complete DevOps monitoring with Jenkins job analysis and infrastructure status
3. **`build_troubleshoot`** - Advanced build failure investigation with root cause analysis

#### Using the `daily_check` Prompt

**Purpose:** Comprehensive DevOps monitoring and infrastructure status reporting with Jenkins job analysis.

**Parameters:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `time_range` | string | ❌ No | Time range for analysis (e.g., "24h", "7d", "1w") |
| `include_infrastructure` | boolean | ❌ No | Include infrastructure status in the report |
| `focus_area` | string | ❌ No | Specific area to focus on (e.g., "builds", "deployments", "security") |

**Usage Examples:**

```
# Basic daily monitoring
Prompt: daily_check

# Weekly infrastructure review
Prompt: daily_check
Parameters:
- time_range: "7d"
- include_infrastructure: true

# Focus on build failures
Prompt: daily_check
Parameters:
- time_range: "24h"
- focus_area: "builds"
```

**What it does:**
1. 🔍 **Jenkins Job Analysis**: Comprehensive review of job statuses and recent failures
2. 🔧 **Root Cause Investigation**: Deep dive into failure patterns and trends
3. 🏗️ **Infrastructure Status**: Health check of critical infrastructure components
4. 📋 **Actionable Recommendations**: Prioritized action items with implementation guidance
5. 📊 **Executive Summary**: High-level overview with key metrics and trends

#### Using the `build_troubleshoot` Prompt

**Purpose:** Advanced build failure investigation with comprehensive root cause analysis and actionable recommendations.

**Parameters:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `job_name` | string | ✅ Yes | Jenkins job name |
| `build_number` | string | ❌ No | Build number to analyze (use -1 for latest) |
| `include_logs` | boolean | ❌ No | Whether to include build logs in analysis |

**Usage Examples:**

```
# Basic usage (latest build)
Prompt: build_troubleshoot
Parameters:
- job_name: "my-application-build"

# Specific build number
Prompt: build_troubleshoot
Parameters:
- job_name: "my-application-build"
- build_number: "42"

# With build logs
Prompt: build_troubleshoot
Parameters:
- job_name: "my-application-build"
- build_number: "42"
- include_logs: true
```

**What it does:**
1. Gets build status and basic information for the specified job
2. Retrieves and analyzes build logs (if `include_logs` is true)
3. Identifies potential failure causes based on the build data
4. Suggests troubleshooting steps with actionable recommendations

#### Using the `quick_repo_check` Prompt

**Purpose:** Comprehensive repository health assessment with security analysis and DevOps best practices evaluation.

**Parameters:**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `repo_name` | string | ✅ Yes | Repository name in format 'owner/repo' |
| `include_security` | boolean | ❌ No | Include security analysis in the assessment |
| `check_ci_cd` | boolean | ❌ No | Analyze CI/CD pipeline configuration |

**Usage Examples:**

```
# Basic repository check
Prompt: quick_repo_check
Parameters:
- repo_name: "facebook/react"

# Comprehensive security assessment
Prompt: quick_repo_check
Parameters:
- repo_name: "myorg/myproject"
- include_security: true
- check_ci_cd: true
```

**What it does:**
1. 📊 **Repository Health Assessment**: Comprehensive evaluation of repository status and metrics
2. 🔒 **Security Analysis**: Security configuration review and vulnerability assessment
3. 🏗️ **CI/CD Pipeline Evaluation**: Analysis of build and deployment configurations
4. 📋 **Actionable Recommendations**: Prioritized improvement suggestions with implementation guidance
5. 📈 **Executive Summary**: High-level overview with key findings and strategic recommendations

#### Natural Language Support

The DevOps MCP Server supports both **structured** and **natural language** approaches for invoking prompts:

**Structured Format (Explicit):**
```
Use prompt: build_troubleshoot
Parameters:
- job_name: "creole-Automerge-main"
- build_number: 29
- include_logs: true
```

**Natural Language Format (Recommended):**
```
"Perform daily DevOps monitoring check for the last 24 hours"

"Troubleshoot the Jenkins build failure for job 'creole-Automerge-main' build #29 with detailed logs"

"Check the GitHub repository facebook/react with security analysis"

"Analyze the failed build for my-app-build job number 42 including logs"

"Run weekly infrastructure review with comprehensive monitoring"

"Assess repository health for myorg/myproject including CI/CD pipeline analysis"
```

**How Natural Language Processing Works:**

1. **Intent Recognition**: The AI assistant identifies which prompt matches your request
2. **Parameter Extraction**: Extracts specific values (job names, build numbers, repo names) from your message
3. **Automatic Mapping**: Maps your natural language to the structured prompt format
4. **Context Awareness**: Uses conversation history and workspace context for missing parameters

**Tips for Better Natural Language Recognition:**

- **Use Keywords**: Include terms like "troubleshoot", "analyze", "check repository", "build failure"
- **Be Specific**: Mention exact job names, build numbers, repository names
- **Use Quotes**: Put specific values in quotes for clarity (e.g., "my-job-name")
- **Include Context**: Specify what type of analysis you want

**Example Natural Language Patterns:**

| Intent | Natural Language Examples |
|--------|---------------------------|
| Daily Monitoring | "Daily DevOps check", "Run daily monitoring", "Infrastructure status report" |
| Repository Analysis | "Check repo owner/name with security", "Analyze GitHub repository X with CI/CD" |
| Build Troubleshooting | "Debug build failure", "Troubleshoot job X build Y", "Investigate build issues" |
| Include Logs | "with logs", "including detailed logs", "show build logs" |
| Latest Build | "latest build", "most recent build", "current build" |
| Time Range | "last 24 hours", "past week", "7 days", "weekly review" |
| Focus Areas | "focus on builds", "security analysis", "infrastructure review" |

#### Prerequisites

To use Jenkins-related prompts like `build_troubleshoot`, ensure you have:

```bash
# Required Jenkins environment variables
export JENKINS_URL="https://your-jenkins-server.com"
export JENKINS_USER="your-username"
export JENKINS_TOKEN="your-api-token"
```

To use GitHub-related prompts like `quick_repo_check`, ensure you have:

```bash
# Required GitHub environment variable
export GITHUB_PERSONAL_ACCESS_TOKEN="your_github_token"
```

**Template Variables:**
- Use `{{variable_name}}` for simple variable substitution
- Use `{{#variable_name}}...{{/variable_name}}` for conditional blocks (shown if variable has a value)
- Use `{{^variable_name}}...{{/variable_name}}` for negative conditional blocks (shown if variable is empty/null)

**Available Tools for Prompts:**
Your prompts can reference any of the available MCP tools:
- GitHub tools: `search_repositories`, `get_file_contents`, `list_commits`, `list_issues`, etc.
- Jenkins tools: `get_jenkins_jobs`, `get_jenkins_build_log`, `get_recent_failed_jenkins_builds`, etc.
- Azure tools: `get_azure_subscriptions`, `list_azure_vms`, `list_aks_clusters`, etc.
- Artifactory tools: `list_artifactory_items`, `search_artifactory_items`, `get_artifactory_item_info`, etc.

## Docker

Build the Docker image:

```bash
docker build -t devops-mcps .
```

Run the container:

```bash
# Stdio transport (interactive)
docker run -i --rm \
  -e GITHUB_PERSONAL_ACCESS_TOKEN="..." \
  -e JENKINS_URL="..." \
  -e JENKINS_USER="..." \
  -e JENKINS_TOKEN="..." \
  -e ARTIFACTORY_URL="..." \
  -e ARTIFACTORY_IDENTITY_TOKEN="..." \
  devops-mcps

# stream_http transport (background, HTTP server on 127.0.0.1:3721/mcp by default)
docker run -d -p 3721:3721 --rm \
  -e TRANSPORT_TYPE=stream_http \
  -e MCP_PORT=3721 \
  -e GITHUB_PERSONAL_ACCESS_TOKEN="..." \
  -e JENKINS_URL="..." \
  -e JENKINS_USER="..." \
  -e JENKINS_TOKEN="..." \
  -e ARTIFACTORY_URL="..." \
  -e ARTIFACTORY_IDENTITY_TOKEN="..." \
  devops-mcps
```

Replace `...` with your actual credentials.

## VSCode Integration

Configure the MCP server in VSCode's `settings.json`:

**Example (UVX with stdio):**

```json
"devops-mcps": {
  "type": "stdio",
  "command": "uvx",
  "args": ["devops-mcps"],
  "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_...",
    "GITHUB_API_URL": "https://github.mycompany.com", // Optional for GHE
    "JENKINS_URL": "...",
    "JENKINS_USER": "...",
    "JENKINS_TOKEN": "...",
    "ARTIFACTORY_URL": "...",
    "ARTIFACTORY_IDENTITY_TOKEN": "cm..." // Or USERNAME/PASSWORD
  }
}
```

**Example (Docker with stream_http):**

Ensure the Docker container is running with stream_http enabled (see Docker section).

```json
{
  "type": "stream_http",
  "url": "http://127.0.0.1:3721/mcp", // Adjust if Docker host is remote or if MCP_PORT is set differently
  "env": {
    // Environment variables are set in the container,
    // but can be overridden here if needed.
    "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
  }
}
```

Refer to the initial `README.md` sections for other transport/runner combinations (UVX/stream_http, Docker/stdio).

## Development

Set up your development environment:

```bash
# Install dependencies (using uv)
uv pip install -e ".[dev]"
# Or sync with lock file
# uv sync --dev
```

**Linting and Formatting (Ruff):**

```bash
# Check code style
uvx ruff check .

# Format code
uvx ruff format .
```

**Testing (Pytest):**

```bash
# Run tests with coverage using the provided script
./test.sh

# Or run manually
pytest --cov=src/devops_mcps --cov-report=html --cov-report=xml tests/
```

**Test Script Features:**

The project includes a comprehensive `test.sh` script that:
- Automatically checks for `uv` installation
- Syncs development dependencies
- Runs all tests with pytest
- Generates both HTML and XML coverage reports
- Automatically opens the HTML coverage report in your browser
- Requires minimum 80% test coverage (currently achieving 93.77%)

**Coverage Reports:**
- HTML report: `coverage/html/index.html` (opens automatically)
- XML report: `coverage/coverage.xml` (for CI/CD integration)

**Debugging with MCP Inspector:**

```bash
# Basic run
npx @modelcontextprotocol/inspector uvx run devops-mcps

# Run with specific environment variables
npx @modelcontextprotocol/inspector uvx run devops-mcps -e GITHUB_PERSONAL_ACCESS_TOKEN=... -e JENKINS_URL=... # Add other vars
```

**Checking for package dependencies outdated**

```bash
uv pip list --outdated
```

**Updating package dependencies**
```bash
uv lock --upgrade
```

## CI/CD

A GitHub Actions workflow (`.github/workflows/ci.yml`) handles:

1.  **Linting & Testing**: Runs Ruff and Pytest on pushes and pull requests.
2.  **Publishing**: Builds and publishes the Python package to PyPI and the Docker image to Docker Hub on pushes to the `main` branch.

**Required Repository Secrets:**

-   `PYPI_API_TOKEN`: PyPI token for package publishing.
-   `DOCKER_HUB_USERNAME`: Docker Hub username.
-   `DOCKER_HUB_TOKEN`: Docker Hub access token.

## Packaging and Publishing (Manual)

Ensure you have `build` and `twine` installed:

```bash
pip install -U build twine
```

1.  **Update Version**: Increment the version number in `pyproject.toml`.
2.  **Build**: `python -m build`
3.  **Upload**: `twine upload dist/*` (Requires `~/.pypirc` configuration or token input).

## Appendix: GitHub Search Query Syntax

Leverage GitHub's powerful search syntax within the MCP tools:

**Repository Search (`gh_search_repositories`):**

-   `in:name,description,readme`: Search specific fields.
    *Example: `fastapi in:name`*
-   `user:USERNAME` or `org:ORGNAME`: Scope search to a user/org.
    *Example: `user:tiangolo fastapi`*
-   `language:LANGUAGE`: Filter by language.
    *Example: `http client language:python`*
-   `stars:>N`, `forks:<N`, `created:YYYY-MM-DD`, `pushed:>YYYY-MM-DD`: Filter by metrics and dates.
    *Example: `language:javascript stars:>1000 pushed:>2024-01-01`*
-   `topic:TOPIC-NAME`: Filter by topic.
    *Example: `topic:docker topic:python`*
-   `license:LICENSE-KEYWORD`: Filter by license (e.g., `mit`, `apache-2.0`).
    *Example: `language:go license:mit`*

**Code Search (`gh_search_code`):**

-   `in:file,path`: Search file content (default) or path.
    *Example: `"import requests" in:file`*
-   `repo:OWNER/REPO`: Scope search to a specific repository.
    *Example: `"JenkinsAPIException" repo:your-org/your-repo`*
-   `language:LANGUAGE`: Filter by file language.
    *Example: `def main language:python`*
-   `path:PATH/TO/DIR`, `filename:FILENAME.EXT`, `extension:EXT`: Filter by path, filename, or extension.
    *Example: `"GithubException" path:src/devops_mcps extension:py`*

**References:**

-   [Searching on GitHub](https://docs.github.com/en/search-github/searching-on-github)
-   [Searching Code](https://docs.github.com/en/search-github/searching-on-github/searching-code)
-   [Searching Repositories](https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories)

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "devops-mcps",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "devops, mcp, python, cli, jenkins, azure, github",
    "author": null,
    "author_email": "Jien Huang <huangjien@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/04/48/5e220ec32e5cbe5e71481c5376aa361929de9ef3250cd1615afcd21c366b/devops_mcps-0.8.2.tar.gz",
    "platform": null,
    "description": "# DevOps MCP Server\n\n[![PyPI version](https://badge.fury.io/py/devops-mcps.svg)](https://badge.fury.io/py/devops-mcps)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Coverage](https://img.shields.io/badge/coverage-93.77%25-brightgreen.svg)](https://github.com/huangjien/devops-mcps)\n\nA [FastMCP](https://github.com/modelcontextprotocol/fastmcp)-based MCP server providing a suite of DevOps tools and integrations.\n\nThis server operates in a read-only manner, retrieving data for analysis and display without modifying your systems. It's designed with safety in mind for DevOps environments.\n\nCertified by [MCP Review](https://mcpreview.com/mcp-servers/huangjien/devops-mcps)\n\n## Features\n\nThe DevOps MCP Server integrates with various essential DevOps platforms:\n\n### GitHub Integration\n\n-   **Repository Management**: Search and view repository details.\n-   **File Access**: Retrieve file contents from repositories.\n-   **Issue Tracking**: Manage and track issues.\n-   **Code Search**: Perform targeted code searches.\n-   **Commit History**: View commit history for branches.\n-   **Public & Enterprise Support**: Automatically detects and connects to both public GitHub and GitHub Enterprise instances (configurable via `GITHUB_API_URL`).\n\n### Jenkins Integration\n\n-   **Job Management**: List and manage Jenkins jobs.\n-   **Build Logs**: Retrieve and analyze build logs.\n-   **View Management**: Access and manage Jenkins views.\n-   **Build Parameters**: Inspect parameters used for builds.\n-   **Failure Monitoring**: Identify and monitor recent failed builds.\n\n### Artifactory Integration\n\n-   **Repository Browsing**: List items (files and directories) within Artifactory repositories.\n-   **Artifact Search**: Search for artifacts by name or path across multiple repositories using Artifactory Query Language (AQL).\n-   **Item Details**: Retrieve metadata and properties for specific files and directories.\n-   **Authentication**: Supports both token-based and username/password authentication.\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install devops-mcps\n```\n\n## Usage\n\nRun the MCP server directly:\n\n```bash\ndevops-mcps\n```\n\n### Transport Configuration\n\nThe server supports two communication transport types:\n\n-   `stdio` (default): Standard input/output.\n-   `stream_http`: HTTP streaming transport.\n\n**Local Usage:**\n\n```bash\n# Default stdio transport\ndevops-mcps\n\n# stream_http transport (runs HTTP server on 127.0.0.1:3721/mcp by default)\ndevops-mcps --transport stream_http\n```\n\n**UVX Usage:**\n\nIf using [UVX](https://github.com/modelcontextprotocol/uvx), first install the tools:\n\n```bash\nuvx install\n```\n\nThen run:\n\n```bash\n# Default stdio transport\nuvx run devops-mcps\n\n# stream_http transport\nuvx run devops-mcps-stream-http\n```\n\n## Configuration\n\nConfigure the server using environment variables:\n\n**Required:**\n\n```bash\n# GitHub\nexport GITHUB_PERSONAL_ACCESS_TOKEN=\"your_github_token\"\n# Optional: For GitHub Enterprise, set your API endpoint\n# export GITHUB_API_URL=\"https://github.mycompany.com\"\n\n# Jenkins\nexport JENKINS_URL=\"your_jenkins_url\"\nexport JENKINS_USER=\"your_jenkins_username\"\nexport JENKINS_TOKEN=\"your_jenkins_api_token_or_password\"\n\n# Artifactory\nexport ARTIFACTORY_URL=\"https://your-artifactory-instance.example.com\"\n# Choose ONE authentication method:\nexport ARTIFACTORY_IDENTITY_TOKEN=\"your_artifactory_identity_token\"\n# OR\nexport ARTIFACTORY_USERNAME=\"your_artifactory_username\"\nexport ARTIFACTORY_PASSWORD=\"your_artifactory_password\"\n```\n\n**Optional:**\n\n```bash\n# Jenkins Log Length (default: 5120 bytes)\nexport LOG_LENGTH=10240\n\n# MCP Server Port for stream_http transport (default: 3721)\nexport MCP_PORT=3721\n\n# Dynamic Prompts (optional)\nexport PROMPTS_FILE=\"example_prompts.json\"\n```\n\n**Note**: `LOG_LENGTH` controls the amount of Jenkins log data retrieved. Adjust as needed.\n\n**Alternative: Using .env file**\n\nYou can also create a `.env` file in the project root directory instead of setting environment variables manually:\n\n```bash\n# .env file\nGITHUB_PERSONAL_ACCESS_TOKEN=your_github_token_here\nPROMPTS_FILE=example_prompts.json\n# Add other optional environment variables as needed\n```\n\nThe server will automatically load environment variables from the `.env` file when it starts.\n\n### Dynamic Prompts\n\nThe server supports loading custom prompts from a JSON file. Set the `PROMPTS_FILE` environment variable to the path of your prompts configuration file.\n\n**Prompts File Format:**\n\n```json\n{\n  \"prompts\": [\n    {\n      \"name\": \"github_repo_analysis\",\n      \"description\": \"Analyze a GitHub repository for DevOps insights\",\n      \"template\": \"Please analyze the GitHub repository {{owner}}/{{repo}} and provide insights on:\\n\\n1. Repository structure and organization\\n2. CI/CD pipeline configuration\\n3. Code quality indicators\\n4. Security considerations\\n5. Documentation quality\\n\\n{{#include_issues}}Also include analysis of recent issues and their resolution patterns.{{/include_issues}}\",\n      \"arguments\": [\n        {\n          \"name\": \"owner\",\n          \"description\": \"GitHub repository owner\",\n          \"required\": true\n        },\n        {\n          \"name\": \"repo\",\n          \"description\": \"GitHub repository name\",\n          \"required\": true\n        },\n        {\n          \"name\": \"include_issues\",\n          \"description\": \"Include analysis of repository issues\",\n          \"required\": false\n        }\n      ]\n    }\n  ]\n}\n```\n\n### Using Prompts\n\nThe DevOps MCP Server provides dynamic prompts that help you perform common DevOps tasks. Here's how to use the available prompts:\n\n#### Available Prompts\n\n1. **`quick_repo_check`** - Comprehensive repository health assessment with security analysis\n2. **`daily_check`** - Complete DevOps monitoring with Jenkins job analysis and infrastructure status\n3. **`build_troubleshoot`** - Advanced build failure investigation with root cause analysis\n\n#### Using the `daily_check` Prompt\n\n**Purpose:** Comprehensive DevOps monitoring and infrastructure status reporting with Jenkins job analysis.\n\n**Parameters:**\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `time_range` | string | \u274c No | Time range for analysis (e.g., \"24h\", \"7d\", \"1w\") |\n| `include_infrastructure` | boolean | \u274c No | Include infrastructure status in the report |\n| `focus_area` | string | \u274c No | Specific area to focus on (e.g., \"builds\", \"deployments\", \"security\") |\n\n**Usage Examples:**\n\n```\n# Basic daily monitoring\nPrompt: daily_check\n\n# Weekly infrastructure review\nPrompt: daily_check\nParameters:\n- time_range: \"7d\"\n- include_infrastructure: true\n\n# Focus on build failures\nPrompt: daily_check\nParameters:\n- time_range: \"24h\"\n- focus_area: \"builds\"\n```\n\n**What it does:**\n1. \ud83d\udd0d **Jenkins Job Analysis**: Comprehensive review of job statuses and recent failures\n2. \ud83d\udd27 **Root Cause Investigation**: Deep dive into failure patterns and trends\n3. \ud83c\udfd7\ufe0f **Infrastructure Status**: Health check of critical infrastructure components\n4. \ud83d\udccb **Actionable Recommendations**: Prioritized action items with implementation guidance\n5. \ud83d\udcca **Executive Summary**: High-level overview with key metrics and trends\n\n#### Using the `build_troubleshoot` Prompt\n\n**Purpose:** Advanced build failure investigation with comprehensive root cause analysis and actionable recommendations.\n\n**Parameters:**\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `job_name` | string | \u2705 Yes | Jenkins job name |\n| `build_number` | string | \u274c No | Build number to analyze (use -1 for latest) |\n| `include_logs` | boolean | \u274c No | Whether to include build logs in analysis |\n\n**Usage Examples:**\n\n```\n# Basic usage (latest build)\nPrompt: build_troubleshoot\nParameters:\n- job_name: \"my-application-build\"\n\n# Specific build number\nPrompt: build_troubleshoot\nParameters:\n- job_name: \"my-application-build\"\n- build_number: \"42\"\n\n# With build logs\nPrompt: build_troubleshoot\nParameters:\n- job_name: \"my-application-build\"\n- build_number: \"42\"\n- include_logs: true\n```\n\n**What it does:**\n1. Gets build status and basic information for the specified job\n2. Retrieves and analyzes build logs (if `include_logs` is true)\n3. Identifies potential failure causes based on the build data\n4. Suggests troubleshooting steps with actionable recommendations\n\n#### Using the `quick_repo_check` Prompt\n\n**Purpose:** Comprehensive repository health assessment with security analysis and DevOps best practices evaluation.\n\n**Parameters:**\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `repo_name` | string | \u2705 Yes | Repository name in format 'owner/repo' |\n| `include_security` | boolean | \u274c No | Include security analysis in the assessment |\n| `check_ci_cd` | boolean | \u274c No | Analyze CI/CD pipeline configuration |\n\n**Usage Examples:**\n\n```\n# Basic repository check\nPrompt: quick_repo_check\nParameters:\n- repo_name: \"facebook/react\"\n\n# Comprehensive security assessment\nPrompt: quick_repo_check\nParameters:\n- repo_name: \"myorg/myproject\"\n- include_security: true\n- check_ci_cd: true\n```\n\n**What it does:**\n1. \ud83d\udcca **Repository Health Assessment**: Comprehensive evaluation of repository status and metrics\n2. \ud83d\udd12 **Security Analysis**: Security configuration review and vulnerability assessment\n3. \ud83c\udfd7\ufe0f **CI/CD Pipeline Evaluation**: Analysis of build and deployment configurations\n4. \ud83d\udccb **Actionable Recommendations**: Prioritized improvement suggestions with implementation guidance\n5. \ud83d\udcc8 **Executive Summary**: High-level overview with key findings and strategic recommendations\n\n#### Natural Language Support\n\nThe DevOps MCP Server supports both **structured** and **natural language** approaches for invoking prompts:\n\n**Structured Format (Explicit):**\n```\nUse prompt: build_troubleshoot\nParameters:\n- job_name: \"creole-Automerge-main\"\n- build_number: 29\n- include_logs: true\n```\n\n**Natural Language Format (Recommended):**\n```\n\"Perform daily DevOps monitoring check for the last 24 hours\"\n\n\"Troubleshoot the Jenkins build failure for job 'creole-Automerge-main' build #29 with detailed logs\"\n\n\"Check the GitHub repository facebook/react with security analysis\"\n\n\"Analyze the failed build for my-app-build job number 42 including logs\"\n\n\"Run weekly infrastructure review with comprehensive monitoring\"\n\n\"Assess repository health for myorg/myproject including CI/CD pipeline analysis\"\n```\n\n**How Natural Language Processing Works:**\n\n1. **Intent Recognition**: The AI assistant identifies which prompt matches your request\n2. **Parameter Extraction**: Extracts specific values (job names, build numbers, repo names) from your message\n3. **Automatic Mapping**: Maps your natural language to the structured prompt format\n4. **Context Awareness**: Uses conversation history and workspace context for missing parameters\n\n**Tips for Better Natural Language Recognition:**\n\n- **Use Keywords**: Include terms like \"troubleshoot\", \"analyze\", \"check repository\", \"build failure\"\n- **Be Specific**: Mention exact job names, build numbers, repository names\n- **Use Quotes**: Put specific values in quotes for clarity (e.g., \"my-job-name\")\n- **Include Context**: Specify what type of analysis you want\n\n**Example Natural Language Patterns:**\n\n| Intent | Natural Language Examples |\n|--------|---------------------------|\n| Daily Monitoring | \"Daily DevOps check\", \"Run daily monitoring\", \"Infrastructure status report\" |\n| Repository Analysis | \"Check repo owner/name with security\", \"Analyze GitHub repository X with CI/CD\" |\n| Build Troubleshooting | \"Debug build failure\", \"Troubleshoot job X build Y\", \"Investigate build issues\" |\n| Include Logs | \"with logs\", \"including detailed logs\", \"show build logs\" |\n| Latest Build | \"latest build\", \"most recent build\", \"current build\" |\n| Time Range | \"last 24 hours\", \"past week\", \"7 days\", \"weekly review\" |\n| Focus Areas | \"focus on builds\", \"security analysis\", \"infrastructure review\" |\n\n#### Prerequisites\n\nTo use Jenkins-related prompts like `build_troubleshoot`, ensure you have:\n\n```bash\n# Required Jenkins environment variables\nexport JENKINS_URL=\"https://your-jenkins-server.com\"\nexport JENKINS_USER=\"your-username\"\nexport JENKINS_TOKEN=\"your-api-token\"\n```\n\nTo use GitHub-related prompts like `quick_repo_check`, ensure you have:\n\n```bash\n# Required GitHub environment variable\nexport GITHUB_PERSONAL_ACCESS_TOKEN=\"your_github_token\"\n```\n\n**Template Variables:**\n- Use `{{variable_name}}` for simple variable substitution\n- Use `{{#variable_name}}...{{/variable_name}}` for conditional blocks (shown if variable has a value)\n- Use `{{^variable_name}}...{{/variable_name}}` for negative conditional blocks (shown if variable is empty/null)\n\n**Available Tools for Prompts:**\nYour prompts can reference any of the available MCP tools:\n- GitHub tools: `search_repositories`, `get_file_contents`, `list_commits`, `list_issues`, etc.\n- Jenkins tools: `get_jenkins_jobs`, `get_jenkins_build_log`, `get_recent_failed_jenkins_builds`, etc.\n- Azure tools: `get_azure_subscriptions`, `list_azure_vms`, `list_aks_clusters`, etc.\n- Artifactory tools: `list_artifactory_items`, `search_artifactory_items`, `get_artifactory_item_info`, etc.\n\n## Docker\n\nBuild the Docker image:\n\n```bash\ndocker build -t devops-mcps .\n```\n\nRun the container:\n\n```bash\n# Stdio transport (interactive)\ndocker run -i --rm \\\n  -e GITHUB_PERSONAL_ACCESS_TOKEN=\"...\" \\\n  -e JENKINS_URL=\"...\" \\\n  -e JENKINS_USER=\"...\" \\\n  -e JENKINS_TOKEN=\"...\" \\\n  -e ARTIFACTORY_URL=\"...\" \\\n  -e ARTIFACTORY_IDENTITY_TOKEN=\"...\" \\\n  devops-mcps\n\n# stream_http transport (background, HTTP server on 127.0.0.1:3721/mcp by default)\ndocker run -d -p 3721:3721 --rm \\\n  -e TRANSPORT_TYPE=stream_http \\\n  -e MCP_PORT=3721 \\\n  -e GITHUB_PERSONAL_ACCESS_TOKEN=\"...\" \\\n  -e JENKINS_URL=\"...\" \\\n  -e JENKINS_USER=\"...\" \\\n  -e JENKINS_TOKEN=\"...\" \\\n  -e ARTIFACTORY_URL=\"...\" \\\n  -e ARTIFACTORY_IDENTITY_TOKEN=\"...\" \\\n  devops-mcps\n```\n\nReplace `...` with your actual credentials.\n\n## VSCode Integration\n\nConfigure the MCP server in VSCode's `settings.json`:\n\n**Example (UVX with stdio):**\n\n```json\n\"devops-mcps\": {\n  \"type\": \"stdio\",\n  \"command\": \"uvx\",\n  \"args\": [\"devops-mcps\"],\n  \"env\": {\n    \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"ghp_...\",\n    \"GITHUB_API_URL\": \"https://github.mycompany.com\", // Optional for GHE\n    \"JENKINS_URL\": \"...\",\n    \"JENKINS_USER\": \"...\",\n    \"JENKINS_TOKEN\": \"...\",\n    \"ARTIFACTORY_URL\": \"...\",\n    \"ARTIFACTORY_IDENTITY_TOKEN\": \"cm...\" // Or USERNAME/PASSWORD\n  }\n}\n```\n\n**Example (Docker with stream_http):**\n\nEnsure the Docker container is running with stream_http enabled (see Docker section).\n\n```json\n{\n  \"type\": \"stream_http\",\n  \"url\": \"http://127.0.0.1:3721/mcp\", // Adjust if Docker host is remote or if MCP_PORT is set differently\n  \"env\": {\n    // Environment variables are set in the container,\n    // but can be overridden here if needed.\n    \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"ghp_...\"\n  }\n}\n```\n\nRefer to the initial `README.md` sections for other transport/runner combinations (UVX/stream_http, Docker/stdio).\n\n## Development\n\nSet up your development environment:\n\n```bash\n# Install dependencies (using uv)\nuv pip install -e \".[dev]\"\n# Or sync with lock file\n# uv sync --dev\n```\n\n**Linting and Formatting (Ruff):**\n\n```bash\n# Check code style\nuvx ruff check .\n\n# Format code\nuvx ruff format .\n```\n\n**Testing (Pytest):**\n\n```bash\n# Run tests with coverage using the provided script\n./test.sh\n\n# Or run manually\npytest --cov=src/devops_mcps --cov-report=html --cov-report=xml tests/\n```\n\n**Test Script Features:**\n\nThe project includes a comprehensive `test.sh` script that:\n- Automatically checks for `uv` installation\n- Syncs development dependencies\n- Runs all tests with pytest\n- Generates both HTML and XML coverage reports\n- Automatically opens the HTML coverage report in your browser\n- Requires minimum 80% test coverage (currently achieving 93.77%)\n\n**Coverage Reports:**\n- HTML report: `coverage/html/index.html` (opens automatically)\n- XML report: `coverage/coverage.xml` (for CI/CD integration)\n\n**Debugging with MCP Inspector:**\n\n```bash\n# Basic run\nnpx @modelcontextprotocol/inspector uvx run devops-mcps\n\n# Run with specific environment variables\nnpx @modelcontextprotocol/inspector uvx run devops-mcps -e GITHUB_PERSONAL_ACCESS_TOKEN=... -e JENKINS_URL=... # Add other vars\n```\n\n**Checking for package dependencies outdated**\n\n```bash\nuv pip list --outdated\n```\n\n**Updating package dependencies**\n```bash\nuv lock --upgrade\n```\n\n## CI/CD\n\nA GitHub Actions workflow (`.github/workflows/ci.yml`) handles:\n\n1.  **Linting & Testing**: Runs Ruff and Pytest on pushes and pull requests.\n2.  **Publishing**: Builds and publishes the Python package to PyPI and the Docker image to Docker Hub on pushes to the `main` branch.\n\n**Required Repository Secrets:**\n\n-   `PYPI_API_TOKEN`: PyPI token for package publishing.\n-   `DOCKER_HUB_USERNAME`: Docker Hub username.\n-   `DOCKER_HUB_TOKEN`: Docker Hub access token.\n\n## Packaging and Publishing (Manual)\n\nEnsure you have `build` and `twine` installed:\n\n```bash\npip install -U build twine\n```\n\n1.  **Update Version**: Increment the version number in `pyproject.toml`.\n2.  **Build**: `python -m build`\n3.  **Upload**: `twine upload dist/*` (Requires `~/.pypirc` configuration or token input).\n\n## Appendix: GitHub Search Query Syntax\n\nLeverage GitHub's powerful search syntax within the MCP tools:\n\n**Repository Search (`gh_search_repositories`):**\n\n-   `in:name,description,readme`: Search specific fields.\n    *Example: `fastapi in:name`*\n-   `user:USERNAME` or `org:ORGNAME`: Scope search to a user/org.\n    *Example: `user:tiangolo fastapi`*\n-   `language:LANGUAGE`: Filter by language.\n    *Example: `http client language:python`*\n-   `stars:>N`, `forks:<N`, `created:YYYY-MM-DD`, `pushed:>YYYY-MM-DD`: Filter by metrics and dates.\n    *Example: `language:javascript stars:>1000 pushed:>2024-01-01`*\n-   `topic:TOPIC-NAME`: Filter by topic.\n    *Example: `topic:docker topic:python`*\n-   `license:LICENSE-KEYWORD`: Filter by license (e.g., `mit`, `apache-2.0`).\n    *Example: `language:go license:mit`*\n\n**Code Search (`gh_search_code`):**\n\n-   `in:file,path`: Search file content (default) or path.\n    *Example: `\"import requests\" in:file`*\n-   `repo:OWNER/REPO`: Scope search to a specific repository.\n    *Example: `\"JenkinsAPIException\" repo:your-org/your-repo`*\n-   `language:LANGUAGE`: Filter by file language.\n    *Example: `def main language:python`*\n-   `path:PATH/TO/DIR`, `filename:FILENAME.EXT`, `extension:EXT`: Filter by path, filename, or extension.\n    *Example: `\"GithubException\" path:src/devops_mcps extension:py`*\n\n**References:**\n\n-   [Searching on GitHub](https://docs.github.com/en/search-github/searching-on-github)\n-   [Searching Code](https://docs.github.com/en/search-github/searching-on-github/searching-code)\n-   [Searching Repositories](https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories)\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A FastMCP-based, Readonly MCP server for DevOps",
    "version": "0.8.2",
    "project_urls": {
        "Homepage": "https://www.huangjien.com",
        "Repository": "https://github.com/huangjien/devops-mcps"
    },
    "split_keywords": [
        "devops",
        " mcp",
        " python",
        " cli",
        " jenkins",
        " azure",
        " github"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6d93c389b9d49e9a587a522d352c082e31d5889cb4047abf6a953a3fceee795b",
                "md5": "498ed2becb7698e8552a19aa649c4842",
                "sha256": "8873be4db48fdfff727e5f46079893271d151bf09e55d3ed0157567ada47ec61"
            },
            "downloads": -1,
            "filename": "devops_mcps-0.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "498ed2becb7698e8552a19aa649c4842",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 34137,
            "upload_time": "2025-07-25T22:21:39",
            "upload_time_iso_8601": "2025-07-25T22:21:39.731668Z",
            "url": "https://files.pythonhosted.org/packages/6d/93/c389b9d49e9a587a522d352c082e31d5889cb4047abf6a953a3fceee795b/devops_mcps-0.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04485e220ec32e5cbe5e71481c5376aa361929de9ef3250cd1615afcd21c366b",
                "md5": "8bb492f93606b3158eed50a5fcc57b96",
                "sha256": "400b34a0d4736b731a82c2ebe5f5b1de48790e4fd50038928024c9a44948ebe9"
            },
            "downloads": -1,
            "filename": "devops_mcps-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8bb492f93606b3158eed50a5fcc57b96",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 66383,
            "upload_time": "2025-07-25T22:21:40",
            "upload_time_iso_8601": "2025-07-25T22:21:40.979582Z",
            "url": "https://files.pythonhosted.org/packages/04/48/5e220ec32e5cbe5e71481c5376aa361929de9ef3250cd1615afcd21c366b/devops_mcps-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 22:21:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "huangjien",
    "github_project": "devops-mcps",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "devops-mcps"
}
        
Elapsed time: 1.36356s