Endor Labs MCP server in IntelliJ IDEA

Learn how to deploy and run the Endor Labs MCP server in IntelliJ IDEA with GitHub Copilot.
Beta

The Endor Labs MCP server helps developers and AI agents in the following ways:

  • Provide guardrails for agents before code review: Reduce the number of known vulnerabilities entering your code and save developers time by checking AI agent suggestions in real time. Integrate security before an issue is discovered in CI or in production.
  • Improve the speed of remediating security risks: Agents use vulnerability context from Endor Labs to help implement secure changes, from writing more secure code to upgrading dependencies.

The Endor Labs MCP server integrates directly into IntelliJ IDEA to scan your code as you write, catching security issues before they reach production.

The following sections walk you through setting up the Endor Labs MCP server:

Ensure that the following prerequisites are met:

Use the interactive configuration tool to set up the MCP server. The tool supports both the Developer Edition and the Enterprise Edition. Select your edition from the dropdown, configure your settings, and follow the instructions.

Already have endorctl configured?
Entering edition or namespace details in the configuration tool when you already have a local Endor Labs configuration from a previous endorctl init causes conflicts. Select Use pre-existing configuration if available, or follow the manual setup instructions below and add "ENDOR_TOKEN": "automatic" to reuse your existing configuration.

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. 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 for setup instructions.

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

The Endor Labs MCP server has two editions:

  • Developer Edition: A free edition that requires no configuration. A browser window opens on first use for authentication via GitHub, GitLab, or Google. The Developer Edition provides access to default security policies from Endor Labs.
  • Enterprise Edition: A paid edition that enforces your organization’s specific security policies. Authenticate using GitHub, GitLab, Google, or SSO. You must specify your namespace to access your organization’s policies.

Additionally, if you already have Endor Labs configured locally (for example, from a previous endorctl init command), the MCP server can use your pre-existing configuration.

The Endor Labs MCP server works out of the box with the Developer Edition. When you use the MCP server for the first time, a browser window opens, and you can authenticate with GitHub, GitLab, or Google. After authentication, the MCP server provides access to the free Developer Edition with the default security policies.

Support
Have questions? Email us at community-support@endor.ai.

You can use the interactive setup tool above or set up the MCP server manually.

If you prefer to configure the MCP server manually:

  1. Open GitHub Copilot Chat from the right sidebar.

  2. Switch to Agent mode.

  3. Click Configure Tools.

  4. Select + Add More Tools… from the bottom left corner to open the mcp.json file.

  5. Add the following configuration to the mcp.json file.

    {
      "servers": {
        "endor-cli-tools": {
          "command": "npx",
          "args": [
            "-y",
            "endorctl",
            "ai-tools",
            "mcp-server"
          ]
        }
      }
    }
    
Already have endorctl configured?
If you already have a local Endor Labs configuration from a previous endorctl init, add "ENDOR_TOKEN": "automatic" to the env section. The MCP server reuses your existing configuration without requiring additional setup.
  1. Save and close the mcp.json.

  2. Switch from Agent to Ask mode in the chat and then back to Agent mode to reload the MCP server.

  1. In the GitHub Copilot Chat, switch to Agent mode.

  2. Click Configure Tools and confirm that endor-cli-tools appears in the list.

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

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.

For Enterprise Edition, you need your organization’s Endor Labs namespace and an authentication method. Ensure that your developers have Read-Only permissions to Endor Labs. See Authorization policies for more details.

You can use the interactive setup tool above or set up the MCP server manually.

  1. Open GitHub Copilot Chat from the right sidebar.

  2. Switch to Agent mode.

  3. Click Configure Tools.

  4. Select + Add More Tools… from the bottom left corner to open the mcp.json file.

  5. Add the following configuration to the mcp.json file.

    {
      "servers": {
        "endor-cli-tools": {
          "command": "npx",
          "args": [
            "-y",
            "endorctl",
            "ai-tools",
            "mcp-server"
          ],
          "env": {
            "ENDOR_NAMESPACE": "<namespace>",
            "ENDOR_MCP_SERVER_AUTH_MODE": "<google|github|gitlab|sso>",
            "ENDOR_TOKEN": "automatic"
          }
        }
      }
    }
    

    Replace <namespace> with your Endor Labs namespace and choose your authentication mode. If you choose sso, you must also add ENDOR_MCP_SERVER_AUTH_TENANT to the env section.

    The following parameters are used to configure the MCP server. All parameters are optional. If no parameters are provided, the MCP server defaults to the Developer Edition with browser authentication.

    • ENDOR_MCP_SERVER_AUTH_MODE: (Optional) The authentication mode to use for the MCP server. You can use the following authentication modes: github, gitlab, google, sso. If you choose sso, you must add ENDOR_MCP_SERVER_AUTH_TENANT as an additional parameter. If not specified, the MCP server defaults to browser authentication for the Developer Edition.
    • ENDOR_NAMESPACE: (Optional) The namespace to use for the MCP server. Required for Enterprise Edition to access your organization’s specific policies. Not needed for Developer Edition.
    • ENDOR_TOKEN: (Optional) Set to automatic to reuse an existing local endorctl configuration. When set to automatic, the MCP server skips browser authentication and uses your stored credentials. Do not set this to any other value; the MCP server manages the token internally during authentication.
    • ENDOR_MCP_SERVER_AUTH_TENANT: (Optional) The tenant name for SSO authentication. Required when ENDOR_MCP_SERVER_AUTH_MODE is set to sso for Enterprise Edition access.
  6. Save and close the mcp.json.

  7. Switch from Agent to Ask mode in the chat and then back to Agent mode to reload the MCP server.

  8. Click Configure Tools and select endor-cli-tools.

  1. In the GitHub Copilot Chat, switch to Agent mode.

  2. Click Configure Tools and confirm that endor-cli-tools appears in the list.

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

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.

Set up Copilot rules in .github/instructions/*.md to use the Endor Labs MCP server throughout the development process. See Add repository custom instructions for GitHub Copilot for more details.

Copilot instructions define the guidelines that Copilot should follow throughout the development process. The following examples demonstrate how to use the Endor Labs MCP server within Copilot rules.

---
description: "Dependency vulnerability scanning using Endor Labs via MCP server integration"
applyTo: '**/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'

---

# Software Composition Analysis (SCA) Rule (Endor Labs via MCP)
This project uses Endor Labs for automated dependency (SCA) scanning, integrated through the MCP server as configured in `mcp.json`.

## Workflow

Every time a manifest or lockfile listed above is created or modified in any way immediately do the following prior to performing your next task.

**Important**: Do not proceed after creating or modifying a manifest file without running this first. Do not write any other code or continue with your existing prompt. This is top priority whenever a manifest file is created or updated.

- Run `endor-cli-tools` using the `check_dependency_for_vulnerabilities` tool via the MCP server.
- Provide the **ecosystem**, **dependency name**, and **version** always when making this tool call. Do not forget to provide a version.
- 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.
- Re-run the check using `endor-cli-tools` to confirm the issue is resolved.
- 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 `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.
---
description: "Scan for leaked secrets on file modification using Endor Labs via MCP server integration"
applyTo: '**/*'

---

# Leaked Secrets Detection Rule (Endor Labs via MCP)
This project uses [Endor Labs](https://docs.endorlabs.com/) for automated security scanning, integrated through the MCP server as configured in `mcp.json`.

## Workflow
Whenever a file is modified in the repository, and before the end of an agent session:
- Run `endor-cli-tools` using the `scan` tool via the MCP server to check for leaked secrets.
- Ensure the scan includes all file types and respects `.gitignore` unless otherwise configured.
- 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.
- 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.
- 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 `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.
---
description: "Static Application Security Testing (SAST) using Endor Labs via MCP server integration"
applyTo: '**/*.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'

---

# Static Application Security Testing (SAST) Rule (Endor Labs via MCP)

This project uses [Endor Labs](https://docs.endorlabs.com/) for automated SAST, integrated through the MCP server as configured in `mcp.json`.

## Workflow

Whenever a file is modified in the repository, and before the end of an agent session perform the following workflow:

- Run `endor-cli-tools` using the `scan` tool via the MCP server to perform SAST scans as described above.
- 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.
- 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.
- 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 `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.

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

MCP server shows as disconnected or errored
  • Verify Node.js and npx are available: run npx --version in your terminal. If the command fails, install Node.js version 18 or later.
  • Restart your IDE or CLI to reload the MCP server configuration.
  • Check your config for syntax errors. Use a JSON or TOML validator, or switch to the configuration tool or CLI command instead of manual editing.
Authentication browser 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, confirm ENDOR_MCP_SERVER_AUTH_MODE is set correctly (google, github, gitlab, or sso). For SSO, ensure ENDOR_MCP_SERVER_AUTH_TENANT is provided.
endorctl download times out

If npx -y endorctl hangs or times out (for example, behind a corporate proxy or firewall), install endorctl globally and update your MCP config to use it. For more information, see Install endorctl.

After installing endorctl, update your MCP config to call endorctl directly instead of npx.

Replace the command and args entries with:

"command": "endorctl",
"args": ["ai-tools", "mcp-server"]

Alternatively, configure your proxy settings for npm.

Tools return errors when invoked
  • If you are using the Enterprise Edition, verify whether your namespace is correct and that your user has Read-Only permissions. See Authorization policies for details.
  • Ensure endorctl is on your PATH if you installed it globally instead of using npx.
  • Check that the working directory or project path is valid when invoking tools.
Config file has a syntax error and the IDE gives no useful message
IDEs often fail silently on invalid configuration. Validate your config file (for example, .cursor/mcp.json, .vscode/mcp.json, .mcp.json, or .codex/config.toml) with a JSON or TOML linter. Alternatively, use the configuration tool or CLI command for your platform instead of editing the file manually.

On Windows, ensure the following prerequisites are met:

If Node.js is not installed, download and install the LTS version from nodejs.org. During installation, ensure the option to add Node.js to PATH is selected.

After installing Node.js, verify that the npm global bin directory is in your PATH:

  1. Run the following command in the command line.

    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.

Run the following command in your terminal.

npx --version

If this returns a version number, your Windows setup is complete and the MCP server can use npx to run endorctl.