|
| 1 | +--- |
| 2 | +title: "AI Integration" |
| 3 | +weight: 70 |
| 4 | +--- |
| 5 | + |
| 6 | +# AI Integration — MCP Server & AI Skills |
| 7 | + |
| 8 | +DevOps-OS exposes all its pipeline automation tools as an **MCP (Model Context Protocol) server** and as **AI skill definitions** for Claude and OpenAI. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Available Tools |
| 13 | + |
| 14 | +| Tool | What it generates | |
| 15 | +|------|-------------------| |
| 16 | +| `generate_github_actions_workflow` | GitHub Actions workflow YAML | |
| 17 | +| `generate_jenkins_pipeline` | Jenkins Declarative Pipeline (Jenkinsfile) | |
| 18 | +| `generate_k8s_config` | Kubernetes Deployment + Service manifests | |
| 19 | +| `scaffold_devcontainer` | `devcontainer.json` + `devcontainer.env.json` | |
| 20 | +| `generate_gitlab_ci_pipeline` | GitLab CI/CD pipeline (`.gitlab-ci.yml`) | |
| 21 | +| `generate_argocd_config` | Argo CD Application and AppProject manifests | |
| 22 | +| `generate_sre_configs` | SRE / observability configs (Prometheus, Grafana, SLO) | |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## MCP Server |
| 27 | + |
| 28 | +### Installation |
| 29 | + |
| 30 | +```bash |
| 31 | +pip install -r mcp_server/requirements.txt |
| 32 | +``` |
| 33 | + |
| 34 | +### Running the server |
| 35 | + |
| 36 | +```bash |
| 37 | +# Run as a stdio MCP server (default — for Claude Desktop and most MCP clients) |
| 38 | +python -m mcp_server.server |
| 39 | + |
| 40 | +# Or directly |
| 41 | +python mcp_server/server.py |
| 42 | +``` |
| 43 | + |
| 44 | +### Connecting to Claude Desktop |
| 45 | + |
| 46 | +Add to `claude_desktop_config.json` |
| 47 | +(`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS): |
| 48 | + |
| 49 | +```json |
| 50 | +{ |
| 51 | + "mcpServers": { |
| 52 | + "devops-os": { |
| 53 | + "command": "python", |
| 54 | + "args": ["-m", "mcp_server.server"], |
| 55 | + "cwd": "/path/to/devops_os" |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +Restart Claude Desktop, then ask it: |
| 62 | + |
| 63 | +> *"Generate a complete GitHub Actions CI/CD workflow for a Python + Node.js project with Kubernetes deployment using Kustomize."* |
| 64 | +
|
| 65 | +> *"Create a Jenkins pipeline for a Python microservice with Docker build and push stages."* |
| 66 | +
|
| 67 | +> *"Scaffold a devcontainer for a Go + Python project with Terraform and kubectl."* |
| 68 | +
|
| 69 | +--- |
| 70 | + |
| 71 | +## Architecture |
| 72 | + |
| 73 | +``` |
| 74 | +AI Assistant (Claude / ChatGPT) |
| 75 | + │ MCP / function-call request |
| 76 | + ▼ |
| 77 | +DevOps-OS MCP Server ←──────────┐ |
| 78 | + │ │ |
| 79 | + │ calls Python functions │ |
| 80 | + ▼ │ |
| 81 | + cli.scaffold_gha │ |
| 82 | + cli.scaffold_gitlab (same generators |
| 83 | + cli.scaffold_jenkins used by the CLI) |
| 84 | + cli.scaffold_argocd │ |
| 85 | + cli.scaffold_sre │ |
| 86 | + │ │ |
| 87 | + ▼ │ |
| 88 | + Generated files ───────────────┘ |
| 89 | +``` |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## Using with Claude (Anthropic API) |
| 94 | + |
| 95 | +Load `skills/claude_tools.json` as the `tools` parameter: |
| 96 | + |
| 97 | +```python |
| 98 | +import json |
| 99 | +import anthropic |
| 100 | + |
| 101 | +with open("skills/claude_tools.json") as fh: |
| 102 | + tools = json.load(fh) |
| 103 | + |
| 104 | +client = anthropic.Anthropic() |
| 105 | +response = client.messages.create( |
| 106 | + model="claude-opus-4-5", |
| 107 | + max_tokens=4096, |
| 108 | + tools=tools, |
| 109 | + messages=[{ |
| 110 | + "role": "user", |
| 111 | + "content": ( |
| 112 | + "Generate a complete GitHub Actions CI/CD workflow for a " |
| 113 | + "Python + Node.js project with Kubernetes deployment via Kustomize." |
| 114 | + ), |
| 115 | + }], |
| 116 | +) |
| 117 | + |
| 118 | +for block in response.content: |
| 119 | + if block.type == "tool_use": |
| 120 | + print(f"Tool: {block.name}") |
| 121 | + print(f"Input: {json.dumps(block.input, indent=2)}") |
| 122 | +``` |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Using with OpenAI (function calling) |
| 127 | + |
| 128 | +Load `skills/openai_functions.json` as the `tools` parameter: |
| 129 | + |
| 130 | +```python |
| 131 | +import json |
| 132 | +import openai |
| 133 | + |
| 134 | +with open("skills/openai_functions.json") as fh: |
| 135 | + functions = json.load(fh) |
| 136 | + |
| 137 | +client = openai.OpenAI() |
| 138 | +response = client.chat.completions.create( |
| 139 | + model="gpt-4o", |
| 140 | + tools=functions, |
| 141 | + messages=[{ |
| 142 | + "role": "user", |
| 143 | + "content": "Generate a Jenkins pipeline for a Java Spring Boot app." |
| 144 | + }], |
| 145 | +) |
| 146 | + |
| 147 | +for choice in response.choices: |
| 148 | + if choice.message.tool_calls: |
| 149 | + for tc in choice.message.tool_calls: |
| 150 | + print(f"Function: {tc.function.name}") |
| 151 | + print(f"Args: {tc.function.arguments}") |
| 152 | +``` |
| 153 | + |
| 154 | +--- |
| 155 | + |
| 156 | +## Custom GPT / GPT Actions |
| 157 | + |
| 158 | +Use `skills/openai_functions.json` as the OpenAPI schema for a Custom GPT Action: |
| 159 | + |
| 160 | +1. Open **ChatGPT → Create a GPT → Configure → Actions → Create new action** |
| 161 | +2. Paste the contents of `skills/openai_functions.json` |
| 162 | +3. Set the server URL to your deployed MCP server endpoint |
| 163 | +4. Save and test the GPT |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## Example Prompts |
| 168 | + |
| 169 | +``` |
| 170 | +Generate a GitHub Actions workflow for a Java Spring Boot app with kubectl deployment. |
| 171 | +
|
| 172 | +Create a Jenkins pipeline for a Python microservice with Docker build and push stages. |
| 173 | +
|
| 174 | +Scaffold a devcontainer for a Go + Python project with Terraform and kubectl. |
| 175 | +
|
| 176 | +Generate Kubernetes manifests for an app called 'api-service' using image |
| 177 | +'ghcr.io/myorg/api-service:v1.2.3' with 3 replicas on port 8080. |
| 178 | +
|
| 179 | +Create a GitLab CI pipeline with Python testing and ArgoCD deployment. |
| 180 | +
|
| 181 | +Generate SRE configs for my-service with a 99.9% availability SLO and PagerDuty alerts. |
| 182 | +``` |
0 commit comments