ArgoCD MCP Server
Un servidor MCP (Model Context Protocol) que s'integra amb l'API d'ArgoCD, permetent als assistents IA i models de llenguatge gran gestionar aplicacions i recursos d'ArgoCD a través d'interaccions en llenguatge natural.
Features
- Authentication & Session Management
- Recuperació d'informació d'usuari a través de l'API d'ArgoCD
- Autenticació basada en token amb ArgoCD
- Accés a la configuració i a la configuració del servidor
- Recuperació d'informació dels connectors
- Recuperació d'informació de la versió
- Application Management
- Llistat i filtratge d'aplicacions per projecte, nom, espai de noms
- Obtenir informació detallada de l'aplicació
- Crear, actualitzar i eliminar aplicacions
- Sincronitzar aplicacions amb opcions configurables
- Robust API Client
- Normalització d'URL i gestió intel·ligent dels punts finals
- Gestió exhaustiva d'errors i missatges d'error detallats
- Temps d'espera configurables i verificació SSL
- Protecció de seguretat del token i enmascarat
- Developer Experience
- Comprovació de tipus estàtica completa amb mypy
- Documentació detallada i exemples
- Configuració basada en entorn
Quick Start
Setup
# Clone the repository
git clone https://github.com/severity1/argocd-mcp.git
cd argocd-mcp
# Create virtual environment and activate it
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install -e .
Starting the Server
El servidor es configura mitjançant variables d'entorn. A continuació es mostren les opcions de configuració disponibles:
| Environment Variable | Description | Default Value |
|---|---|---|
ARGOCD_TOKEN | ArgoCD API token | None |
ARGOCD_API_URL | ArgoCD API endpoint | https://argocd.example.com/api/v1 |
ARGOCD_VERIFY_SSL | Verify SSL certificates | true |
Podeu iniciar el servidor de diverses maneres:
# Using MCP dev tools (provides debugging tools)
export ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
mcp dev server.py
# Using MCP run command
export ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
mcp run server.py
# Standard method
export ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
uv run server.py
# Setting multiple environment variables
export ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
export ARGOCD_API_URL=https://your-argocd-server.com:9000/api/v1
export ARGOCD_VERIFY_SSL=false # Disable SSL verification for self-signed certs
uv run server.py
# Using a .env file
echo "ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
ARGOCD_API_URL=https://your-argocd-server.com:9000/api/v1
ARGOCD_VERIFY_SSL=false" > .env
uv run server.py
# Run in background
export ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN
uv run server.py > server.log 2>&1 & echo $! > server.pid
Quan el token es proporciona mitjançant una variable d'entorn, Claude pot utilitzar-lo sense que hàgiu d'especificar-lo en cada ordre.
Connecting with Claude
Using Claude Code CLI
# Add the MCP server
claude mcp add argocd-mcp "uv run $(pwd)/server.py"
# With token
claude mcp add argocd-mcp -e ARGOCD_TOKEN=YOUR_ARGOCD_TOKEN -- "uv run $(pwd)/server.py"
# Verify it was added
claude mcp list
# For debugging, you can use MCP Inspector with 'mcp dev' command
Using Claude Desktop
Create a claude_desktop_config.json configuration file:
{
"mcpServers": {
"argocd-mcp": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/argocd-mcp",
"run",
"server.py"
],
"env": {
"ARGOCD_TOKEN": "your_argocd_token",
"ARGOCD_API_URL": "https://your-argocd-server.com/api/v1",
"ARGOCD_VERIFY_SSL": "true"
}
}
}
}
Substituïu els camins i els valors de configuració amb els vostres valors reals:
- Utilitzeu el camí complet a l'executable uv (trobeu-lo amb
which uva macOS/Linux owhere uva Windows) - Establiu el camí correcte a la instal·lació d'argocd-mcp
- Afegeix el vostre token d'API d'ArgoCD
- Configureu altres variables d'entorn segons sigui necessari
Aquesta configuració indica a Claude Desktop com iniciar el servidor MCP automàticament amb els vostres paràmetres d'entorn específics.
Available Tools
Session Tools
get_user_info: Get the current user's info via api/v1/session/userinfo
Settings Tools
get_settings: Get ArgoCD server settings including UI, OIDC, and other configurationsget_plugins: Get information about configured ArgoCD plugins
Version Tools
get_version: Get version information of the API server
Application Management Tools
list_applications: Get all applications with filtering optionsget_application_details: Get detailed information about a specific applicationcreate_application: Create a new applicationupdate_application: Update an existing applicationdelete_application: Delete an applicationsync_application: Trigger a sync operation on an application
Example Conversations
Checking User Information
User: What's my user information in ArgoCD?
Claude: Let me retrieve your user information.
⏺ argocd-mcp:get_user_info (MCP)
⎿ {"loggedIn": true, "username": "devops-user", "iss": "argocd"}
You are logged in as 'devops-user'.
Getting ArgoCD Version
User: What version of ArgoCD is running on the server?
Claude: Let me check the ArgoCD version information.
⏺ argocd-mcp:get_version (MCP)
⎿ {
"Version": "v2.9.3+5eaf684",
"BuildDate": "2023-09-15T14:25:11Z",
"GitCommit": "5eaf68452",
"GitTreeState": "clean",
"GoVersion": "go1.20.7",
"Compiler": "gc",
"Platform": "linux/amd64",
"KustomizeVersion": "v5.1.1",
"HelmVersion": "v3.12.3",
"KubectlVersion": "v1.27.4",
"JsonnetVersion": "v0.20.0"
}
You're running ArgoCD v2.9.3, built on September 15, 2023. It's running on Linux (amd64) with Go 1.20.7, and includes Kustomize v5.1.1 and Helm v3.12.3.
Wy>
Getting ArgoCD Settings
User: What are the current ArgoCD settings?
Claude: Let me fetch the current ArgoCD settings.
⏺ argocd-mcp:get_settings (MCP)
⎿ {
"settings": {
"ui": {
"theme": "dark"
},
"oidc": {
"enabled": true
}
},
"plugins": [
{
"name": "gitlab",
"enabled": true
}
]
}
The current ArgoCD settings include a dark UI theme and OIDC authentication enabled. The gitlab plugin is also enabled.
Managing Applications
User: List all applications in the 'prod' project.
Claude: Sure, listing applications in the 'prod' project.
⏺ argocd-mcp:list_applications (MCP)
⎿ [
{
"name": "frontend",
"project": "prod",
"namespace": "frontend",
"status": "Synced"
},
{
"name": "backend",
"project": "prod",
"namespace": "backend",
"status": "OutOfSync"
}
]
Here are the applications in the 'prod' project:
- frontend (Synced)
- backend (OutOfSync)
User: Sync the 'backend' application. Claude: Syncing 'backend' application now. ⏺ argocd-mcp:sync_application (MCP) ⎿ { "name": "backend", "status": "Syncing", "syncResult": { "status": "Success", "message": "Sync completed successfully" } } The 'backend' application is 



