Harness
Access and interact with Harness platform data, including pipelines, repositories, logs, and artifact registries.
Harness MCP Server
The Harness MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with Harness APIs, enabling advanced automation and interaction capabilities for developers and tools.
Table of Contents
- Components
- Tools
- Default Toolset
- Pipelines Toolset
- Pull Requests Toolset
- Services Toolset
- Environments Toolset
- Infrastructure Toolset
- Connectors Toolset
- Secrets Toolset
- Delegate Tokens Toolset
- Repositories Toolset
- Registries Toolset
- Dashboards Toolset
- Cloud Cost Management Toolset
- Chaos Engineering Toolset
- Supply Chain Security (SCS) Toolset
- Security Test Orchestration (STO) Toolset
- Logs Toolset
- Templates Toolset
- Internal Developer Portal Toolset
- Audit Trail Toolset
- Feature Management and Experimentation (FME) Toolset
- Sei Toolset
- GitOps Toolset
- Tools
- Prerequisites
- Quickstart
- Makefile Usage
- Build from Source
- Use Docker Image
- Integration with AI Assistants
- Development
- Debugging
Components
Tools
The server implements several toolsets:
Default Toolset
The default toolset contains essential tools from various services:
Toolset Name: default
get_connector_details: Get details of a specific connectorlist_connector_catalogue: List the Harness connector cataloguelist_connectors: List connectors with filtering optionslist_pipelines: List pipelines in a repositoryget_pipeline: Get details of a specific pipelineget_execution: Get details of a specific pipeline executionlist_executions: List pipeline executionsfetch_execution_url: Fetch the execution URL for a pipeline executionlist_dashboards: Lists all available Harness dashboardsget_dashboard_data: Retrieves the data from a specific Harness dashboard
Pipelines Toolset
Toolset Name: pipelines
get_pipeline: Get details of a specific pipelinelist_pipelines: List pipelines in a repositoryget_execution: Get details of a specific pipeline executionlist_executions: List pipeline executionsfetch_execution_url: Fetch the execution URL for a pipeline executionlist_input_sets: List input sets for a pipelineget_input_set: Get details of a specific input set for a pipelineget_pipeline_summary: Provides a concise summary of a pipeline's overall structure and execution info highlighting key aspects rather than detailed pipeline definition such as pipeline yaml, external references, etc.list_triggers: List triggers in a Harness pipeline
Pull Requests Toolset
Toolset Name: pullrequests
get_pull_request: Get details of a specific pull requestlist_pull_requests: List pull requests in a repositoryget_pull_request_checks: Get status checks for a specific pull requestget_pull_request_activities: Get activities and comments for a specific pull requestcreate_pull_request: Create a new pull request
Services Toolset
Toolset Name: services
get_service: Get details of a specific servicelist_services: List services
Environments Toolset
Toolset Name: environments
get_environment: Get details of a specific environmentlist_environments: List environmentsmove_environment_configs: Move environment YAML from inline to remote
Infrastructure Toolset
Toolset Name: infrastructure
list_infrastructures: List infrastructure definitionsmove_infrastructure_configs: Move infrastructure YAML between inline and remote
Connectors Toolset
Toolset Name: connectors
list_connector_catalogue: List the Harness connector catalogueget_connector_details: Get details of a specific connectorlist_connectors: List connectors with filtering options
Secrets Toolset
Toolset Name: secrets
list_secrets: List secrets from Harness with filtering and pagination options.get_secret: Get a secret by identifier from Harness
Delegate Tokens Toolset
Toolset Name: delegatetokens
list_delegate_tokens: List delegate tokens in Harness with filtering and pagination options.get_delegate_token: Get a delegate token by name from Harnesscreate_delegate_token: Creates a new delegate token in Harnessrevoke_delegate_token: Revokes a delegate token in Harnessdelete_delegate_token: Deletes a revoked delegate token from Harnesscore_get_delegate_by_token: Gets all delegates using a given delegate token name
Delegate Toolset
Toolset Name: delegate
core_list_delegates: Lists all delegates in Harness filtered by provided conditions such as status, delegate name, type, and version status.
Repositories Toolset
Toolset Name: repositories
get_repository: Get details of a specific repositorylist_repositories: List repositories
Registries Toolset
Toolset Name: registries
get_registry: Get details of a specific registry in Harness artifact registrylist_artifact_files: List files for a specific artifact version in a Harness artifact registrylist_artifact_versions: List artifact versions in a Harness artifact registrylist_artifacts: List artifacts in a Harness artifact registrylist_registries: List registries in Harness artifact registry
Dashboards Toolset
Toolset Name: dashboards
list_dashboards: Lists all available Harness dashboardsget_dashboard_data: Retrieves the data from a specific Harness dashboard
Cloud Cost Management Toolset
Toolset Name: ccm
get_ccm_overview: Retrieves the cost overview for a specific account.list_ccm_cost_categories: List all cost categories names for a specified account.list_ccm_cost_categories_detail: List all cost categories details for a specified account.get_ccm_cost_category: Retrieve a cost category detail by Id for a specified account.list_ccm_perspectives_detail: List all perspectives for a specified account.get_ccm_perspective: Retrieves a perspective by Id for a specified account.get_last_period_cost_ccm_perspective: Retrieves the cost for a specified period and perspective within a given account.get_last_twelve_months_cost_ccm_perspective: Retrieves a monthly cost breakdown for the past 12 months for a perspective within a specified account.create_ccm_perspective: Creates a perspective for a specified account.update_ccm_perspective: Updates a perspective for a specified account.delete_ccm_perspective: Deletes a perspective for a specified account.ccm_perspective_grid: Query detailed cost perspective data in Harness Cloud Cost Management.ccm_perspective_time_series: Query detailed cost perspective data, grouped by time in Harness Cloud Cost Management.ccm_perspective_summary_with_budget: Query a summary of cost perspectives with budget information in Harness Cloud Cost Management, including detailed cost and budget data grouped by time.ccm_perspective_budget: Query the budget information for a perspective in Harness Cloud Cost Management.get_ccm_metadata: Retrieves metadata about available cloud connectors, cost data sources, default perspectives, and currency preferences in Harness Cloud Cost Management.ccm_perspective_recommendations: Returns monthly cost, savings, and a list of open recommendations for a perspective in Harness Cloud Cost Management.ccm_perspective_filter_values: Returns available filter values for a cost perspective, enabling dynamic discovery of valid options for advanced queries in Harness Cloud Cost Management.list_ccm_recommendations: Returns a filterable list of cost-optimization recommendations in Harness Cloud Cost Management.list_ccm_recommendations_by_resource_type: Returns a aggregated statistics of cloud cost optimization recommendations grouped by resource type within a given account in Harness Cloud Cost Management.get_ccm_recommendations_stats: Returns overall statistics for cloud cost optimization recommendations within a given account in Harness Cloud Cost Management.update_ccm_recommendation_state: Marks a recommendation as Applied/Open/Ignored in Harness Cloud Cost Management.override_ccm_recommendation_savings: Overrides savings for a recommendation in Harness Cloud Cost Management.create_jira_ticket_for_ccm_recommendation: Creates a Jira ticket for a recommendation in Harness Cloud Cost Management.create_service_now_ticket_for_ccm_recommendation: Creates a Service Now ticket for a recommendation in Harness Cloud Cost Management.get_ec2_recommendation_detail: Returns ECS Recommendation details for the given Recommendation identifier.get_azure_vm_recommendation_detail: Returns Azure Vm Recommendation details for the given Recommendation identifier.get_ecs_service_recommendation_detail: Returns ECS Service Recommendation details for the given Recommendation identifier.get_node_pool_recommendation_detail: Returns Node Pool Recommendation details for the given Recommendation identifier.get_workload_recommendation_detail: Returns Workload Recommendation details for the given Recommendation identifier.list_jira_projects: Returns a list of Jira projects available to create tickets for recommendations in Harness Cloud Cost Management.list_jira_issue_types: Returns a list of Jira Issue types available to create tickets for recommendations in Harness Cloud Cost Management.get_ccm_anomalies_summary: Returns a summary of cost anomalies for a specified account in Harness Cloud Cost Management.list_ccm_anomalies: Returns a list of cost anomalies for a specified account in Harness Cloud Cost Management.list_ccm_ignored_anomalies: Returns a list of ignored cost anomalies for a specified account in Harness Cloud Cost Management.get_ccm_anomalies_for_perspective: Returns a anomalies for a perspective and account in Harness Cloud Cost Management.list_all_ccm_anomalies: Returns a list of all cost anomalies for a specified account in Harness Cloud Cost Management.list_filter_values_ccm_anomalies: Returns the list of distinct values for all the specified anomalies for a specified account in Harness Cloud Cost Management.report_ccm_anomaly_feedback: Reports feedback for an anomaly and account in Harness Cloud Cost Management.get_ccm_commitment_coverage: Get commitment coverage information for an account in Harness Cloud Cost Management.get_ccm_commitment_savings: Get commitment savings information for an account in Harness Cloud Cost Management.get_ccm_commitment_utilisation: Get commitment utilisation information for an account in Harness Cloud Cost Management broken down by Reserved Instances and Savings Plans in day wise granularity.get_ccm_estimated_savings: Get estimated savings information for a cloud account in Harness Cloud Cost Managementget_ccm_commitment_ec2_analysis: Get AWS EC2 commitment analysis for an account in Harness Cloud Cost Management, including RI/SP commitment spend, utilization breakdown, current savings, estimated annualized savings, and ESR.
Chaos Engineering Toolset
Toolset Name: chaos
chaos_experiments_list: List all the chaos experiments based on matching scope and filters.chaos_experiment_describe: Get details of a specific chaos experiment.chaos_experiment_run: Run a specific chaos experiment.chaos_experiment_run_result: Get the result of a specific chaos experiment run.chaos_probes_list: List all the chaos probes based on matching scope and filters.chaos_probe_describe: Get details of a specific chaos probe.chaos_create_experiment_from_template: Create a new chaos experiment from a template.chaos_experiment_template_list: List all the chaos experiment templates based on matching scope and filters.chaos_experiment_variables_list: List all the variables for a specific chaos experiment
Supply Chain Security (SCS) Toolset
Toolset Name: scs
scs_list_artifact_sources: List all artifact sources available in Harness SCS for a specific organization and project.scs_list_artifacts_per_source: List all artifacts within a specific artifact source.scs_get_artifact_overview: Get metadata, security findings, SBOM, and compliance status for a specific artifact.scs_get_artifact_component_view: Retrieve a detailed component view of a specific artifact, including dependencies and license information.scs_get_artifact_component_remediation: Get remediation recommendations for a specific component in an artifact.scs_get_artifact_chain_of_custody: Retrieve the full chain of custody (event history) for a specific artifact.scs_fetch_compliance_results_for_repo_by_id: Fetch compliance results for a specific code repository or CI/CD build system.scs_get_code_repository_overview: Get an overview of vulnerabilities, SBOM, compliance issues, and policy violations for a code repository.scs_list_code_repos: List all code repositories scanned by Harness SCS.scs_create_opa_policy: Create an OPA policy based on a list of denied licenses.scs_download_sbom: Get the download URL for the Software Bill of Materials (SBOM) for a given artifact orchestration.
Security Test Orchestration (STO) Toolset
Toolset Name: sto
get_all_security_issues: List and filter security issues in Harness STO by target, pipeline, tool, severity, exemption status, and type.global_exemptions: List all global exemptions in Harness STO.promote_exemption: Promote a specific exemption to a global exemption.approve_exemption: Approve a specific exemption.
Logs Toolset
Toolset Name: logs
download_execution_logs: Download logs for a pipeline execution
Templates Toolset
Toolset Name: templates
list_templates: List templates at a given scope
Internal Developer Portal Toolset
Toolset Name: idp
get_entity: Get details of a specific entity in the Harness IDP Cataloglist_entities: List entities in the Harness Internal Developer Portal Catalogget_scorecard: Get details of a specific entity in the Harness IDP Cataloglist_scorecards: List scorecards in the Harness Internal Developer Portal Catalogget_score_summary: Get Score Summary for Scorecards in the Harness Internal Developer Portal Catalog.get_scores: Get Scores for Scorecards in the Harness Internal Developer Portal Catalog.get_scorecard_stats: Get Stats for Scorecards in the Harness Internal Developer Portal i.e. the scores for all the entities that have this scorecard configured.get_scorecard_check: Get details of a specific check configured in a scorecard. A check is a query performed against a data point for a software component which results in either Pass or Fail.list_scorecard_checks: List checks in the Harness Internal Developer Portal Catalog. A check is a query performed against a data point for a software component which results in either Pass or Fail.get_scorecard_check_stats: Get Stats for checks in the Harness Internal Developer Portal i.e. the status (PASS or FAIL) for all the entities that have a scorecard configured which has this check.execute_workflow: Execute a workflow in the Harness Internal Developer Portal Catalog. This tool takes in the entity metadata of the workflow and a set of values to be used for the executionsearch_tech_docs: Searches documentation related to Harness entities in the internal developer portal — including services, APIs, workflows, user groups, and environments — to retrieve information that supports answering or reasoning about those entities. Common examples include debugging issues in a service, understanding an API's configuration, setting up a workflow, managing user groups, or installation steps for a specific environment.
Audit Trail Toolset
Toolset Name: audit
list_user_audits: Retrieve the complete audit trail for a specified user.
Feature Management and Experimentation (FME) Toolset
Toolset Name: fme
list_fme_workspaces: List all FME workspaceslist_fme_environments: List environments for a specific workspacelist_fme_feature_flags: List feature flags for a specific workspaceget_fme_feature_flag_definition: Get the definition of a specific feature flag in an environment
SEI Toolset
Toolset Name: sei
sei_productivity_feature_metrics: Get productivity metrics for a collectionsei_efficiency_lead_time: Get lead time for a projectsei_deployment_frequency: Get deployment frequency metrics for a projectsei_change_failure_rate: Get change failure rate metrics for a projectsei_mttr: Get Mean Time to Restore metrics for a projectsei_deployment_frequency_drilldown: Get deployment frequency drilldown data for detailed pipeline executionssei_change_failure_rate_drilldown: Get change failure rate drilldown data for detailed deployment records with failure statussei_get_team: Get team information by team reference IDsei_get_teams_list: Get list of teams with paginationsei_get_team_integrations: Get team integrations by team reference IDsei_get_team_developers: Get team developers by team reference IDsei_get_team_integration_filters: Get team integration filters by team reference IDsei_get_org_trees: Get organization trees with paginationsei_get_org_tree_by_id: Get a specific organization tree by IDsei_get_org_tree_efficiency_profile: Get efficiency profile reference ID for an organization treesei_get_org_tree_productivity_profile: Get productivity profile reference ID for an organization treesei_get_org_tree_business_alignment_profile: Get business alignment profile reference ID for an organization treesei_get_org_tree_integrations: Get integrations associated with an organization treesei_get_org_tree_teams: Get team hierarchy for an organization treesei_get_ba_all_profiles: Get all BA profilessei_get_ba_insight_metrics: Get BA insight metricssei_get_ba_insight_summary: Get BA insight summarysei_get_ba_drilldown_data: Get BA drilldown data
GitOps Toolset
Toolset Name: gitops
gitops_list_agents: List all GitOps agents (ArgoCD instances) at account, org, or project levelgitops_get_agent: Get detailed information about a specific GitOps agentgitops_list_applications: List all GitOps applications with filtering and paginationgitops_get_application: Get detailed information about a specific GitOps applicationgitops_get_app_resource_tree: Get the resource tree (all Kubernetes resources) for a GitOps applicationgitops_list_app_events: List events for a specific GitOps applicationgitops_get_pod_logs: Get container logs from a pod in a GitOps applicationgitops_get_managed_resources: Get all managed resources for a GitOps applicationgitops_list_resource_actions: List available actions for a specific resource in a GitOps applicationgitops_list_applicationsets: List all ApplicationSets with filtering and paginationgitops_get_applicationset: Get detailed information about a specific ApplicationSetgitops_list_clusters: List all clusters connected to GitOps agentsgitops_get_cluster: Get detailed information about a specific clustergitops_list_repositories: List all Git repositories configured in GitOpsgitops_get_repository: Get detailed information about a specific Git repositorygitops_list_repo_credentials: List all repository credentials with filtering and paginationgitops_get_repo_credentials: Get detailed information about specific repository credentialsgitops_get_dashboard_overview: Get GitOps dashboard overview with application and sync statistics
Prerequisites
- You will need to have Go 1.23 or later installed on your system.
- A Harness API key for authentication.
Quickstart
Makefile Usage
This project provides a Makefile to simplify common development tasks. The main targets are:
make build– Build the mcp-server binary with version information embedded.make init– Set up git hooks and submodules for pre-commit checks.make dep– Download Go module dependencies.make tools– Install tools required for the build (if any are specified).make format– Format Go code using goimports and gci.
You can run any of these commands from the project root. For example:
make build
make format
Build from Source
- Clone the repository:
git clone https://github.com/harness/mcp-server.git
cd mcp-server
- Build the binary:
go build -o cmd/harness-mcp-server/harness-mcp-server ./cmd/harness-mcp-server
- Run the server:
To run in stdio mode:
HARNESS_API_KEY="<PAT>" HARNESS_BASE_URL="https://app.harness.io" ./cmd/harness-mcp-server/harness-mcp-server stdio
Optional environment variables:
- HARNESS_DEFAULT_ORG_ID
- HARNESS_DEFAULT_PROJECT_ID
- HARNESS_TOOLSETS - Comma separated list of toolsets to enable. For e.g. HARNESS_TOOLSETS="pipelines,sei,scs,sto". If not specified, ONLY the default toolset is enabled.
To run in http mode:
HARNESS_API_KEY="<PAT>" HARNESS_BASE_URL="https://app.harness.io" ./cmd/harness-mcp-server/harness-mcp-server http-server
Optional environment variables:
- HARNESS_TOOLSETS - Comma separated list of toolsets to enable. For e.g. HARNESS_TOOLSETS="pipelines,sei,scs,sto". If not specified, ONLY the default toolset is enabled.
Use Docker Image
Stdio mode
Alternatively, you can use the pre-built Docker image:
docker run -i --rm \
-e HARNESS_API_KEY="<PAT>" \
-e HARNESS_BASE_URL="https://app.harness.io" \
harness/mcp-server stdio
Optional environment variables:
- HARNESS_DEFAULT_ORG_ID
- HARNESS_DEFAULT_PROJECT_ID
- HARNESS_TOOLSETS - Comma separated list of toolsets to enable. For e.g. HARNESS_TOOLSETS="pipelines,sei,scs,sto". If not specified, ONLY the default toolset is enabled.
Http mode
Alternatively, you can use the pre-built Docker image and run the server in http-mode locally:
docker run -i --rm \
-e HARNESS_API_KEY="<PAT>" \
-e HARNESS_BASE_URL="https://app.harness.io" \
harness/mcp-server http-server
Optional environment variables:
- HARNESS_TOOLSETS - Comma separated list of toolsets to enable. For e.g. HARNESS_TOOLSETS="pipelines,sei,scs,sto". If not specified, ONLY the default toolset is enabled.
Integration with AI Assistants
Usage with Gemini CLI
Add the server configuration to your Gemini config file at: ~/.gemini/settings.json
{
"theme": "Default",
"selectedAuthType": "oauth-personal",
"mcpServers": {
"Harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server]
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
}
}
}
}
Usage with Gemini CLI Extensions
You will need to run the following command to install the Harness MCP as an extension:
gemini extensions install https://github.com/harness/mcp-server
Then you will need to set the environment variables for the extension:
export HARNESS_API_KEY="your_api_key_here"
Launch Gemini and start asking questions about Harness!
gemini
Claude Desktop Configuration
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server"]
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>"
}
}
}
}
Usage with Claude Code
Add the server configuration to your Claude config file at: ~/.claude.json
{
"mcpServers": {
"Harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server"]
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Usage with Windsurf
To use the Harness MCP Server with Windsurf:
- Add the server configuration to your Windsurf config file:
Using Local Binary
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server"]
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Using Docker Image
{
"mcpServers": {
"harness": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"HARNESS_API_KEY",
"-e",
"HARNESS_DEFAULT_ORG_ID",
"-e",
"HARNESS_DEFAULT_PROJECT_ID",
"-e",
"HARNESS_BASE_URL",
"harness/mcp-server",
"stdio" // or "http-server"
],
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Usage with Amazon Q Developer CLI
To use the Harness MCP Server with Amazon Q Developer CLI:
- Add the server configuration to your Amazon Q config file at:
~/.aws/amazonq/mcp.json
Using Local Binary
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server"]
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Cursor Configuration
{
"mcpServers": {
"harness": {
"command": "/path/to/harness-mcp-server", // ${workspaceFolder}/cmd/harness-mcp-server
"args": ["stdio"], // or ["http-server"]
"env": {
"HARNESS_API_KEY": "your_api_key",
"HARNESS_DEFAULT_ORG_ID": "your_org_id",
"HARNESS_DEFAULT_PROJECT_ID": "your_project_id",
"HARNESS_BASE_URL": "<if-needed>"
}
}
}
}
VS Code Configuration
{
"mcp": {
"servers": {
"harness": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"HARNESS_API_KEY",
"-e",
"HARNESS_DEFAULT_ORG_ID",
"-e",
"HARNESS_DEFAULT_PROJECT_ID",
"-e",
"HARNESS_BASE_URL",
"harness/mcp-server",
"stdio" // or "http-server"
],
"env": {
"HARNESS_API_KEY": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
}
Tool Usage Guide
Download Execution Logs
Using Docker:
We need to mount the logs directory to the container to download the logs.
docker run -d --name mcp-server -p 8080:8080 -v /path/to/logs/in/host:/path/in/container harness/mcp-server --output-dir=/path/in/container
This ensures that the logs downloaded to container are accessible in the host.
Example:
docker run -d --name mcp-server -p 8080:8080 -v /Users/testuser/logs:/logs harness/mcp-server --output-dir=/logs
Sample MCP Configuration:
{
"mcpServers": {
"harness": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/Users/testuser/logs:/logs",
"-e",
"HARNESS_MCP_USER_PAT",
"-e",
"HARNESS_DEFAULT_ORG_ID",
"-e",
"HARNESS_DEFAULT_PROJECT_ID",
"-e",
"HARNESS_MCP_BASE_URL",
"harness/mcp-server",
"stdio",
"--output-dir=/logs", #/path/in/container
"--toolsets=logs",
"--api-key="
],
"env": {
"HARNESS_MCP_USER_PAT": "<YOUR_API_KEY>",
"HARNESS_DEFAULT_ORG_ID": "<YOUR_ORG_ID>",
"HARNESS_DEFAULT_PROJECT_ID": "<YOUR_PROJECT_ID>",
"HARNESS_MCP_BASE_URL": "<YOUR_BASE_URL>"
}
}
}
}
Example Tool Input:
{
"logs_directory": "pipeline-logs",
"org_id": "<YOUR_ORG_ID>",
"plan_execution_id": "<YOUR_PLAN_EXECUTION_ID>",
"project_id": "<YOUR_PROJECT_ID>"
}
Sample Response:
Files downloaded to : /Users/testuser/logs/pipeline-logs/logs-<YOUR_PLAN_EXECUTION_ID>/logs.zip
Using Local Binary:
Example configuration:
"args": ["stdio", "--toolsets=logs", "--api-key=", "--output-dir=/Users/testuser/log-files"]
Example Tool Input:
{
"logs_directory": "logs1",
"project_id": "<YOUR_PROJECT_ID>",
"plan_execution_id": "<YOUR_PLAN_EXECUTION_ID>",
"org_id": "<YOUR_ORG_ID>"
}
Sample Response:
Files downloaded to : /Users/testuser/log-files/logs1/logs-<YOUR_PLAN_EXECUTION_ID>/logs.zip
Development
Coding Agents
See AGENTS.md for code conventions, repository layout, and contribution guidelines for AI coding agents.
Agent Commands
review-mcp-tool
Reviews MCP tool definitions against quality criteria in .harness/rules/review.md.
💡 Tip: Run this command whenever you are making changes to an MCP tool.
Supported IDEs: Cursor, Claude Code, Windsurf
Examples:
/review-mcp-tool review tool get_pipeline
/review-mcp-tool review this MCP tool change
/review-mcp-tool review all ccm tools
Source: .harness/commands/review-mcp-tool.md
Command Line Arguments
The Harness MCP Server supports the following command line arguments:
--toolsets: Comma-separated list of tool groups to enable, if the list is empty or flag is not set, only default toolset is enabled. Use--toolsets=allto enable all available toolsets. Note: This flag is only effective when--enable-licenseis false (the default).--read-only: Run the server in read-only mode--log-file: Path to log file for debugging--log-level: Set the logging level (debug, info, warn, error)--version: Show version information--help: Show help message--base-url: Base URL for Harness (default: "https://app.harness.io")--output-dir: Directory where the tool writes output files (e.g., pipeline logs)
Environment Variables
Environment variables are prefixed with HARNESS_:
HARNESS_API_KEY: Harness API key (required) - Account ID is automatically extracted from the API keyHARNESS_DEFAULT_ORG_ID: Default Harness organization ID (optional, if not specified it would need to be passed in the request if it's required for that operation)HARNESS_DEFAULT_PROJECT_ID: Default Harness project ID (optional, if not specified it would need to be passed in the request if it's required for that operation)HARNESS_TOOLSETS: Comma-separated list of toolsets to enable (default: "default")HARNESS_READ_ONLY: Set to "true" to run in read-only modeHARNESS_LOG_FILE: Path to log fileHARNESS_LOG_LEVEL: Set the logging level (debug, info, warn, error)HARNESS_BASE_URL: Base URL for Harness (default: "https://app.harness.io")
Authentication
The server uses a Harness API key for authentication. This can be set via the HARNESS_API_KEY environment variable.
Parameters:
text: The text to display on the buttonaction: The action to perform (currently supportsOPEN_ENTITY_NEW_TAB)data: Contains navigation informationpageName: The page to navigate to (e.g.,ExecutionPipelineView,PipelineStudio, etc.)metadata: Key-value pairs needed for the target page (e.g.,{"executionId": "abc123", "pipelineId": "xyz789"})
Example:
actionData := `{"actions": [{"text": "View Pipeline", "action": "OPEN_ENTITY_NEW_TAB", "data": {"pageName": "PipelineStudio", "metadata": {"id": "pipeline-id"}}}]}`
Alternative: Quick Prompts
If you provide an array of strings instead of the actions object, these strings will be added to the message box as quick prompts that users can click on:
// Add quick prompts to the message box
quickPrompts := `["Show me pipeline details", "List recent executions", "Analyze performance"]`
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector with this command:
npx @modelcontextprotocol/inspector /path/to/harness-mcp-server stdio
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Testing
Running E2E Tests
The project includes end-to-end (E2E) tests that validate the integration with Harness services. To run these tests:
- Set up the required environment variables:
export HARNESS_MCP_SERVER_E2E_TOKEN=<your_harness_api_token>
export HARNESS_MCP_SERVER_E2E_ACCOUNT_ID=<your_account_id>
export HARNESS_MCP_SERVER_E2E_ORG_ID=<your_org_id>
export HARNESS_MCP_SERVER_E2E_PROJECT_ID=<your_project_id>
export HARNESS_MCP_SERVER_E2E_BASE_URL=<base_url>
- Run the E2E tests using the Go test command with the e2e build tag:
go test -tags=e2e ./test/e2e/... -v
- To run specific E2E tests, use the
-runflag:
go test -tags=e2e ./test/e2e/... -v -run TestPipelineWorkflow
- In VS Code, you can run the E2E tests directly using the launch.json configuration. Simply open the Run and Debug view, select the E2E test configuration from the dropdown menu, and click the Run button.
The E2E tests create an in-process MCP client that communicates with the Harness API using your provided credentials.
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Makefile MCP Server
Exposes Makefile targets as callable tools for AI assistants.
MCP Utils
A Python package with utilities and helpers for building MCP-compliant servers, often using Flask and Redis.
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers, without authentication.
Tmux MCP Server
Provides persistent shell execution through tmux sessions.
1MCP
A unified MCP server that aggregates multiple MCP servers into a single endpoint.
XcodeBuild MCP
A server providing tools for Xcode project management, simulator management, and app utilities.
MCP Memory Keeper
A server for persistent context management in Claude AI coding assistants, using a local SQLite database for storage.
SCAST
Analyzes source code to generate UML and flow diagrams with AI-powered explanations.
ChemMCP
A collection of 19 professional tools for chemical molecular processing based on the Model Context Protocol (MCP).
Databutton App MCP
Call your Databutton app endpoints as LLM tools with MCP.