A Model Context Protocol (MCP) server that provides ArgoCD functionality as tools for LLMs via gRPC API.
list_application
- List ArgoCD applications with optional filtering by project, cluster, namespace, and label selectorsget_application
- Retrieve detailed information about a specific ArgoCD applicationget_application_manifests
- Get rendered Kubernetes manifests for an applicationget_application_events
- Get Kubernetes events for resources belonging to an applicationget_application_logs
- Retrieve logs from pods in an ArgoCD applicationget_application_resource_tree
- Get the resource tree structure of an application showing all managed resourcescreate_application
- Create a new ArgoCD application with source and destination configurationsync_application
- Trigger a sync operation for an application with optional prune and dry-run modesrefresh_application
- Refresh application state from the git repositorydelete_application
- Delete an ArgoCD application with optional cascade control
list_applicationset
- List ArgoCD ApplicationSets with optional filteringget_applicationset
- Retrieve detailed information about a specific ApplicationSetcreate_applicationset
- Create a new ApplicationSet with generators and templatesdelete_applicationset
- Delete an ApplicationSet with cascade control
list_project
- List all ArgoCD projectsget_project
- Retrieve detailed project information by namecreate_project
- Create new ArgoCD project with access controls and deployment restrictions
list_cluster
- List all registered clusters in ArgoCDget_cluster
- Retrieve detailed cluster information including configuration and status
list_repository
- List all configured Git repositoriesget_repository
- Get details of a specific repository including connection status
- Go 1.21+
- Access to an ArgoCD server with API token
go build -o argocd-mcp-server ./cmd/argocd-mcp-server
Set the following environment variables:
export ARGOCD_AUTH_TOKEN=$(argocd account generate-token)
export ARGOCD_SERVER=your-argocd-server.com:443 # Include port number
# Optional settings
export ARGOCD_INSECURE=false # Skip TLS verification (default: false)
export ARGOCD_PLAINTEXT=false # Use plaintext connection (default: false)
export ARGOCD_GRPC_WEB=false # Enable gRPC-Web proxy mode (default: false)
export ARGOCD_GRPC_WEB_ROOT_PATH="" # Custom root path for gRPC-Web requests (optional)
# Logging configuration
export LOG_LEVEL=info # Options: debug, info, warn, error
export LOG_FORMAT=text # Options: text, json
Run the server:
./argocd-mcp-server
The server communicates via stdin/stdout using the MCP protocol.
List available tools:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{}}}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | ./argocd-mcp-server
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "list_application",
"arguments": {
"project": "default"
}
}
}
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "get_application",
"arguments": {
"name": "my-app"
}
}
}
{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "get_application_manifests",
"arguments": {
"name": "my-app",
"revision": "main"
}
}
}
{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "get_application_events",
"arguments": {
"name": "my-app",
"resource_namespace": "default",
"resource_name": "my-deployment"
}
}
}
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "get_application_logs",
"arguments": {
"name": "my-app",
"pod_name": "my-app-deployment-abc123",
"container": "main",
"tail_lines": 100,
"since_seconds": 3600
}
}
}
{
"jsonrpc": "2.0",
"id": 8,
"method": "tools/call",
"params": {
"name": "get_application_resource_tree",
"arguments": {
"name": "my-app"
}
}
}
{
"jsonrpc": "2.0",
"id": 9,
"method": "tools/call",
"params": {
"name": "create_application",
"arguments": {
"name": "my-app",
"repo_url": "https://github.com/myorg/myrepo.git",
"path": "manifests",
"dest_namespace": "default",
"dest_server": "https://kubernetes.default.svc",
"project": "default",
"target_revision": "main",
"auto_sync": true,
"self_heal": true
}
}
}
{
"jsonrpc": "2.0",
"id": 10,
"method": "tools/call",
"params": {
"name": "sync_application",
"arguments": {
"name": "my-app",
"prune": true,
"dry_run": false
}
}
}
{
"jsonrpc": "2.0",
"id": 11,
"method": "tools/call",
"params": {
"name": "refresh_application",
"arguments": {
"name": "my-app",
"hard_refresh": false
}
}
}
{
"jsonrpc": "2.0",
"id": 12,
"method": "tools/call",
"params": {
"name": "delete_application",
"arguments": {
"name": "my-app",
"cascade": true
}
}
}
{
"jsonrpc": "2.0",
"id": 13,
"method": "tools/call",
"params": {
"name": "list_applicationset",
"arguments": {
"project": "default"
}
}
}
{
"jsonrpc": "2.0",
"id": 14,
"method": "tools/call",
"params": {
"name": "get_applicationset",
"arguments": {
"name": "my-appset"
}
}
}
{
"jsonrpc": "2.0",
"id": 15,
"method": "tools/call",
"params": {
"name": "create_applicationset",
"arguments": {
"name": "my-appset",
"namespace": "argocd",
"generators": [
{
"list": {
"elements": [
{"cluster": "dev", "namespace": "app-dev"},
{"cluster": "prod", "namespace": "app-prod"}
]
}
}
],
"template": {
"metadata": {
"name": "{{cluster}}-app"
},
"spec": {
"project": "default",
"source": {
"repoURL": "https://github.com/myorg/myrepo.git",
"targetRevision": "main",
"path": "manifests/{{cluster}}"
},
"destination": {
"server": "https://kubernetes.default.svc",
"namespace": "{{namespace}}"
}
}
}
}
}
}
{
"jsonrpc": "2.0",
"id": 16,
"method": "tools/call",
"params": {
"name": "delete_applicationset",
"arguments": {
"name": "my-appset",
"cascade": true
}
}
}
{
"jsonrpc": "2.0",
"id": 17,
"method": "tools/call",
"params": {
"name": "list_project",
"arguments": {}
}
}
{
"jsonrpc": "2.0",
"id": 18,
"method": "tools/call",
"params": {
"name": "get_project",
"arguments": {
"name": "my-project"
}
}
}
{
"jsonrpc": "2.0",
"id": 19,
"method": "tools/call",
"params": {
"name": "create_project",
"arguments": {
"name": "my-project",
"description": "My ArgoCD project",
"source_repos": "https://github.com/myorg/*",
"destination_namespace": "*",
"destination_server": "https://kubernetes.default.svc",
"namespace_resource_whitelist": "apps:Deployment,:Service,networking.k8s.io:Ingress",
"cluster_resource_whitelist": "",
"upsert": false
}
}
}
{
"jsonrpc": "2.0",
"id": 20,
"method": "tools/call",
"params": {
"name": "list_cluster",
"arguments": {}
}
}
{
"jsonrpc": "2.0",
"id": 21,
"method": "tools/call",
"params": {
"name": "get_cluster",
"arguments": {
"id_or_name": "https://kubernetes.default.svc"
}
}
}
{
"jsonrpc": "2.0",
"id": 22,
"method": "tools/call",
"params": {
"name": "list_repository",
"arguments": {}
}
}
{
"jsonrpc": "2.0",
"id": 23,
"method": "tools/call",
"params": {
"name": "get_repository",
"arguments": {
"repo_url": "https://github.com/myorg/myrepo.git"
}
}
}
internal/argocd/client/
- ArgoCD gRPC client implementationinternal/argocd/
- ArgoCD data models and typesinternal/api/
- Legacy REST API client (deprecated)internal/server/
- MCP server core logicinternal/tools/
- MCP tool definitions and handlersinternal/logging/
- Structured logging configurationinternal/errors/
- Custom error types and handlinginternal/grpcwebproxy/
- gRPC-Web proxy for environments without direct gRPC accesscmd/argocd-mcp-server/
- Main entry point
This server communicates directly with the ArgoCD gRPC API. This provides:
- High performance binary protocol
- Full feature parity with ArgoCD CLI
- Structured error handling with gRPC status codes
- Type-safe request/response handling via protocol buffers
- Support for streaming operations
- No dependency on ArgoCD CLI installation
For environments without direct gRPC access, the server supports gRPC-Web proxy mode:
- Automatically enabled when
ARGOCD_GRPC_WEB=true
- Creates a local Unix socket proxy server
- Translates gRPC calls to HTTP/gRPC-Web requests
- Handles proper framing and streaming responses
- Supports custom root paths via
ARGOCD_GRPC_WEB_ROOT_PATH
The server uses JWT token authentication with the ArgoCD gRPC API:
- Token is passed via
ARGOCD_AUTH_TOKEN
environment variable - Server address with port is configured via
ARGOCD_SERVER
environment variable - JWT token is sent as gRPC metadata with each request
- Supports both TLS and plaintext connections
Structured logging is implemented using logrus:
- Log level configurable via
LOG_LEVEL
environment variable (debug, info, warn, error) - Log format configurable via
LOG_FORMAT
environment variable (text or json) - Logs are written to stderr to avoid interfering with MCP protocol on stdout
# Run all tests
make test
# Run tests with coverage
make test-cover
# Run tests with race detector
make test-race
# Run E2E tests with Kind cluster
make e2e-setup # Setup Kind cluster with ArgoCD
make e2e-test # Run E2E tests
make e2e-teardown # Cleanup
# Format code
make fmt
# Run all linters
make lint
# Run advanced linting (includes security checks)
make lint-advanced
- sync_application: Use
dry_run: true
to preview changes before actual sync - refresh_application: Use
hard_refresh: false
for incremental refresh,true
for full refresh - delete_application: Use
cascade: false
to preserve cluster resources when deleting only the ArgoCD application - delete_applicationset: Use
cascade: false
to preserve generated applications - create_project: Use
upsert: true
to update existing projects instead of failing on conflict - Always verify application and project names before performing destructive operations
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run
make check-all
to ensure quality - Submit a pull request
MIT License - see LICENSE file for details