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.
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.
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.
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
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 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.
Clone repository
git clone <repo>
cd DevOpsMCP
Install dependencies
pip install -r requirements.txt
Set environment variables
export OPENAI_API_KEY=your_api_key
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?