> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endorlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Endor Labs MCP server in Cursor

> Learn how to deploy and run the Endor Labs MCP server in Cursor.

Scan dependencies, detect vulnerabilities, find leaked secrets, and review code for security issues directly inside Cursor, powered by your AI agent.

> [!NOTE]
>
> See [Endor Labs MCP server in Cursor](https://docs.endorlabs.com/setup-deployment/mcp/cursor.md) to query Endor Labs from the assistant. See [Endor Labs Agent Kit in Cursor](https://docs.endorlabs.com/secure-ai-coding/agent-kit/cursor.md) to install workflow agents. See [Deploy hooks for Cursor](https://docs.endorlabs.com/agent-governance/cursor.md) to capture events and enforce Coding Agent Governance policies.

> [!TIP]
>
> You can also connect the [Endor Labs documentation MCP server](https://docs.endorlabs.com/introduction/doc-tools/docs-mcp-server.md) to get accurate, real-time answers about Endor Labs directly in your AI tools.

> [!TIP]
>
> Grok Build loads MCP servers from `.cursor/mcp.json`, so the Endor Labs MCP server you configure here is available in Grok Build.

The Endor Labs MCP server runs locally on your machine as a lightweight process. Your IDE or CLI launches it through `npx` or a system-installed `endorctl` and communicates with it over stdio. When the AI agent needs security context, the server calls the Endor Labs cloud platform and returns the results. The server uses the stdio transport only, so configure it with a `command` and `args` entry rather than an HTTP (`type: http`) URL.

## What you can do

With the Endor Labs MCP server, you can:

* **Check dependency safety** before adding a new package
* **Scan for vulnerabilities and malware** in your open source dependencies
* **Find leaked secrets** accidentally committed in your Git history
* **Run static analysis (SAST)** on your code with the `scan` tool
* **Run AI security reviews** on your code changes (Enterprise Edition)

The MCP server returns the full set of findings for the dependency, package, or code you ask about. It does not perform function-level reachability analysis and does not filter findings by an action policy. For reachability and policy-based findings, run a full Endor Labs scan or use the Endor Labs platform.

> [!NOTE]
>
> **Node.js: 18 or later required, 24 LTS recommended**
>
> The Endor Labs MCP server runs `endorctl` through `npx`, which requires Node.js 18 or later. npm is included with Node.js, so no separate npm installation or version is required. On Node.js versions older than 24, you may see a harmless warning printed before scan output.
>
> ```text theme={null}
> (node:NNNNN) ExperimentalWarning: CommonJS module .../debug/src/node.js is loading ES Module .../supports-color/index.js using require().
> ```
>
> This is a Node.js runtime notice, not an error from `endorctl` or the MCP server, and it does not affect scan results. To silence it, upgrade Node.js to 24 LTS or later, then restart your IDE or CLI. Verify with `node --version`.

## Install the MCP server

The Developer Edition is free and uses default security policies from Endor Labs. You do not need an Endor Labs account. When you use the MCP server for the first time, a browser window opens for authentication through GitHub, GitLab, or Google.

### Developer Edition Configuration

Install in Cursor

For manual configuration, copy and paste the following JSON directly into a
`.cursor/mcp.json` file in the root of your repository.

<details><summary>📄 View JSON configuration</summary></details>

> [!NOTE]
>
> Have questions? Email us at [community-support@endor.ai](mailto:community-support@endor.ai).

The Enterprise Edition enforces your organization's specific security policies. You need your Endor Labs namespace and an authentication method. Ensure that your developers have Read-Only permissions to Endor Labs. See [Authorization policies](https://docs.endorlabs.com/platform-administration/rbac/authorization-policies.md) for more details.

Generate the Enterprise Edition configuration for your organization.

### Enterprise Edition Configuration

<form>
  Pre-existing Endor Labs configuration?

  <fieldset aria-labelledby="mcp-preexisting-label">No
  Yes</fieldset>

  Select **Yes** if you already have Endor Labs configured locally from a previous `endorctl init`. Your existing configuration is used without additional setup.

  Using npx?

  <fieldset aria-labelledby="mcp-using-npx-label">Yes
  No</fieldset>

  Select **Yes** to use `npx` to download and run endorctl from npm. Select **No** if you have endorctl installed directly (e.g. via Homebrew or direct download).

  **Keep endorctl updated.** When using a directly installed endorctl, make sure to keep it updated with your package manager (e.g. `brew upgrade endorctl`) for the best experience. See the [endorctl installation docs](https://docs.endorlabs.com/setup-deployment/cli.md) for details.

  ↺ Reset

  Install in Cursor

  For manual configuration, copy and paste the following JSON directly into a
  `.cursor/mcp.json`
  file in the root of your repository.

  <details><summary>📄 View JSON configuration</summary></details>
</form>

Use the following optional parameters to configure the MCP server:

* `ENDOR_MCP_SERVER_AUTH_MODE`: Forces browser authentication with one of the supported modes: `github`, `gitlab`, `google`, or `sso`. Setting this variable overrides any existing local endorctl credentials. When you omit `ENDOR_MCP_SERVER_AUTH_MODE`, the MCP server reuses valid local endorctl credentials, such as those from `endorctl init`. If it finds no valid credentials, it falls back to browser authentication.
* `ENDOR_NAMESPACE`: Sets the Endor Labs namespace for the MCP server. Required for Enterprise Edition unless you already set a namespace with `endorctl init`. Not needed for Developer Edition.
* `ENDOR_MCP_SERVER_AUTH_TENANT`: Sets the tenant name for SSO authentication. Required when you set `ENDOR_MCP_SERVER_AUTH_MODE` to `sso`.

> [!NOTE]
>
> **Advanced:** Set scan environment variables in the server's `env` block to pass them through to scans. For example, set `SECRETS_RULES_PATH` to point the secret scanner at a custom ruleset. See [Manage secret rules](https://docs.endorlabs.com/scan/secrets/secret-rules.md) to configure custom rules.

## Verify the installation

After installing, select **Settings** > **Cursor Settings** > **Tools & MCP** and confirm **endor-cli-tools** appears in the list and is enabled.

### Try a test prompt

After installing the MCP server, try the following prompt in your AI chat or CLI to verify that the tools are working.

```text theme={null}
Check if the npm package lodash version 4.17.20 has any vulnerabilities
```

The MCP server uses the `check_dependency_for_vulnerabilities` tool to check for known vulnerabilities and return the results. If you see a response with vulnerability details, the MCP server is working correctly.

## How to use the Endor Labs MCP server

The Endor Labs MCP server provides the following tools:

* `check_dependency_for_vulnerabilities`: Check if a dependency in your project is vulnerable.
* `check_dependency_for_risks`: Check a dependency for security risks including vulnerabilities and malware.
* `get_endor_vulnerability`: Get the details of a specific vulnerability from the Endor Labs vulnerability database.
* `get_resource`: Retrieve additional context from commonly used Endor Labs resources about your software, such as findings, vulnerabilities, and projects.
* `scan`: Run an Endor Labs security scan to detect risks in your open source dependencies, find common security issues, and spot any credentials accidentally exposed in your Git repository.
* `security_review`: Perform security review analysis on code diffs. Analyzes local uncommitted changes (both staged and unstaged) compared to HEAD, or diffs between the main branch and the last commit. The tool sets the [`--diff-scope`](https://docs.endorlabs.com/scan/ai-sast#ai-sast-diff-scans) scan option automatically based on the review type. Requires the Enterprise Edition. You must specify your namespace in the MCP server configuration. You must also enable AI security code review for your namespace in the Endor Labs platform. See [AI security code review](https://docs.endorlabs.com/secure-ai-coding/ai-security-review.md) for setup instructions.

After you set up the MCP server, you can choose to disable the tools that you do not want to use.

## Configure Cursor rules

To enhance the MCP server integration, you can add custom rules for your project. These rules are custom prompts specific to your project.

1. Navigate to the root of your repository.

2. In the `.cursor/rules` directory, create an `.mdc` file to add specific instructions.

3. Add appropriate rules for your project in the `.cursor/rules/endorlabs.mdc` file. For example, you can add a rule to check if the code is free from vulnerabilities.

### Example Cursor rules

You can use the following Cursor rules as a quick start for the Endor Labs MCP server. Modify the rules to meet your specific organization's needs. We recommend that you store each cursor rule in a separate file. For more information, refer to the [Cursor documentation](https://docs.cursor.com/context/rules).

> [tab] SCA Rule Example
>
> ```yaml theme={null}
> ---
> description: "Ensure newly added dependencies are checked for vulnerabilities and project stays clean"
> globs: '**/package.json, **/package-lock.json, **/yarn.lock, **/pnpm-lock.yaml, **/requirements.txt, **/Pipfile, **/Pipfile.lock, **/pyproject.toml, **/poetry.lock, **/go.mod, **/go.sum, **/Cargo.toml, **/Cargo.lock, **/pom.xml, **/build.gradle, **/build.gradle.kts, **/gradle.lockfile, **/composer.json, **/composer.lock'
> alwaysApply: true
> ---
>
> # Software Composition Analysis (SCA) Rule (Endor Labs through MCP)
> This project uses Endor Labs for automated dependency (SCA) scanning, integrated through the MCP server as configured in `.cursor/mcp.json`.
>
> ## Workflow
>
> Do the following steps immediately after a manifest or lockfile (like package.json or go.mod) is created or modified before any other task.
>
> 1. Run `endor-cli-tools` using the `check_dependency_for_vulnerabilities` tool through the MCP server.
> 2. Provide the **ecosystem**, **dependency name**, and **version** always when making this tool call. Do not forget to provide a version.
> 3. If a vulnerability or error is identified:
>   - Upgrade to the suggested safe version, or
>   - Replace the dependency with a non-vulnerable alternative.
>   - The AI agent must attempt to automatically correct all detected errors and vulnerabilities before session completion.
> 4. Re-run the check using `endor-cli-tools` to confirm the issue is resolved.
> 5. If an error occurs in any MCP server tool call (such as missing required parameters like version, invalid arguments, or tool invocation failures):
>   - The AI agent must review the error, determine the cause, and automatically correct the tool call or input parameters.
>   - Re-attempt the tool call with the corrected parameters.
>   - Continue this process until the tool call succeeds or it is determined that remediation is not possible, in which case the issue and reason must be reported.
>
> ## Notes
> - All scans must be performed using the MCP server integration (`endor-cli-tools`) as configured in `.cursor/mcp.json`. Do not invoke `endorctl` directly.
> - For troubleshooting, ensure the MCP server is running and `endorctl` is installed and accessible in your environment.
>
> This rule ensures that all dependency changes are evaluated for risk at the time of introduction, and that the project remains clean and secure after each coding session. The scan may be performed at the end of an agent session, provided all modifications are checked and remediated before session completion.
> ```

> [tab] Secrets Rule Example
>
> ```yaml theme={null}
> ---
> description: "Scan for leaked secrets on file modification"
> globs: '**/*'
> alwaysApply: true
> ---
>
> # Leaked Secrets Detection Rule (Endor Labs through MCP)
> This project uses @Endor Labs for automated security scanning, integrated through the MCP server as configured in `.cursor/mcp.json`.
>
> ## Workflow
>
> Do the following steps whenever a file is modified in the repository, and before the end of an agent session.
>
> 1. Run `endor-cli-tools` using the `scan` tool through the MCP server to check for leaked secrets.
> 2. Ensure the scan includes all file types and respects `.gitignore` unless otherwise configured.
> 3. If any secrets or errors are detected:
>   - Remove the exposed secret or correct the error immediately.
>   - The AI agent must attempt to automatically correct all detected secrets and errors before session completion.
>   - Re-run the scan to verify the secret or error has been properly removed or resolved.
> 4. If an error occurs in any MCP server tool call (such as missing required parameters like version, invalid arguments, or tool invocation failures):
>   - The AI agent must review the error, determine the cause, and automatically correct the tool call or input parameters.
>   - Re-attempt the tool call with the corrected parameters.
>   - Continue this process until the tool call succeeds or it is determined that remediation is not possible, in which case the issue and reason must be reported.
> 5. Save scan results and remediation steps in a security log or as comments for audit purposes.
>
> ## Notes
> - All scans must be performed using the MCP server integration (`endor-cli-tools`) as configured in `.cursor/mcp.json`. Do not invoke `endorctl` directly.
> - For troubleshooting, ensure the MCP server is running and `endorctl` is installed and accessible in your environment.
> - **Important**: This scan must use the path of the directory from which the changed files are in. Do not attempt to set the path directly to a file as it must be a directory. Use absolute paths like /Users/username/mcp-server-demo/backend rather than relative paths like 'backend'
>
> This rule ensures no accidental credentials, tokens, API keys, or secrets are committed or remain in the project history. The scan may be performed at the end of an agent session, provided all modifications are checked and remediated before session completion.
> ```

> [tab] SAST Rule Example
>
> ```yaml theme={null}
> ---
> description: "Run SAST scan using endor-cli-tools on source code changes"
> globs: '**/*.c, **/*.cpp, **/*.cc, **/*.cs, **/*.go, **/*.java, **/*.js, **/*.jsx, **/*.ts, **/*.tsx, **/*.py, **/*.php, **/*.rb, **/*.rs, **/*.kt, **/*.kts, **/*.scala, **/*.swift, **/*.dart, **/*.html, **/*.yaml, **/*.yml, **/*.json, **/*.xml, **/*.sh, **/*.bash, **/*.clj, **/*.cljs, **/*.ex, **/*.exs, **/*.lua'
> alwaysApply: true
> ---
>
> # Static Application Security Testing (SAST) Rule (Endor Labs through MCP)
>
> This project uses @Endor Labs for automated SAST, integrated through the MCP server as configured in `.cursor/mcp.json`.
>
> ## Workflow
>
> Do the following steps whenever a file is modified in the repository, and before the end of an agent session.
>
> 1. Run `endor-cli-tools` using the `scan` tool through the MCP server to perform SAST scans as described above.
> 2. If any vulnerabilities or errors are found:
>   - Present the issues to the user.
>   - The AI agent must attempt to automatically correct all errors and vulnerabilities, including code errors, security issues, and best practice violations, before session completion.
>   - Recommend and apply appropriate fixes (e.g., input sanitization, validation, escaping, secure APIs).
>   - Continue scanning and correcting until all critical issues have been resolved or no further automated remediation is possible.
> 3. If an error occurs in any MCP server tool call (such as missing required parameters like version, invalid arguments, or tool invocation failures):
>   - The AI agent must review the error, determine the cause, and automatically correct the tool call or input parameters.
>   - Re-attempt the tool call with the corrected parameters.
>   - Continue this process until the tool call succeeds or it is determined that remediation is not possible, in which case the issue and reason must be reported.
> 4. Save scan results and remediation steps in a security log or as comments for audit purposes.
>
> ## Notes
> - All scans must be performed using the MCP server integration (`endor-cli-tools`) as configured in `.cursor/mcp.json`. Do not invoke `endorctl` directly.
> - For troubleshooting, ensure the MCP server is running and `endorctl` is installed and accessible in your environment.
> - Do not invoke Opengrep directly.
> - **Important**: This scan must use the path of the directory from which the changed files are in. Do not attempt to set the path directly to a file as it must be a directory. Use absolute paths like /Users/username/mcp-server-demo/backend rather than relative paths like 'backend'
>
> This rule ensures all code changes are automatically reviewed and remediated for common security vulnerabilities and errors using `endor-cli-tools` and the MCP server, with Opengrep as the underlying engine.
> ```

## Keep endorctl up to date

The default configuration runs `npx -y endorctl`, which downloads the latest published endorctl into the npx cache (`~/.npm/_npx/`) and reuses it on later runs. If you are not getting the latest version, do one of the following:

* Clear the npx cache (`~/.npm/_npx/`), then restart your IDE or CLI so the next run downloads the current endorctl.
* Pin a specific version by changing `endorctl` to `endorctl@<version>` in your `args`.
* Install endorctl yourself and call it directly, with `command` set to `endorctl` and `args` set to `["ai-tools", "mcp-server"]`. Updates are then managed by your package manager, for example `brew upgrade endorctl`. See [Install endorctl](https://docs.endorlabs.com/setup-deployment/cli.md).

## Troubleshooting

Use the following troubleshooting steps to resolve common issues with the Endor Labs MCP server.

> [accordion] MCP server shows disconnected
>
> Run `npx --version` in your terminal. If the command fails, install [Node.js](https://nodejs.org/) version 18 or later (Node.js 24 LTS recommended). After installing, restart your IDE or CLI to reload the MCP server configuration.

> [accordion] Browser auth window does not open
>
> Ensure your IDE or CLI can open a browser. Check firewall or security software that might block browser launch. For Enterprise Edition with SSO, verify that `ENDOR_MCP_SERVER_AUTH_MODE` and `ENDOR_MCP_SERVER_AUTH_TENANT` are set correctly in your MCP configuration.

> [accordion] npx times out behind a corporate proxy
>
> Install endorctl using your preferred method and configure the MCP server to call it directly instead of using npx. In the Enterprise Edition install wizard, select **No** under **Using npx?** to generate the correct configuration. Alternatively, replace the `command` and `args` entries in your MCP configuration manually, using your client's configuration format.
>
> ```json JSON theme={null}
> "command": "endorctl",
> "args": ["ai-tools", "mcp-server"]
> ```
>
> ```toml Codex config.toml theme={null}
> command = "endorctl"
> args = ["ai-tools", "mcp-server"]
> ```
>
> For installation options, see [Install endorctl](https://docs.endorlabs.com/setup-deployment/cli.md). For more details on how npx and a system-installed endorctl differ, see the FAQ entry below.

> [accordion] Understanding npx vs. a system-installed endorctl
>
> The default MCP server configuration uses `npx -y endorctl` to run endorctl. This command downloads endorctl from the npm registry into a temporary cache (`~/.npm/_npx/`) and runs it from there. It does **not** install endorctl globally and does **not** interact with any existing endorctl binary on your system.
>
> If you have endorctl installed separately (for example, through Homebrew or a direct download), the `npx` command runs its own copy and ignores the system-installed version. These two copies are completely independent.
>
> To use your existing endorctl installation instead of npx, select **No** under **Using npx?** in the Enterprise Edition install wizard. This generates a configuration that calls `endorctl` directly, in your client's configuration format.
>
> ```json JSON theme={null}
> "command": "endorctl",
> "args": ["ai-tools", "mcp-server"]
> ```
>
> ```toml Codex config.toml theme={null}
> command = "endorctl"
> args = ["ai-tools", "mcp-server"]
> ```
>
> With this approach, updates are managed by your existing package manager (for example, `brew upgrade endorctl`).

> [accordion] Tools return errors (Enterprise)
>
> Verify your namespace is correct and your user has `Read-Only` permissions in Endor Labs. See [Authorization policies](https://docs.endorlabs.com/platform-administration/rbac/authorization-policies.md) for details. Also ensure endorctl is on your PATH if you installed it globally instead of using npx.

> [accordion] MCP server fails to start on Windows
>
> On Windows, ensure the following prerequisites are met:
>
> * Node.js is installed
> * npm global bin directory is in your PATH
>
> #### Install Node.js
>
> If Node.js is not installed, download and install the **LTS version** from [nodejs.org](https://nodejs.org/). During installation, ensure the option to add Node.js to PATH is selected.
>
> #### Configure the PATH environment variable
>
> After installing Node.js, verify that the npm global bin directory is in your PATH:
>
> 1. Run the following command in the command line.
>
>    ```powershell theme={null}
>    npm config get prefix
>    ```
>
>    This returns the npm global directory path, typically `C:\Users\<YourUsername>\AppData\Roaming\npm`.
>
> 2. Add the npm global directory path to the **Path** variable under **User variables** in your system's environment variables settings.
>
> 3. Restart for the PATH changes to take effect.
>
> #### Verify the setup
>
> Run the following command in your terminal.
>
> ```powershell theme={null}
> npx --version
> ```
>
> If this returns a version number, your Windows setup is complete and the MCP server can use `npx` to run endorctl.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.