Skip to main content

Harness MCP Server

Last updated on

The Harness MCP Server is an open-source Model Context Protocol server that gives AI agents full access to the Harness platform. It uses a registry-based dispatch system that routes 10 consolidated tools (harness_list, harness_get, harness_create, etc.) to 137 resource types across 29 toolsets — covering CI/CD, GitOps, Feature Flags, Cloud Cost Management, Security Testing, Chaos Engineering, Internal Developer Portal, Software Supply Chain, and more.

Unlike MCP servers that map one tool per API endpoint (which degrades LLM tool-selection accuracy as tool count grows), this server keeps the tool count small and the schema footprint minimal. Agents discover organizations and projects dynamically, so multi-project workflows work out of the box without hardcoded environment variables. Twenty-six pre-built prompt templates cover common workflows like debugging failed pipelines, reviewing DORA metrics, triaging vulnerabilities, and optimizing cloud costs.

Prerequisites

  • Harness API key: A personal access token (PAT) in the format pat.<accountId>.<tokenId>.<secret>. The account ID is auto-extracted from PAT tokens.
    To create one, go to My Profile > API Keys > + New API Key > create a Token. For detailed instructions, see Manage API Keys.
  • Node.js: Required when using npx or npm install. Not needed for Docker.

Quick start

No install required — run directly with npx:

HARNESS_API_KEY=pat.xxx.xxx.xxx npx harness-mcp-v2@latest

The server defaults to stdio transport (for Claude Desktop, Cursor, Windsurf, etc.). Use http for remote or shared deployments:

# Stdio transport (default)
HARNESS_API_KEY=pat.xxx npx harness-mcp-v2

# HTTP transport
HARNESS_API_KEY=pat.xxx npx harness-mcp-v2 http --port 8080

Alternative installation methods

Global install

npm install -g harness-mcp-v2
harness-mcp-v2

Build from source

git clone https://github.com/harness/mcp-server.git
cd mcp-server
pnpm install
pnpm build

pnpm start # Stdio transport
pnpm start:http # HTTP transport
pnpm inspect # Test with MCP Inspector

CLI usage

harness-mcp-v2 [stdio|http] [--port <number>]
OptionDescription
--port <number>Port for HTTP transport (default: 3000, or PORT env var)
--helpShow help message and exit
--versionPrint version and exit

Configure your AI client

info

HARNESS_DEFAULT_ORG_ID and HARNESS_DEFAULT_PROJECT_ID are optional. Agents can discover orgs and projects dynamically using harness_list(resource_type="organization") and harness_list(resource_type="project"). Set them only if you want to pin a default scope.

Troubleshooting npx ENOENT or node: No such file or directory

GUI apps (Cursor, Claude Desktop, Windsurf, VS Code) don't inherit your shell's PATH, so they often can't find npx or node. Fix this by using absolute paths and explicitly setting PATH in the env block:

{
"mcpServers": {
"harness": {
"command": "/absolute/path/to/npx",
"args": ["-y", "harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx",
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
}
}
}
}

Find your paths with which npx and which node in a terminal. Common locations:

  • Homebrew (macOS): /opt/homebrew/bin/npx
  • nvm: ~/.nvm/versions/node/v20.x.x/bin/npx (run nvm which current for the exact path)
  • System Node: /usr/local/bin/npx

Claude Desktop

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}

Claude Code

claude mcp add harness -- npx harness-mcp-v2

Then set HARNESS_API_KEY in your environment or .env file.

Cursor

Add to .cursor/mcp.json:

{
"mcpServers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}

VS Code

Add to your VS Code settings or .vscode/mcp.json:

{
"mcp": {
"servers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}
}

Windsurf

Add to ~/.windsurf/mcp.json:

{
"mcpServers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}

Gemini CLI

Add to ~/.gemini/settings.json:

{
"mcpServers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}

Or install using Gemini CLI Extensions:

gemini extensions install https://github.com/harness/mcp-server
export HARNESS_API_KEY="pat.xxx.xxx.xxx"
gemini

Amazon Q Developer CLI

Add to ~/.aws/amazonq/mcp.json:

{
"mcpServers": {
"harness": {
"command": "npx",
"args": ["harness-mcp-v2"],
"env": {
"HARNESS_API_KEY": "pat.xxx.xxx.xxx"
}
}
}
}

Run with Docker

docker run --rm -p 3000:3000 \
-e HARNESS_API_KEY=pat.xxx.xxx.xxx \
harness-mcp-server

The container runs in HTTP mode on port 3000 by default with a built-in health check.

Deploy to Kubernetes

# 1. Edit the Secret with your credentials
# k8s/secret.yaml — replace HARNESS_API_KEY and HARNESS_ACCOUNT_ID

# 2. Apply all manifests
kubectl apply -f k8s/

# 3. Verify the deployment
kubectl -n harness-mcp get pods

# 4. Port-forward for local testing
kubectl -n harness-mcp port-forward svc/harness-mcp-server 3000:80
curl http://localhost:3000/health

The deployment runs two replicas with readiness/liveness probes, resource limits, and a non-root security context.

Use MCP gateways

The server is compatible with MCP gateways — reverse proxies that provide centralized authentication, governance, tool routing, and observability. Since the server implements the standard MCP protocol with both stdio and HTTP transports, it works behind any MCP-compliant gateway.

Tested gateways include Docker MCP Gateway, Portkey, LiteLLM, Envoy AI Gateway, Kong, and others. For stdio-based gateways, use the default transport. For HTTP-based gateways, start the server with http transport and point the gateway at the /mcp endpoint.

Environment variables

VariableRequiredDefaultDescription
HARNESS_API_KEYYes--Harness personal access token or service account token
HARNESS_ACCOUNT_IDNo(from PAT)Harness account identifier. Auto-extracted from PAT tokens; only needed for non-PAT API keys
HARNESS_BASE_URLNohttps://app.harness.ioBase URL (override for self-managed Harness)
HARNESS_DEFAULT_ORG_IDNodefaultDefault organization identifier
HARNESS_DEFAULT_PROJECT_IDNo--Default project identifier
HARNESS_API_TIMEOUT_MSNo30000HTTP request timeout in milliseconds
HARNESS_MAX_RETRIESNo3Retry count for transient failures (429, 5xx)
HARNESS_MAX_BODY_SIZE_MBNo10Max HTTP request body size in MB for http transport
HARNESS_RATE_LIMIT_RPSNo10Client-side request throttle (requests per second)
LOG_LEVELNoinfoLog verbosity: debug, info, warn, error
HARNESS_TOOLSETSNo(all)Comma-separated list of enabled toolsets (see Toolset filtering)
HARNESS_READ_ONLYNofalseBlock all mutating operations (create, update, delete, execute)
HARNESS_SKIP_ELICITATIONNofalseSkip confirmation prompts for write operations. Enables fully autonomous agent workflows
HARNESS_ALLOW_HTTPNofalseAllow non-HTTPS HARNESS_BASE_URL. Set to true only for local development

HTTP transport

When running in HTTP mode, the server exposes:

EndpointMethodDescription
/mcpPOSTMCP JSON-RPC endpoint (initialize + session requests)
/mcpGETSSE stream for server-initiated messages (progress, elicitation)
/mcpDELETETerminate an active MCP session
/mcpOPTIONSCORS preflight
/healthGETHealth check — returns { "status": "ok", "sessions": <count> }

The HTTP transport runs in session-based mode. A new MCP session is created on initialize, the server returns an mcp-session-id header, and subsequent requests must include the same header. Idle sessions are reaped after 30 minutes.

Tools reference

The server exposes 11 MCP tools. Most accept org_id and project_id as optional overrides — if omitted, they fall back to HARNESS_DEFAULT_ORG_ID and HARNESS_DEFAULT_PROJECT_ID. Most tools also accept a url parameter — paste a Harness UI URL and the server auto-extracts identifiers.

ToolDescription
harness_describeDiscover available resource types, operations, and fields. No API call — returns local registry metadata
harness_schemaFetch JSON Schema definitions for creating/updating resources. Supports deep drilling via path parameter
harness_listList resources of a given type with filtering, search, and pagination
harness_getGet a single resource by its identifier
harness_createCreate a new resource. Prompts for user confirmation via elicitation
harness_updateUpdate an existing resource. Prompts for user confirmation via elicitation
harness_deleteDelete a resource. Prompts for user confirmation via elicitation
harness_executeExecute an action on a resource (run/retry pipeline, toggle flag, sync app). Prompts for user confirmation via elicitation
harness_searchSearch across multiple resource types in parallel with a single query
harness_diagnoseDiagnose pipeline, connector, delegate, and GitOps application resources with structured failure analysis
harness_statusGet a real-time project health dashboard — recent executions, failure rates, and deep links

Tool examples

Discover available resources:

{ "resource_type": "pipeline" }

List pipelines in a project:

{ "resource_type": "pipeline", "search_term": "deploy", "size": 10 }

Get a specific service:

{ "resource_type": "service", "resource_id": "my-service-id" }

Run a pipeline:

{
"resource_type": "pipeline",
"action": "run",
"resource_id": "my-pipeline",
"inputs": { "tag": "v1.2.3" }
}

Toggle a feature flag:

{
"resource_type": "feature_flag",
"action": "toggle",
"resource_id": "new_checkout_flow",
"enable": true,
"environment": "production"
}

Search across all resource types:

{ "query": "payment-service" }

Diagnose a failed execution:

{ "execution_id": "abc123XYZ" }

Diagnose from a Harness URL:

{ "url": "https://app.harness.io/ng/account/.../pipelines/myPipeline/executions/abc123XYZ/pipeline" }

Get project health status:

{ "org_id": "default", "project_id": "my-project", "limit": 5 }

Pipeline run workflow

Use this sequence to reduce execution-time input errors:

  1. Discover required runtime inputs:
    harness_get(resource_type="runtime_input_template", resource_id="<pipeline_id>")
    The returned template shows <+input> placeholders that need values.

  2. Choose input strategy:

    • Simple variables: Pass flat key-value inputs (for example {"branch":"main","env":"prod"}).

    • Complex inputs: Use input_set_ids for CI codebase/build blocks and nested template inputs.

    • CI codebase shorthand keys:

      Shorthand keyExpanded structure
      branchbuild.type=branch, build.spec.branch=<value>
      tagbuild.type=tag, build.spec.tag=<value>
      pr_numberbuild.type=PR, build.spec.number=<value>
      commit_shabuild.type=commitSha, build.spec.commitSha=<value>
  3. Execute the run:
    harness_execute(resource_type="pipeline", action="run", resource_id="<pipeline_id>", ...)

If required fields are unresolved, the tool returns a pre-flight error with expected keys and suggested input sets.

Pipeline storage modes

ModeDescriptionWhen to use
InlinePipeline YAML stored in HarnessDefault. Simplest setup, no Git required
Remote (External Git)Pipeline YAML in GitHub, GitLab, Bitbucket, etc.Teams using Git-backed pipeline-as-code with an external provider
Remote (Harness Code)Pipeline YAML in a Harness Code repositoryTeams using Harness's built-in Git hosting

For remote pipelines, pass store_type, connector_ref (or is_harness_code_repo), repo_name, branch, file_path, and commit_msg in the params object when calling harness_create or harness_update.

Resource types

137 resource types organized across 29 toolsets. Each resource type supports a subset of CRUD operations and optional execute actions.

Platform

Resource TypeListGetCreateUpdateDeleteExecute Actions
organizationxxxxx
projectxxxxx

Pipelines

Resource TypeListGetCreateUpdateDeleteExecute Actions
pipelinexxxxxrun, retry
executionxxinterrupt
triggerxxxxx
pipeline_summaryx
input_setxx
runtime_input_templatex
approval_instancexapprove, reject

Services

Resource TypeListGetCreateUpdateDeleteExecute Actions
servicexxxxx

Environments

Resource TypeListGetCreateUpdateDeleteExecute Actions
environmentxxxxxmove_configs

Connectors

Resource TypeListGetCreateUpdateDeleteExecute Actions
connectorxxxxxtest_connection
connector_cataloguex

Infrastructure

Resource TypeListGetCreateUpdateDeleteExecute Actions
infrastructurexxxxxmove_configs

Secrets

Resource TypeListGetCreateUpdateDeleteExecute Actions
secretxx

Execution logs

Resource TypeListGetCreateUpdateDeleteExecute Actions
execution_logx

Audit trail

Resource TypeListGetCreateUpdateDeleteExecute Actions
audit_eventxx

Delegates

Resource TypeListGetCreateUpdateDeleteExecute Actions
delegatex
delegate_tokenxxxxrevoke, get_delegates

Code repositories

Resource TypeListGetCreateUpdateDeleteExecute Actions
repositoryxxxx
branchxxxx
commitxxdiff, diff_stats
file_contentxblame
tagxxx
repo_rulexx
space_rulexx

Artifact registries

Resource TypeListGetCreateUpdateDeleteExecute Actions
registryxx
artifactx
artifact_versionx
artifact_filex

Templates

Resource TypeListGetCreateUpdateDeleteExecute Actions
templatexxxxx

Dashboards

Resource TypeListGetCreateUpdateDeleteExecute Actions
dashboardxx
dashboard_datax

Internal Developer Portal (IDP)

Resource TypeListGetCreateUpdateDeleteExecute Actions
idp_entityxx
scorecardxx
scorecard_checkxx
scorecard_statsx
scorecard_check_statsx
idp_scorexx
idp_workflowxexecute
idp_tech_docx

Pull requests

Resource TypeListGetCreateUpdateDeleteExecute Actions
pull_requestxxxxmerge
pr_reviewerxxsubmit_review
pr_commentxx
pr_checkx
pr_activityx

Feature flags

Resource TypeListGetCreateUpdateDeleteExecute Actions
fme_workspacex
fme_environmentx
fme_feature_flagxxxxxkill, restore, archive, unarchive
fme_feature_flag_definitionx
fme_rollout_statusx
fme_rule_based_segmentxxxx
fme_rule_based_segment_definitionxxenable, disable, change_request
feature_flagxxxxtoggle

GitOps

Resource TypeListGetCreateUpdateDeleteExecute Actions
gitops_agentxx
gitops_applicationxxsync
gitops_clusterxx
gitops_repositoryxx
gitops_applicationsetxx
gitops_repo_credentialxx
gitops_app_eventx
gitops_pod_logx
gitops_managed_resourcex
gitops_resource_actionx
gitops_dashboardx
gitops_app_resource_treex

Chaos Engineering

Resource TypeListGetCreateUpdateDeleteExecute Actions
chaos_experimentxxrun
chaos_probexxenable, verify
chaos_experiment_templatexcreate_from_template
chaos_infrastructurex
chaos_experiment_variablex
chaos_experiment_runxx
chaos_loadtestxxxxrun, stop
chaos_k8s_infrastructurexxcheck_health
chaos_hubxx
chaos_faultxx
chaos_network_mapxx
chaos_guard_conditionxx
chaos_guard_rulexx
chaos_recommendationxx
chaos_riskxx

Cloud Cost Management (CCM)

Resource TypeListGetCreateUpdateDeleteExecute Actions
cost_perspectivexxxxx
cost_breakdownx
cost_timeseriesx
cost_summaryxx
cost_recommendationxxupdate_state, override_savings, create_jira_ticket, create_snow_ticket
cost_anomalyx
cost_anomaly_summaryx
cost_categoryxx
cost_account_overviewx
cost_filter_valuex
cost_recommendation_statsx
cost_recommendation_detailx
cost_commitmentx

Software Engineering Insights (SEI)

Resource TypeListGetCreateUpdateDeleteExecute Actions
sei_metricx
sei_productivity_metricx
sei_dora_metricxPass metric: deployment_frequency, change_failure_rate, mttr, lead_time
sei_teamxx
sei_team_detailxPass aspect: integrations, developers, integration_filters
sei_org_treexx
sei_org_tree_detailxxPass aspect: efficiency_profile, productivity_profile, business_alignment_profile, integrations, teams
sei_business_alignmentxx
sei_ai_usagexxPass aspect: metrics, breakdown, summary, top_languages
sei_ai_adoptionxxPass aspect: metrics, breakdown, summary
sei_ai_impactxPass aspect: pr_velocity, rework
sei_ai_raw_metricx

Software Supply Chain Assurance (SCS)

Resource TypeListGetCreateUpdateDeleteExecute Actions
scs_artifact_sourcex
artifact_securityxx
scs_artifact_componentx
scs_artifact_remediationx
scs_chain_of_custodyx
scs_compliance_resultx
code_repo_securityxx
scs_sbomx

Security Testing Orchestration (STO)

Resource TypeListGetCreateUpdateDeleteExecute Actions
security_issuex
security_issue_filterx
security_exemptionxapprove, reject, promote

Access control

Resource TypeListGetCreateUpdateDeleteExecute Actions
userxx
user_groupxxxx
service_accountxxxx
rolexxxx
role_assignmentxx
resource_groupxxxx
permissionx

Governance

Resource TypeListGetCreateUpdateDeleteExecute Actions
policyxxxxx
policy_setxxxxx
policy_evaluationxx

Deployment freeze

Resource TypeListGetCreateUpdateDeleteExecute Actions
freeze_windowxxxxxtoggle_status
global_freezexmanage

Service overrides

Resource TypeListGetCreateUpdateDeleteExecute Actions
service_overridexxxxx

Settings

Resource TypeListGetCreateUpdateDeleteExecute Actions
settingx

Visualizations

Inline PNG chart visualizations rendered from Harness data. Use include_visual=true on supported tools to generate charts.

Resource TypeDescriptionHow to generate
visual_timelineGantt chart of pipeline stage executionharness_diagnose with visual_type: "timeline"
visual_stage_flowDAG flowchart of pipeline stages and stepsharness_diagnose with visual_type: "flow"
visual_health_dashboardProject health overview with status indicatorsharness_status with include_visual: true
visual_pie_chartDonut chart of execution status breakdownharness_list with visual_type: "pie"
visual_bar_chartBar chart of execution counts by pipelineharness_list with visual_type: "bar"
visual_timeseriesDaily execution trend over 30 daysharness_list with visual_type: "timeseries"
visual_architecturePipeline YAML architecture diagramharness_diagnose with visual_type: "architecture"

Toolset filtering

By default, all 29 toolsets (and their 137 resource types) are enabled. Use HARNESS_TOOLSETS to expose only the toolsets you need, which reduces the resource types the LLM sees and improves tool-selection accuracy.

# Only expose pipelines, services, and connectors
HARNESS_TOOLSETS=pipelines,services,connectors
ToolsetResource Types
platformorganization, project
pipelinespipeline, execution, trigger, pipeline_summary, input_set, approval_instance
servicesservice
environmentsenvironment
connectorsconnector, connector_catalogue
infrastructureinfrastructure
secretssecret
logsexecution_log
auditaudit_event
delegatesdelegate, delegate_token
repositoriesrepository, branch, commit, file_content, tag, repo_rule, space_rule
registriesregistry, artifact, artifact_version, artifact_file
templatestemplate
dashboardsdashboard, dashboard_data
idpidp_entity, scorecard, scorecard_check, scorecard_stats, scorecard_check_stats, idp_score, idp_workflow, idp_tech_doc
pull-requestspull_request, pr_reviewer, pr_comment, pr_check, pr_activity
feature-flagsfme_workspace, fme_environment, fme_feature_flag, fme_feature_flag_definition, fme_rollout_status, fme_rule_based_segment, fme_rule_based_segment_definition, feature_flag
gitopsgitops_agent, gitops_application, gitops_cluster, gitops_repository, gitops_applicationset, gitops_repo_credential, gitops_app_event, gitops_pod_log, gitops_managed_resource, gitops_resource_action, gitops_dashboard, gitops_app_resource_tree
chaoschaos_experiment, chaos_probe, chaos_experiment_template, chaos_infrastructure, chaos_experiment_variable, chaos_experiment_run, chaos_loadtest, chaos_k8s_infrastructure, chaos_hub, chaos_fault, chaos_network_map, chaos_guard_condition, chaos_guard_rule, chaos_recommendation, chaos_risk
ccmcost_perspective, cost_breakdown, cost_timeseries, cost_summary, cost_recommendation, cost_anomaly, cost_anomaly_summary, cost_category, cost_account_overview, cost_filter_value, cost_recommendation_stats, cost_recommendation_detail, cost_commitment
seisei_metric, sei_productivity_metric, sei_dora_metric, sei_team, sei_team_detail, sei_org_tree, sei_org_tree_detail, sei_business_alignment, sei_ai_usage, sei_ai_adoption, sei_ai_impact, sei_ai_raw_metric
scsscs_artifact_source, artifact_security, scs_artifact_component, scs_artifact_remediation, scs_chain_of_custody, scs_compliance_result, code_repo_security, scs_sbom
stosecurity_issue, security_issue_filter, security_exemption
access_controluser, user_group, service_account, role, role_assignment, resource_group, permission
governancepolicy, policy_set, policy_evaluation
freezefreeze_window, global_freeze
overridesservice_override
settingssetting
visualizationsvisual_timeline, visual_stage_flow, visual_health_dashboard, visual_pie_chart, visual_bar_chart, visual_timeseries, visual_architecture

Prompt templates

The server includes 26 pre-built prompt templates for common workflows.

DevOps

PromptDescription
build-deploy-appEnd-to-end CI/CD: scan a repo, generate CI pipeline, create CD pipeline, deploy with auto-retry
debug-pipeline-failureAnalyze a failed execution with stage/step breakdown, failure details, and root cause analysis
create-pipelineGenerate a new pipeline YAML from natural language requirements
onboard-serviceWalk through onboarding a new service with environments and a deployment pipeline
dora-metrics-reviewReview DORA metrics with Elite/High/Medium/Low classification and improvement recommendations
setup-gitops-applicationGuide through onboarding a GitOps application
chaos-resilience-testDesign a chaos experiment to test service resilience
feature-flag-rolloutPlan and execute a progressive feature flag rollout with safety gates
migrate-pipeline-to-templateAnalyze a pipeline and extract reusable stage/step templates
delegate-health-checkCheck delegate connectivity, health, and token status
developer-portal-scorecardReview IDP scorecards and identify gaps
pending-approvalsFind executions waiting for approval and offer to approve or reject

FinOps

PromptDescription
optimize-costsAnalyze cloud cost data, surface recommendations and anomalies
cloud-cost-breakdownDeep-dive into cloud costs by service, environment, or cluster
commitment-utilization-reviewAnalyze reserved instance and savings plan utilization
cost-anomaly-investigationInvestigate cost anomalies and determine root cause
rightsizing-recommendationsReview and prioritize rightsizing recommendations

DevSecOps

PromptDescription
security-reviewReview security issues and suggest remediations by severity
vulnerability-triageTriage vulnerabilities across pipelines and artifacts
sbom-compliance-checkAudit SBOM and compliance posture for artifacts
supply-chain-auditEnd-to-end software supply chain security audit
security-exemption-reviewReview pending security exemptions for batch decisions
access-control-auditAudit user permissions and enforce least-privilege

Harness Code

PromptDescription
code-reviewReview a pull request with structured feedback on bugs, security, performance, and style
pr-summaryAuto-generate a PR title and description from commit history and diff
branch-cleanupAnalyze branches and recommend stale or merged branches to delete

MCP resources

Resource URIDescriptionMIME Type
pipeline:///{pipelineId}Pipeline YAML definitionapplication/x-yaml
pipeline:///{orgId}/{projectId}/{pipelineId}Pipeline YAML (with explicit scope)application/x-yaml
executions:///recentLast 10 pipeline execution summariesapplication/json
schema:///pipelineHarness pipeline JSON Schemaapplication/schema+json
schema:///templateHarness template JSON Schemaapplication/schema+json
schema:///triggerHarness trigger JSON Schemaapplication/schema+json

Elicitation

Write tools (harness_create, harness_update, harness_delete, harness_execute) use MCP elicitation to prompt the user for confirmation before making changes.

  1. The LLM calls a write tool (for example, harness_create with a pipeline body).
  2. The server sends an elicitation request to the client with a summary of the operation.
  3. The user sees the details and clicks Accept or Decline.
  4. If accepted, the operation proceeds. If declined, it is blocked.
ClientElicitation Support
CursorYes
VS Code (Copilot)Yes
Claude DesktopNot yet
WindsurfNot yet
MCP InspectorYes

For clients that don't support elicitation, harness_create, harness_update, and harness_execute proceed without a dialog, while harness_delete is blocked to prevent unintended destruction.

Skip elicitation for autonomous workflows

For fully autonomous agent workflows (CI/CD bots, headless agents, batch automation), disable elicitation prompts:

HARNESS_SKIP_ELICITATION=true

When enabled, all write and delete operations proceed without user confirmation. Consider pairing with HARNESS_TOOLSETS to restrict which resource types are available.

Safety

  • Secrets are never exposed. The secret resource type returns metadata only — secret values are never included in any response.
  • Write operations use elicitation when available. harness_create, harness_update, harness_delete, and harness_execute prompt for user confirmation.
  • Destructive writes fail closed. If confirmation cannot be obtained, harness_delete is blocked.
  • CORS restricted to same-origin. The HTTP transport prevents CSRF attacks from malicious websites.
  • Rate limiting. HTTP transport enforces 60 requests per minute per IP. The API client enforces 10 requests/second to avoid upstream rate limits.
  • Pagination bounds enforced. List queries are capped at 10,000 items total and 100 per page.
  • Retries with backoff. Transient failures (HTTP 429, 5xx) are retried with exponential backoff and jitter.
  • Localhost binding. The HTTP transport binds to 127.0.0.1 by default.
  • HTTPS enforced. HARNESS_BASE_URL must use HTTPS. Set HARNESS_ALLOW_HTTP=true only for local development.

Architecture

             +------------------+
| AI Agent |
| (Claude, etc.) |
+--------+---------+
| MCP (stdio or HTTP)
+--------v---------+
| MCP Server |
| 10 Generic Tools |
+--------+---------+
|
+--------v---------+
| Registry | <-- Declarative resource definitions
| 29 Toolsets |
| 137 Resource Types|
+--------+---------+
|
+--------v---------+
| HarnessClient | <-- Auth, retry, rate limiting
+--------+---------+
| HTTPS
+--------v---------+
| Harness REST API |
+-------------------+
  1. Tools are generic verbs (harness_list, harness_get, etc.) that accept a resource_type parameter to route to the correct API endpoint.
  2. The Registry maps each resource_type to a declarative ResourceDefinition specifying the HTTP method, URL path, parameter mappings, and response extraction.
  3. Dispatch resolves the resource definition, builds the HTTP request, calls the Harness API, and extracts the relevant response data.
  4. Toolset filtering controls which resource definitions load at startup.
  5. Deep links are automatically appended to responses, providing direct Harness UI URLs.
  6. Compact mode strips verbose metadata from list results to minimize token usage.

Debug with MCP Inspector

Use the MCP Inspector to debug the server interactively:

npx @modelcontextprotocol/inspector npx harness-mcp-v2

The Inspector displays a URL you can open in your browser to inspect tool calls and responses.

Troubleshooting

HARNESS_ACCOUNT_ID is required when the API key is not a PAT
  • Your API key is not in PAT format (pat.<accountId>.<tokenId>.<secret>), so the account ID cannot be auto-extracted. Set the HARNESS_ACCOUNT_ID environment variable explicitly.
npx ENOENT or node: No such file or directory when using GUI clients
  • GUI apps (Cursor, Claude Desktop, Windsurf, VS Code) don't inherit your shell's PATH. Use absolute paths for the command and explicitly set PATH in the env block of your MCP config. Run 'which npx' and 'which node' in a terminal to find the correct paths.
Unknown resource_type error from tools
  • The resource type is misspelled or filtered out via HARNESS_TOOLSETS. Call harness_describe (with optional search_term) to discover valid resource types.
Missing required field for path parameter
  • A project or org scoped call is missing identifiers. Set HARNESS_DEFAULT_ORG_ID and HARNESS_DEFAULT_PROJECT_ID environment variables, or pass org_id and project_id per tool call.
Read-only mode is enabled — write operations are not allowed
  • HARNESS_READ_ONLY=true blocks create, update, delete, and execute operations. Set HARNESS_READ_ONLY=false if write operations are intended.
Pipeline run fails with unresolved required inputs
  • Your inputs did not cover all required runtime placeholders. Fetch the runtime_input_template first, then supply missing keys via inputs or use input_set_ids for structural inputs.
HARNESS_BASE_URL must use HTTPS
  • The server enforces HTTPS by default. If you need HTTP for local development, set HARNESS_ALLOW_HTTP=true.
Operation declined by user
  • The user declined the elicitation confirmation dialog. Verify the operation details and retry if intended.
HTTP mcp-session-id header is required or Session not found
  • Send an initialize request first to create a session, then include the mcp-session-id header on all subsequent POST, GET, and DELETE requests to /mcp. Sessions expire after 30 minutes of idle time.

Next steps

The Harness MCP Server pairs well with Harness Skills — a collection of ready-made Claude Code slash commands for common Harness workflows like /deploy, /rollback, and /triage.