A FastMCP-based MCP server for DevOps
Project description
DevOps MCP Server
A FastMCP-based MCP server providing a suite of DevOps tools and integrations.
This server operates in a read-only manner, retrieving data for analysis and display without modifying your systems. It's designed with safety in mind for DevOps environments.
Features
The DevOps MCP Server integrates with various essential DevOps platforms:
GitHub Integration
- Repository Management: Search and view repository details.
- File Access: Retrieve file contents from repositories.
- Issue Tracking: Manage and track issues.
- Code Search: Perform targeted code searches.
- Commit History: View commit history for branches.
- Public & Enterprise Support: Automatically detects and connects to both public GitHub and GitHub Enterprise instances (configurable via
GITHUB_API_URL).
Jenkins Integration
- Job Management: List and manage Jenkins jobs.
- Build Logs: Retrieve and analyze build logs.
- View Management: Access and manage Jenkins views.
- Build Parameters: Inspect parameters used for builds.
- Failure Monitoring: Identify and monitor recent failed builds.
Artifactory Integration
- Repository Browsing: List items (files and directories) within Artifactory repositories.
- Artifact Search: Search for artifacts by name or path across multiple repositories using Artifactory Query Language (AQL).
- Item Details: Retrieve metadata and properties for specific files and directories.
- Authentication: Supports both token-based and username/password authentication.
Installation
Install the package using pip:
pip install devops-mcps
Usage
Run the MCP server directly:
devops-mcps
Transport Configuration
The server supports two communication transport types:
stdio(default): Standard input/output.sse: Server-Sent Events over HTTP.
Local Usage:
# Default stdio transport
devops-mcps
# SSE transport (runs on http://localhost:8000 by default)
devops-mcps --transport sse
UVX Usage:
If using UVX, first install the tools:
uvx install
Then run:
# Default stdio transport
uvx run devops-mcps
# SSE transport
uvx run devops-mcps-sse
Configuration
Configure the server using environment variables:
Required:
# GitHub
export GITHUB_PERSONAL_ACCESS_TOKEN="your_github_token"
# Optional: For GitHub Enterprise, set your API endpoint
# export GITHUB_API_URL="https://github.mycompany.com"
# Jenkins
export JENKINS_URL="your_jenkins_url"
export JENKINS_USER="your_jenkins_username"
export JENKINS_TOKEN="your_jenkins_api_token_or_password"
# Artifactory
export ARTIFACTORY_URL="https://your-artifactory-instance.example.com"
# Choose ONE authentication method:
export ARTIFACTORY_IDENTITY_TOKEN="your_artifactory_identity_token"
# OR
export ARTIFACTORY_USERNAME="your_artifactory_username"
export ARTIFACTORY_PASSWORD="your_artifactory_password"
Optional:
# Jenkins Log Length (default: 5120 bytes)
export LOG_LENGTH=10240
Note: LOG_LENGTH controls the amount of Jenkins log data retrieved. Adjust as needed.
Docker
Build the Docker image:
docker build -t devops-mcps .
Run the container:
# Stdio transport (interactive)
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN="..." \
-e JENKINS_URL="..." \
-e JENKINS_USER="..." \
-e JENKINS_TOKEN="..." \
-e ARTIFACTORY_URL="..." \
-e ARTIFACTORY_IDENTITY_TOKEN="..." \
devops-mcps
# SSE transport (background, port 8000)
docker run -d -p 8000:8000 --rm \
-e TRANSPORT_TYPE=sse \
-e GITHUB_PERSONAL_ACCESS_TOKEN="..." \
-e JENKINS_URL="..." \
-e JENKINS_USER="..." \
-e JENKINS_TOKEN="..." \
-e ARTIFACTORY_URL="..." \
-e ARTIFACTORY_IDENTITY_TOKEN="..." \
devops-mcps
Replace ... with your actual credentials.
VSCode Integration
Configure the MCP server in VSCode's settings.json:
Example (UVX with stdio):
"devops-mcps": {
"type": "stdio",
"command": "uvx",
"args": ["run", "devops-mcps"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_...",
"GITHUB_API_URL": "https://github.mycompany.com", // Optional for GHE
"JENKINS_URL": "...",
"JENKINS_USER": "...",
"JENKINS_TOKEN": "...",
"ARTIFACTORY_URL": "...",
"ARTIFACTORY_IDENTITY_TOKEN": "cm..." // Or USERNAME/PASSWORD
}
}
Example (Docker with SSE):
Ensure the Docker container is running with SSE enabled (see Docker section).
"devops-mcps": {
"type": "sse",
"url": "http://localhost:8000/sse", // Adjust if Docker host is remote
"env": {
// Environment variables are set in the container,
// but can be overridden here if needed.
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
}
}
Refer to the initial README.md sections for other transport/runner combinations (UVX/SSE, Docker/stdio).
Development
Set up your development environment:
# Install dependencies (using uv)
uv pip install -e ".[dev]"
# Or sync with lock file
# uv sync --dev
Linting and Formatting (Ruff):
# Check code style
uvx ruff check .
# Format code
uvx ruff format .
Testing (Pytest):
pytest --cov=src/devops_mcps --cov-report=html tests/
Debugging with MCP Inspector:
# Basic run
npx @modelcontextprotocol/inspector uvx run devops-mcps
# Run with specific environment variables
npx @modelcontextprotocol/inspector uvx run devops-mcps -e GITHUB_PERSONAL_ACCESS_TOKEN=... -e JENKINS_URL=... # Add other vars
Checking for package dependencies outdated
uv pip list --outdated
Updating package dependencies
uv lock --upgrade
CI/CD
A GitHub Actions workflow (.github/workflows/ci.yml) handles:
- Linting & Testing: Runs Ruff and Pytest on pushes and pull requests.
- Publishing: Builds and publishes the Python package to PyPI and the Docker image to Docker Hub on pushes to the
mainbranch.
Required Repository Secrets:
PYPI_API_TOKEN: PyPI token for package publishing.DOCKER_HUB_USERNAME: Docker Hub username.DOCKER_HUB_TOKEN: Docker Hub access token.
Packaging and Publishing (Manual)
Ensure you have build and twine installed:
pip install -U build twine
- Update Version: Increment the version number in
pyproject.toml. - Build:
python -m build - Upload:
twine upload dist/*(Requires~/.pypircconfiguration or token input).
Appendix: GitHub Search Query Syntax
Leverage GitHub's powerful search syntax within the MCP tools:
Repository Search (gh_search_repositories):
in:name,description,readme: Search specific fields. Example:fastapi in:nameuser:USERNAMEororg:ORGNAME: Scope search to a user/org. Example:user:tiangolo fastapilanguage:LANGUAGE: Filter by language. Example:http client language:pythonstars:>N,forks:<N,created:YYYY-MM-DD,pushed:>YYYY-MM-DD: Filter by metrics and dates. Example:language:javascript stars:>1000 pushed:>2024-01-01topic:TOPIC-NAME: Filter by topic. Example:topic:docker topic:pythonlicense:LICENSE-KEYWORD: Filter by license (e.g.,mit,apache-2.0). Example:language:go license:mit
Code Search (gh_search_code):
in:file,path: Search file content (default) or path. Example:"import requests" in:filerepo:OWNER/REPO: Scope search to a specific repository. Example:"JenkinsAPIException" repo:your-org/your-repolanguage:LANGUAGE: Filter by file language. Example:def main language:pythonpath:PATH/TO/DIR,filename:FILENAME.EXT,extension:EXT: Filter by path, filename, or extension. Example:"GithubException" path:src/devops_mcps extension:py
References:
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devops_mcps-0.6.12.tar.gz.
File metadata
- Download URL: devops_mcps-0.6.12.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dc038c0130423107354d36fa6cc05f1b6a350773f929ab9f89a44c0d7efecae
|
|
| MD5 |
a5c8a9485643cd26ed7e32e4304e16ee
|
|
| BLAKE2b-256 |
7b23c84819df6072888a1fe702569e18ca885215d36f5704f89dd4f56052ea98
|
File details
Details for the file devops_mcps-0.6.12-py3-none-any.whl.
File metadata
- Download URL: devops_mcps-0.6.12-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbe5d0380862101ff7dc41d0de01ff50a99b5140175a36a835594fcac99922d4
|
|
| MD5 |
dd1058999c04cc11a9b334479a1f00d6
|
|
| BLAKE2b-256 |
dce810e1031f07b34fc0d5b41f372380fa596e0f5e46deb53935def9ca5060e3
|