Labsco
akuity logo

Argo CD

β˜… 524

from akuity

Interact with Argo CD applications through natural language.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup

Argo CD MCP Server

An implementation of Model Context Protocol (MCP) server for Argo CD, enabling AI assistants to interact with your Argo CD applications through natural language. This server allows for seamless integration with Visual Studio Code and other MCP clients through stdio and HTTP stream transport protocols.

<a href="https://glama.ai/mcp/servers/@akuity/argocd-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@akuity/argocd-mcp/badge" alt="argocd-mcp MCP server" /> </a> <!-- // Generate using?: const config = JSON.stringify({ "name": "argocd-mcp", "command": "npx", "args": ["argocd-mcp@latest", "stdio"], "env": { "ARGOCD_BASE_URL": "<argocd_url>", "ARGOCD_API_TOKEN": "<argocd_token>" } }); const urlForWebsites = `vscode:mcp/install?${encodeURIComponent(config)}`; // Github markdown does not allow linking to `vscode:` directly, so you can use our redirect: const urlForGithub = `https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForWebsites)}`; -->

<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code"> <img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">


argocd-mcp-demo

Features

  • Transport Protocols: Supports both stdio and HTTP stream transport modes for flexible integration with different clients
  • Complete Argo CD API Integration: Provides comprehensive access to Argo CD resources and operations
  • AI Assistant Ready: Pre-configured tools for AI assistants to interact with Argo CD in natural language

Available Tools

The server provides the following ArgoCD management tools:

Cluster Management

  • list_clusters: List all clusters registered with ArgoCD

Application Management

  • list_applications: List and filter all applications
  • get_application: Get detailed information about a specific application
  • create_application: Create a new application
  • update_application: Update an existing application
  • delete_application: Delete an application
  • sync_application: Trigger a sync operation on an application

Resource Management

  • get_application_resource_tree: Get the resource tree for a specific application
  • get_application_managed_resources: Get managed resources for a specific application
  • get_application_workload_logs: Get logs for application workloads (Pods, Deployments, etc.)
  • get_resource_events: Get events for resources managed by an application
  • get_resource_actions: Get available actions for resources
  • run_resource_action: Run an action on a resource

For Development

  1. Clone the repository:
git clone https://github.com/argoproj-labs/mcp-for-argocd.git
cd mcp-for-argocd
  1. Install project dependencies:
pnpm install
  1. Start the development server with hot reloading enabled:
pnpm run dev

Once the server is running, you can utilize the MCP server within Visual Studio Code or other MCP client.

Running locally

The Makefile provides targets for running the server over the HTTP transport:

make run    # build, then run the HTTP server (production-style)
make dev    # run from source with hot reloading (tsx watch)

By default neither target sets any credentials β€” the server starts with no default base URL or token, so callers must supply them per request (x-argocd-base-url / x-argocd-api-token headers, or the argocdBaseUrl tool argument once a registry is configured). Override the port the same way:

make run PORT=4000

To configure credentials, export the relevant environment variable on the command line. There are three (all optional):

VariablePurpose
ARGOCD_BASE_URLDefault ArgoCD instance URL used when a call doesn't override it.
ARGOCD_API_TOKENStatic API token for the default base URL.
ARGOCD_TOKEN_REGISTRY_PATHPath to a JSON token registry mapping base URLs to tokens (for targeting multiple instances).
# Single instance with a static base URL + token:
make run ARGOCD_BASE_URL=https://argo.example.com ARGOCD_API_TOKEN=<token>

# Multiple instances via a token registry:
make run ARGOCD_TOKEN_REGISTRY_PATH=/path/to/tokens.json

# Both β€” a default instance plus extra instances resolved from the registry:
make dev ARGOCD_BASE_URL=https://argo.example.com ARGOCD_API_TOKEN=<token> \
  ARGOCD_TOKEN_REGISTRY_PATH=/path/to/tokens.json

See Token resolution for how the default token and registry interact. If ARGOCD_TOKEN_REGISTRY_PATH is set but the file is missing, unreadable, or malformed, the server fails closed at startup.

Keep tokens out of your shell history. Passing ARGOCD_API_TOKEN=<token> directly on the make command line records the secret in your shell history and exposes it in the process list. Prefer exporting it in the shell first so it never appears in the make invocation:

export ARGOCD_API_TOKEN=<token>
make run ARGOCD_BASE_URL=https://argo.example.com

A registry path (ARGOCD_TOKEN_REGISTRY_PATH) and base URL are not secrets, so they're fine to pass inline.

Do not place the registry file under dist/ β€” tsup builds with clean: true and wipes that directory on every build.

The HTTP server listens on POST /mcp (port 3000 by default) with a GET /healthz liveness endpoint. To send a request, first initialize a session (capture the mcp-session-id response header), then call a tool, passing one of the registered base URLs as the argocdBaseUrl argument:

# 1. Initialize a session β€” note the mcp-session-id response header
curl -sD - http://localhost:3000/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'

# 2. Call a tool, reusing that session id
curl -s http://localhost:3000/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'mcp-session-id: <session-id-from-step-1>' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_applications","arguments":{"argocdBaseUrl":"https://argo-a.example.com"}}}'

To avoid managing a session id, run in stateless mode (node dist/index.js http --stateless) so every POST /mcp is self-contained.

Upgrading ArgoCD Types

To update the TypeScript type definitions based on the latest Argo CD API specification:

  1. Download the swagger.json file from the ArgoCD release page, for example here is the swagger.json link for ArgoCD v2.14.11.

  2. Place the downloaded swagger.json file in the root directory of the argocd-mcp project.

  3. Generate the TypeScript types from the Swagger definition by running the following command. This will create or overwrite the src/types/argocd.d.ts file:

    pnpm run generate-types
  4. Update the src/types/argocd-types.ts file to export the required types from the newly generated src/types/argocd.d.ts. This step often requires manual review to ensure only necessary types are exposed.

Credits

The project was initially created and donated by @jiachengxu, @imwithye, @hwwn, and @alexmt from Akuity.