Skip to content

victoranolu/DevOps-Assistant-MCP-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps Assistant

A simple Node.js API service for managing Kubernetes deployments and triggering GitHub Actions workflows.

What it does

  • Restarts Kubernetes deployments via /devops/restart
  • Retrieves pod logs via /devops/logs
  • Triggers GitHub Actions workflows via /devops/deploy
  • Provides Slack integration points for slash commands and event handling
  • Supports Docker deployment and Kubernetes manifests for in-cluster use

Technology stack

  • Node.js
  • Express
  • @kubernetes/client-node
  • GitHub Actions API via Axios
  • Slack API integration via Axios

Local setup

Prerequisites

  • Node.js 20+
  • npm
  • Docker (optional, but recommended for container testing)

Install dependencies

npm install

Run locally

Create a .env file at the project root with at least:

API_KEY=your_api_key
GITHUB_TOKEN=your_github_token
SLACK_SIGNING_SECRET=your_slack_signing_secret
SLACK_BOT_TOKEN=your_slack_bot_token

Then start the server:

node src/server.js

The app listens on port 3000 by default.

Health check

curl http://localhost:3000/health

API endpoints

Restart deployment

curl -X POST http://localhost:3000/devops/restart \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"my-deployment","namespace":"staging"}'

Get logs

curl "http://localhost:3000/devops/logs?pod=my-pod&namespace=staging" \
  -H "x-api-key: your_api_key"

Trigger GitHub workflow

curl -X POST http://localhost:3000/devops/deploy \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"owner":"your-org","repo":"your-repo","workflow":"deploy.yml"}'

Docker usage

Build the image:

docker build -t devops-assistant .

Run the container:

docker run --rm -p 3000:3000 -e API_KEY=your_api_key devops-assistant

For real cluster access, mount your kubeconfig and add secrets:

docker run --rm -p 3000:3000 \
  -e API_KEY=your_api_key \
  -e GITHUB_TOKEN=your_github_token \
  -e SLACK_SIGNING_SECRET=your_slack_signing_secret \
  -e SLACK_BOT_TOKEN=your_slack_bot_token \
  -v /path/to/kubeconfig:/root/.kube/config \
  devops-assistant

Kubernetes deployment

Manifests are provided in the k8s/ directory:

  • serviceaccount-role.yaml - service account and RBAC permissions
  • secret.yaml - secret template for API key and tokens
  • deployment.yaml - deployment manifest
  • service.yaml - cluster service

Apply them with:

kubectl apply -f k8s/serviceaccount-role.yaml -f k8s/secret.yaml -f k8s/deployment.yaml -f k8s/service.yaml

Slack integration

The app exposes Slack endpoints at:

  • POST /slack/command
  • POST /slack/events

These endpoints require SLACK_SIGNING_SECRET and SLACK_BOT_TOKEN.

Notes

  • API_KEY is required for /devops routes.
  • Kubernetes actions will work only when the app has cluster access (KUBECONFIG locally or in-cluster config).
  • Slack requires a public URL for event subscription and slash command callback.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors