DevOps MCP Server
Automates CI/CD pipeline control, PR review, Git operations, and monitoring/alerting with role-based access control.
README
DevOps MCP Server
A small, working Model Context Protocol (MCP) server that automates common DevOps tasks — CI/CD pipeline control, PR review, Git operations, and monitoring/alerting — all gated behind a role-based access control layer.
Built as a portfolio project to demonstrate the concepts from an MCP for DevOps course: MCP server architecture, security & access control, CI/CD platform integration, PR review agents, approval workflows, and Git automation.
Why this project
Rather than one script per topic, this wires the concepts into one coherent system: an AI assistant (or any MCP client) can call these tools to check pipeline health, review a pull request for risky/secret-leaking code, automate git branching/commits, and trigger deploys — but every action is authorized against a role first, and every decision (allowed or denied) is written to an audit log.
Architecture
devops-mcp-server/
├── server/
│ ├── main.py # MCP server entry point — registers all tools
│ ├── security.py # RBAC: roles, authorization, audit log
│ ├── pipelines.py # Simulated CI/CD backend + monitoring/alerts
│ ├── pr_review.py # Static analysis PR review agent
│ └── git_ops.py # Real git automation (subprocess against sandbox repo)
├── sandbox_repo/ # A real local git repo the tools operate on
├── demo/
│ └── run_demo.py # Scripted walkthrough exercising every tool
└── requirements.txt
Concept → implementation map
| Course topic | Where it lives |
|---|---|
| MCP Architecture / Server Design | server/main.py — tools registered via FastMCP |
| Security and Access Control in MCP | server/security.py — Role enum, AccessControl, audit trail |
| MCP Integration with CI/CD Platforms | server/pipelines.py — list_pipelines, trigger_pipeline |
| Pipeline Monitoring and Alerting | server/pipelines.py — _raise_alert, list_alerts |
| Building Intelligent PR Review Agents | server/pr_review.py — secret/risk pattern detection, recommendation |
| Approval Workflows / Human-AI Collaboration | pipelines.py — production deploys require ADMIN approval |
| Automated Git Operations via MCP | server/git_ops.py — branch creation, commits via real git |
Roles (simulated identity directory)
| User | Role | Can do |
|---|---|---|
dave |
VIEWER | Read-only: view pipelines, status, alerts, repo state |
carol |
DEVELOPER | + review PRs, create branches, commit |
bob |
OPERATOR | + trigger pipelines, deploy to staging |
alice |
ADMIN | + approve production deploys, view audit log |
Every tool declares its minimum required role. Unauthorized calls are rejected and logged — nothing fails silently.
Running it
pip install -r requirements.txt
# Option A: scripted demo (no MCP client needed) — recommended first run
python demo/run_demo.py
# Option B: run as a real MCP server over stdio, e.g. to plug into
# Claude Desktop / any MCP client
python -m server.main
To wire it into an MCP client config (e.g. Claude Desktop), point it at:
{
"mcpServers": {
"devops-mcp-server": {
"command": "python",
"args": ["-m", "server.main"],
"cwd": "/path/to/devops-mcp-server"
}
}
}
What the demo shows
demo/run_demo.py runs a full scripted transcript:
- A
VIEWERcan read pipeline data but is denied when trying to trigger one. - An
OPERATORtriggers a staging deploy — succeeds and runs. - An
OPERATORtriggers a production deploy — it stalls inawaiting_approval. - The
OPERATORtries to self-approve production — denied (needsADMIN). - An
ADMINapproves it — the deploy proceeds. - A
DEVELOPERsubmits a diff containing a hardcoded API key — the PR review agent flags it as critical and recommendsREQUEST_CHANGES. - A
DEVELOPERcreates a real git branch and commits a real file to the sandbox repo — verifiable afterward withgit log. - A
VIEWERtries to read the audit log — denied (ADMIN-only). - An
ADMINreads the full audit log, showing every allowed/denied call.
Notes on scope
- The CI/CD backend and identity directory are simulated in-memory so the
project runs standalone with no cloud credentials — the interface shape
(
list/status/trigger/approve) mirrors a real GitHub Actions/Jenkins integration. - Git operations are real — they run actual
gitcommands againstsandbox_repo/, so you can inspect the result withgit logyourself. - The PR review agent uses deterministic static-analysis rules so the demo
runs fully offline; swapping in an LLM call (e.g. the Anthropic API) for
natural-language review comments is a natural next step and slots cleanly
into
pr_review.py.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。