Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harness MCP Server

An MCP (Model Context Protocol) server for the Harness Software Delivery Platform API. Enables AI assistants like Claude to interact with your Harness account — managing pipelines, executions, secrets, feature flags, cloud costs, and more.

Installation

git clone <this-repo>
cd harness-mcp
npm install
npm run build

Configuration

Copy .env.example to .env and fill in your credentials:

cp .env.example .env
Variable Required Description
HARNESS_API_KEY Yes API key from Harness Account Settings → API Keys
HARNESS_ACCOUNT_ID Yes Account ID from Harness Account Settings → Overview
HARNESS_BASE_URL No Defaults to https://app.harness.io

Claude Desktop Configuration

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "harness": {
      "command": "node",
      "args": ["D:/15_MCPs/harness-mcp/dist/index.js"],
      "env": {
        "HARNESS_API_KEY": "your-api-key-here",
        "HARNESS_ACCOUNT_ID": "your-account-id-here",
        "HARNESS_BASE_URL": "https://app.harness.io"
      }
    }
  }
}

Claude Code Configuration

Add to your Claude Code settings (.claude/settings.json):

{
  "mcpServers": {
    "harness": {
      "command": "node",
      "args": ["D:/15_MCPs/harness-mcp/dist/index.js"],
      "env": {
        "HARNESS_API_KEY": "your-api-key-here",
        "HARNESS_ACCOUNT_ID": "your-account-id-here"
      }
    }
  }
}

Scope Hierarchy

Harness uses a three-level scope hierarchy: Account → Organization → Project.

  • Account-level operations (e.g., listing orgs) require only HARNESS_ACCOUNT_ID
  • Org-level operations require org parameter
  • Project-level operations require both org and project parameters

Most pipeline, service, and environment operations are project-scoped. Secrets and connectors can exist at any scope level.

Tool Reference

Tier 1 — Core

Tool Description Scope
harness_list_orgs List organizations in the account Account
harness_list_projects List projects within an organization Org
harness_list_pipelines List pipelines in a project Project
harness_get_pipeline Get pipeline YAML and details Project
harness_execute_pipeline Trigger a pipeline execution Project
harness_get_execution_status Poll execution status by ID Project
harness_list_executions List execution history with status filter Project
harness_create_secret Create a text secret Any
harness_get_secret Get secret metadata (not the value) Any
harness_list_secrets List secrets at a scope Any
harness_list_services List services in a project Project
harness_list_environments List environments in a project Project

Tier 2 — Operational

Tool Description Scope
harness_list_connectors List connectors (cloud, repo, registry) Any
harness_test_connector Test connector connectivity Any
harness_create_pipeline Create pipeline from YAML Project
harness_update_pipeline Update pipeline YAML Project
harness_delete_pipeline Delete a pipeline (irreversible) Project
harness_list_templates List reusable templates Any
harness_list_feature_flags List feature flags Project
harness_toggle_feature_flag Toggle flag on/off in an environment Project
harness_list_triggers List pipeline triggers Project
harness_create_trigger Create a trigger from YAML Project

Tier 3 — FinOps + Security

Tool Description Scope
harness_list_cost_anomalies List CCM cost anomalies Account
harness_get_budget_status Get budget utilization and forecast Account
harness_list_recommendations List cost optimization recommendations Account
harness_list_security_issues List STO security vulnerabilities Project
harness_list_security_scans List STO scan results Project

Example Usage

List pipelines

"List all pipelines in org 'default' project 'my-app'"

Calls harness_list_pipelines with org: "default", project: "my-app".

Expected response shape:

## Pipelines in default/my-app (5 total, Page 1)

- **Build and Deploy** (`build_and_deploy`)
  Status: Success | Last run: 2026-04-12T15:30:00.000Z
  Stages: Build, Deploy_Dev, Deploy_Prod

Execute a pipeline

"Execute the 'build_and_deploy' pipeline in default/my-app"

Calls harness_execute_pipeline with org: "default", project: "my-app", pipeline: "build_and_deploy".

Expected response shape:

## Pipeline Execution Started
Pipeline: build_and_deploy
Execution ID: `abc123-def456-...`
Status: Queued

Use `harness_get_execution_status` with this execution ID to poll for completion.

Security

  • API keys are loaded from environment variables only — never hardcoded or logged
  • Secret values are never returned in tool output (Harness API enforces this)
  • All string parameters are sanitized before URL interpolation
  • Retry logic handles 429 (rate limit) and 5xx errors with exponential backoff

API Coverage

This server uses both Harness API generations:

  • /v1/ — Newer Beta API (used for orgs, projects)
  • /ng/api/ — Next-gen API with broader coverage (used for most operations)
  • /pipeline/api/ — Pipeline-specific endpoints
  • /cf/admin/ — Feature Flags API
  • /ccm/api/ — Cloud Cost Management API
  • /sto/api/ — Security Testing Orchestration API

Documentation

Full best practices documentation is available in the docs/ directory:

About

MCP server for the Harness Software Delivery Platform API — manage pipelines, executions, secrets, feature flags, cloud costs, and security from Claude

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages