ArgoCD Integration
STDIOMCP server integrating with ArgoCD API for natural language management of applications.
MCP server integrating with ArgoCD API for natural language management of applications.
An MCP (Model Context Protocol) server that integrates with the ArgoCD API, enabling AI assistants and large language models to manage ArgoCD applications and resources through natural language interactions.
# 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 .
The server is configured via environment variables. Here are the available configuration options:
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 |
You can start the server in several ways:
# 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
When the token is provided via environment variable, Claude can use it without you having to specify it in every command.
# 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
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" } } } }
Replace the paths and configuration values with your actual values:
which uv
on macOS/Linux or where uv
on Windows)This configuration tells Claude Desktop how to start the MCP server automatically with your specific environment settings.
get_user_info
: Get the current user's info via api/v1/session/userinfoget_settings
: Get ArgoCD server settings including UI, OIDC, and other configurationsget_plugins
: Get information about configured ArgoCD pluginsget_version
: Get version information of the API serverlist_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 applicationUser: 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'.
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.
User: Show me the ArgoCD server settings
Claude: Let me retrieve the ArgoCD server settings for you.
⏺ argocd-mcp:get_settings (MCP)
⎿ {
"clusterSettings": {
"appLabelKey": "argocd.argoproj.io/instance",
"controllerNamespace": "argocd",
"execEnabled": true,
"statusBadgeEnabled": true,
"uiBannerContent": "This is a development instance of ArgoCD",
"url": "https://argocd.example.com"
}
}
Here are the key settings for your ArgoCD server:
- URL: https://argocd.example.com
- Controller namespace: argocd
- Exec enabled: Yes
- Status badge enabled: Yes
- UI Banner: "This is a development instance of ArgoCD"
User: What applications do I have in the "production" project?
Claude: Let me list your applications in the production project.
⏺ argocd-mcp:list_applications (MCP)
⎿ {
"items": [
{
"metadata": {
"name": "frontend-app",
},
"status": {
"sync": {"status": "Synced"},
"health": {"status": "Healthy"},
}
},
{
"metadata": {
"name": "api-service",
},
"status": {
"sync": {"status": "OutOfSync"},
"health": {"status": "Healthy"},
}
},
{
"metadata": {
"name": "database",
},
"status": {
"sync": {"status": "Synced"},
"health": {"status": "Degraded"},
}
}
]
}
You have 3 applications in the production project:
- frontend-app (Synced, Healthy)
- api-service (OutOfSync, Healthy)
- database (Synced, Degraded)
User: Sync the api-service application
Claude: I'll sync the api-service application for you.
⏺ argocd-mcp:sync_application (MCP)
⎿ {
"resourcesResult": {
"updated": ["Deployment/api-service"],
"hooks": []
},
"status": "Syncing"
}
Application sync initiated successfully. The sync operation is now in progress.
This project uses mypy for static type checking to enhance code quality and catch type-related bugs early:
# Install mypy uv pip install mypy # Run type checking uv run -m mypy .
Type checking configuration is available in both pyproject.toml
and mypy.ini
. The configuration enforces strict typing rules including:
The code is organized into a modular structure:
argocd-mcp/
├── api/ # API client and communication
│ ├── __init__.py
│ └── client.py # HTTP client for ArgoCD API
├── models/ # Data models
│ ├── __init__.py
│ └── applications.py # Application data structures
├── tools/ # MCP tools implementation
│ ├── __init__.py
│ ├── session.py # Session tools (user info)
│ ├── applications.py # Application management tools
│ ├── settings.py # Server settings tools
│ └── version.py # Version information tools
├── utils/ # Utility functions
│ ├── __init__.py
├── server.py # Main server entry point
├── pyproject.toml # Project configuration and dependencies
└── mypy.ini # Mypy type checking configuration
To add new features:
tools
directoryserver.py
If you encounter issues:
Processing request of type CallToolRequest
is informational, not an errormcp dev server.py
, the MCP Inspector will automatically open at http://localhost:5173 for debugging# Disable SSL verification export ARGOCD_VERIFY_SSL=false uv run server.py
# Show all current ArgoCD environment variables env | grep ARGOCD
Contributions are welcome! Please open an issue or pull request if you'd like to contribute to this project.
When contributing, please follow these guidelines: