Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOpsMCP

DevOps MCP Assistant

An AI-powered DevOps assistant built using the Model Context Protocol (MCP) and OpenAI tool-calling. The system analyzes code changes, executes tests, and determines whether it is safe to commit by combining deterministic tooling with LLM-based reasoning.

Overview

This project demonstrates a production-style AI architecture that separates:

  • Reasoning (LLM) — interprets results and makes decisions
  • Execution (MCP tools) — performs deterministic actions such as retrieving diffs and running tests
  • Instead of relying on assumptions, the assistant operates on real repository data and test outputs.

Architecture

User ↓ LLM Client (OpenAI) ↓ (tool calls) MCP Server ↓ DevOps Tools (git, pytest) ↓ LLM interprets results → response

This design enables reliable, grounded responses by ensuring that all critical operations are executed through controlled tools.

Tools

get_git_diff: Retrieves repository changes.

Modes:

  • unstaged — working tree vs index
  • staged — index vs HEAD (changes ready to commit)
  • refs — comparison between two commits, branches, or tags

run_tests: Executes the test suite using pytest.

Returns:

  • success status
  • stdout / stderr
  • exit code
  • get_git_status

Provides repository state, including:

  • staged changes
  • unstaged changes
  • untracked files

Example Usage

Generate Commit Message: Generate a commit message for my staged changes

Output:

feat(client): add async MCP client with OpenAI integration

- implement interactive MCP client
- remove legacy commit generator
- simplify server startup logic
Pre-Commit Safety Check
I made some changes. Check what changed, run the tests, and tell me if it's safe to commit.

Output:

Safe to commit: NO

Reason:
- 1 test failing: test_git_diff_staged_success
- failure caused by incorrect base/target assignment in get_git_diff

Run Tests

Run the tests and summarize results

Output:

No regressions detected.

Features:

  • OpenAI tool-calling integration
  • MCP-based tool server
  • Deterministic DevOps execution layer
  • Multi-step reasoning across tools
  • Grounded, non-hallucinated outputs

Why MCP: The Model Context Protocol enables:

  • standardized tool interfaces
  • separation between reasoning and execution
  • reusable AI infrastructure
  • safer, more reliable AI workflows

This project illustrates how MCP can be used to build real-world AI systems beyond simple chat interfaces.

Setup

Clone repository

git clone <repo> 
cd DevOpsMCP

Install dependencies

pip install -r requirements.txt

Set environment variables

export OPENAI_API_KEY=your_api_key

Running the System

Start MCP Server

python server/main.py

Start Client

python client/client.py

Example Queries

Generate a commit message for my staged changes
What changed in this repository?
Run the tests
Is it safe to commit?

About

AI DevOps assistant using MCP for tool-enabled infrastructure and development workflows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages