> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-ai/untitled-1/use-harness-ai/ide-and-integrations/cursor-plugin.md).

# Harness AI Cursor Plugin

The Harness AI Cursor Plugin brings the full power of the Harness platform into Cursor. Search "Harness" in the Cursor Plugin Marketplace to install it, authenticate with OAuth, and start managing [pipelines](/continuous-delivery/new-to-continuous-delivery/getting-started.md#step-1-create-your-pipeline), debugging executions, creating infrastructure, and governing deployments using natural language.

The plugin bundles 30 skills, 11 Model Context Protocol (MCP) tools covering 160+ resource types, workspace rules, and governance hooks so the agent follows Harness conventions out of the box.

***

## What you will learn in this topic

By the end of this topic, you will be able to:

* [Enable OAuth for your Harness account](#step-1-enable-oauth-for-your-harness-account).
* [Install the plugin from the Cursor Marketplace or from source](#step-2-install-the-plugin).
* [Authenticate the plugin through the browser consent flow](#step-3-authenticate).
* [Manage Harness resources with natural language prompts in Cursor](#use-harness-in-cursor).
* [Apply workspace rules and governance hooks to enforce Harness standards](#governance-hooks).

***

## Before you begin

Before you install the Harness AI Cursor Plugin, ensure you have the following:

* **Cursor IDE**: Version 0.48 or later with plugin support enabled.
* **Harness account**: An active Harness account.
* **OAuth enabled**: Account-level OAuth, which the plugin requires to authenticate through the browser consent flow. Enablement requires a support ticket, which is the first step below.

***

## Step 1: Enable OAuth for your Harness account

The Cursor Plugin uses OAuth to authenticate with Harness, so enable OAuth at the account level before you install the plugin.

1. Open a support ticket with [Harness Support](https://support.harness.io) requesting OAuth enablement for your account.
2. Provide your Harness **Account ID**, found in **Account Settings** > **Overview**.
3. After Support confirms OAuth is enabled, continue with the installation steps.

***

## Step 2: Install the plugin

Install the plugin from the Cursor Marketplace for the fastest setup, or install from source when you need to run a specific build. Marketplace installation also lets you choose whether the plugin applies to your user account or your whole Cursor organization.

{% tabs %}
{% tab title="Cursor Marketplace" %}

1. Open Cursor and navigate to **Settings** > **Plugins** > **Marketplace**.
2. Search for **Harness**.
3. Select the **Harness** plugin by Harness, Inc.
4. Click **Install** and select the installation scope:
   * **Personal**: Installs the plugin for your user only.
   * **Organization**: Installs the plugin for all members of your Cursor organization.
5. Restart Cursor after installation completes.
   {% endtab %}

{% tab title="GitHub Source" %}
Install from source when you prefer to build from the repository:

```bash
git clone https://github.com/harness/harness-ai.git
```

Then add the plugin path `plugins/cursor/` from the cloned repository to your Cursor plugin configuration.
{% endtab %}
{% endtabs %}

***

## Step 3: Authenticate

Authentication uses OAuth, so no API keys or manual configuration are required to authenticate the plugin. Governance hooks are the one exception, and they need the environment variables from Step 4.

The plugin connects to the remote Harness MCP server at `https://mcp.harness.io/mcp`.

1. Open Cursor after you install the plugin.
2. Open the **Agent** or **Chat** panel and invoke any Harness action. For example, type "List my Harness pipelines".
3. Cursor opens a browser window with the Harness OAuth consent screen.
4. Sign in with your Harness credentials and approve the consent.
5. Return to Cursor. The plugin is now authenticated and ready to use.

Subsequent sessions reuse the cached OAuth token automatically. If the token expires, the consent flow triggers again on the next tool call.

***

## Step 4: Set environment variables for governance hooks

Complete this step only if you use governance hooks. The hooks call the Harness API directly, so they need an API key and account ID in addition to the OAuth token that authenticates the plugin.

Set the following variables before you start Cursor:

```bash
export HARNESS_API_KEY="pat.xxxxx.xxxxx.xxxxx"
export HARNESS_ACCOUNT_ID="your-account-id"
```

Without these variables, governance hooks fail open and the rest of the plugin works normally. Go to [Governance hooks](#governance-hooks) to review what each hook enforces.

***

## Use Harness in Cursor

Natural language is the primary interface, so you describe the outcome you want instead of assembling YAML by hand. After you authenticate, interact with Harness in the Cursor Agent panel. The plugin interprets your intent and routes requests through the appropriate MCP tools and skills.

### Example prompts

Use the following prompts as starting points for common workflows.

**Pipeline management**:

```
Create a CI pipeline for my Node.js app that builds, tests, and pushes a Docker image to ECR
```

```
Debug my last failed deployment. What went wrong and how do I fix it?
```

**Infrastructure and resources**:

```
Create a GitHub connector for harness/my-repo using the PAT stored in secret github_pat
```

```
Set up staging and production environments for the payments service
```

**Governance and observability**:

```
Show me DORA metrics for the platform project over the last quarter
```

```
Find cost anomalies in the last 30 days and recommend optimizations
```

***

## Skills

Skills encode Harness-specific procedures, so the agent follows a known-good sequence instead of improvising. The plugin ships with 30 skills that teach the Cursor agent how to accomplish specific Harness tasks. Skills are invoked automatically based on your prompt, or you reference them directly with `@file`.

| Category                   | Skills                                                                                                                                        |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Pipeline and templates** | `create-pipeline`, `create-pipeline-v1`, `create-template`, `create-trigger`, `run-pipeline`, `debug-pipeline`, `migrate-pipeline`            |
| **Infrastructure**         | `create-service`, `create-environment`, `create-infrastructure`, `create-connector`, `create-secret`                                          |
| **Access control**         | `manage-users`, `manage-roles`, `manage-feature-flags`                                                                                        |
| **Operations**             | `manage-delegates`, `manage-freeze-windows`, `manage-pull-requests`, `manage-slos`                                                            |
| **Intelligence**           | `analyze-costs`, `dora-metrics`, `security-report`, `gitops-status`, `chaos-experiment`, `scorecard-review`, `audit-report`, `template-usage` |
| **AI agents**              | `create-agent`, `create-agent-template`                                                                                                       |

For more information on the full skill catalog and how skills orchestrate MCP tool calls, see [Harness Skills](/harness-ai/use-harness-ai/harness-ai/govern-ai-output/harness-skills.md).

***

## MCP tools

The tool set is deliberately small so the agent selects the right tool reliably as resource coverage grows. The plugin exposes 11 consolidated MCP tools that cover 160+ Harness resource types.

| Tool               | Purpose                                                 |
| ------------------ | ------------------------------------------------------- |
| `harness_list`     | List resources with filters, pagination, and search     |
| `harness_get`      | Fetch a single resource by ID                           |
| `harness_create`   | Create a new resource                                   |
| `harness_update`   | Update an existing resource                             |
| `harness_delete`   | Delete a resource                                       |
| `harness_execute`  | Run, retry, approve, reject, or toggle actions          |
| `harness_search`   | Cross-resource keyword search                           |
| `harness_describe` | Discover resource types and operations (no API call)    |
| `harness_schema`   | Get the JSON Schema for create and update payloads      |
| `harness_diagnose` | Analyze pipeline failures with stage and step breakdown |
| `harness_status`   | Get project health overview                             |

Go to [Harness MCP Server](/harness-ai/use-harness-ai/harness-ai/connect-with-ai/harness-mcp-server/index.md) to review the full MCP server documentation and configuration options.

### Resources the tools reach

Resource access lets the agent read your existing configuration before it writes anything new. The MCP server exposes Harness resources through URI-based access, and the agent reads and references the following:

* **Pipelines** (v0 and v1), services, environments, and infrastructure definitions
* **Connectors** (Git, cloud, registry, cluster) and secrets
* **Templates** (step, stage, pipeline, step group)
* **Feature flags**, delegates, SLOs, and policy definitions
* **Organizations** and projects for multi-scope operations

The agent discovers resources dynamically. You do not need to hardcode **Organization** or **Project** IDs.

***

## Workspace rules

Workspace rules constrain how the agent operates, which prevents malformed or out-of-order resource creation. The plugin includes a workspace rule (`harness.mdc`) that applies to Cursor sessions automatically. This rule teaches the agent to:

* Establish **Organization** and **Project** scope before write operations.
* Verify referenced resources exist before creating dependents.
* Follow the correct dependency order: connectors, secrets, services, environments, infrastructure, pipelines, and triggers.
* Request user confirmation for write, delete, and execute operations.
* Recover from common API errors (`DUPLICATE_IDENTIFIER`, `CONNECTOR_NOT_FOUND`, `ACCESS_DENIED`).

***

## Governance hooks

Governance hooks apply your organization's standards at the moment of creation, so agent-generated pipelines follow approved patterns. The plugin includes two hooks:

* **Template governance (before create)**: When you create a pipeline without referencing a template, the hook surfaces available templates at **Account**, **Organization**, and **Project** scope so you reuse approved patterns.
* **Policy validation (after create or update)**: After a pipeline write, the hook evaluates the YAML against [OPA](https://www.openpolicyagent.org/docs/latest/policy-language/) policies bound to your account and reports pass and fail results.

Both hooks call the Harness API, so they stay inactive until you set the required environment variables. Go to [Set environment variables for governance hooks](#step-4-set-environment-variables-for-governance-hooks) to activate them.

***

## Troubleshooting

Use the following guidance to resolve the most common installation, authentication, and governance failures.

<details>

<summary>OAuth consent screen does not appear when I invoke a Harness tool</summary>

Verify OAuth is enabled for your account by contacting Harness Support. Ensure you are running Cursor 0.48 or later and that the Harness plugin is installed and active in Settings > Plugins.

</details>

<details>

<summary>Plugin installed but no Harness tools appear in Cursor</summary>

Restart Cursor after installing the plugin. Open Settings > Plugins and verify the Harness plugin shows as active. If installed from GitHub, confirm the plugin path points to the plugins/cursor/ directory.

</details>

<details>

<summary>Authentication fails with ACCESS_DENIED after OAuth approval</summary>

Your Harness user may lack the required permissions. Verify your role has access to the target organization and project. Navigate to Account Settings > Access Control to check your role assignments.

</details>

<details>

<summary>Governance hooks are not enforcing template or policy checks</summary>

Governance hooks require HARNESS\_API\_KEY and HARNESS\_ACCOUNT\_ID environment variables set in your shell before starting Cursor. Without these, hooks fail open and do not call the Harness API.

</details>

\---

## Next steps

Extend the plugin with the wider Harness AI tooling and prompt patterns.

* [Harness Skills](/harness-ai/use-harness-ai/harness-ai/govern-ai-output/harness-skills.md): Explore the full skill catalog.
* [Harness MCP Server](/harness-ai/use-harness-ai/harness-ai/connect-with-ai/harness-mcp-server/index.md): Review advanced MCP configuration and deployment options.
* [Effective Prompting](https://developer.harness.io/docs/platform/harness-ai/harness-create-with-ai/effective-prompting-ai): Learn prompt patterns that produce better results with Harness AI.
