Devops Mcps

Devops Mcps

🚀 DevOps-MCPS项目文档

DevOps-MCPS是一个具备GitHub代码搜索、Jenkins任务管理和Slack通知集成等功能的项目,能有效助力DevOps流程的自动化和管理。

🚀 快速开始

本项目提供了多种安装方式,你可以根据自己的需求进行选择。

📦 安装指南

使用pip安装最新版本

pip install devops-mcps

指定版本安装

pip install "devops-mcps==0.15.0"

从源码安装

git clone https://github.com/your-org/devops-mcps.git
cd devops-mcps
python -m pip install -e .

🛠️ 配置指南

环境变量

项目依赖以下环境变量:

  • GITHUB_API_TOKEN:GitHub API访问令牌,用于GitHub搜索功能。
  • JENKINS_SERVER_URL:Jenkins服务器URL地址。
  • SLACK_WEBHOOK_URL:Slack机器人Webhook URL。

日志配置

日志默认输出到控制台。如需调整日志级别或格式,请编辑logging.ini文件:

[loggers]
keys = root, devops_mcps

[handlers]
keys = consoleHandler

[formatters]
keys = simpleFormatter

[logger_root]
level = NOTSET
handlers =
qualname =

[logger_devops_mcps]
level = INFO
handlers = consoleHandler
qualname = devops_mcps

[handler_consoleHandler]
class = StreamHandler
level = NOTSET
formatter = simpleFormatter
args = (sys.stderr,)

[formatter_simpleFormatter]
format = %(asctime)s - %(levelname)-5s - %(module)s:%(lineno)d - %(message)s
datefmt = %H:%M:%S

🛠️ 开发指南

项目结构

src/
├── devops_mcps/
│   ├── __init__.py
│   ├── cli.py
│   └── services/
│       ├── jenkins_service.py
│       └── slack_notifier.py
tests/
├── test_cli.py
└── test_jenkins_service.py

依赖管理

使用uv进行依赖管理:

# 安装基本依赖
uv pip install -r requirements.txt

# 同步锁定文件
uv lock update

💻 使用示例

基础用法

核心功能

  1. GitHub代码搜索:通过GitHub API搜索特定仓库或代码片段。
devops-mcps gh-search-code --query "fastapi" --language python
  1. Jenkins任务管理:监控和管理Jenkins构建作业。
devops-mcps jenkins-job status --job_name my_job
  1. Slack通知集成:将项目状态或错误信息发送到Slack频道。
devops-mcps slack notify --message "构建完成,请检查结果"

🤝 贡献指南

提交规范

遵循Conventional Commits规范进行代码提交。

问题报告

如遇问题,请访问GitHub Issues页面提交: https://github.com/your-org/devops-mcps/issues

🧪 测试指南

单元测试

运行所有单元测试

pytest tests/

指定测试模块运行

pytest tests/test_cli.py -v

生成测试报告

coverage run -m pytest tests/ && coverage report

集成测试

集成测试配置在tests/integration_test.py文件中,需确保已配置好相关环境变量。

🔄 持续集成

项目使用GitHub Actions进行持续集成。以下是主要工作流配置:

name: CI-CD

on:
push:
branches: [ main ]
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v3

- name: Install dependencies
run: pip install -r requirements.txt

- name: Run tests
run: pytest --cov .

📄 许可证

本项目遵循MIT License协议。具体许可证内容如下:

The MIT License (MIT)
Copyright (c) 2023 Your Name
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

📚 附录

工具依赖

属性 详情
模型类型
训练数据
工具依赖 Python 3.8+;Jenkins API Client(用于与Jenkins服务器交互);Slack API Wrapper(集成Slack机器人功能)

贡献者

感谢以下贡献者:

更多信息

项目官网:https://devops-mcps.readthedocs.io

  • 0 关注
  • 0 收藏,15 浏览
  • system 提出于 2025-09-27 03:27

相似服务问题

相关AI产品