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

# Earnie MCP

> What Earnie's MCP server is, how it connects an AI coding agent to your Earnie projects and policies, which clients are supported, and what you need before you set it up.

**MCP** (Model Context Protocol) is an open standard that lets an AI coding agent call tools on an external service. Earnie runs an MCP server, so a coding agent such as Claude Code, Cursor, VS Code, or Codex can ask Earnie questions and check its own work while it writes code.

With Earnie connected, an agent can:

* read the policies in force for your project, and follow them as it works
* check the code it has just written against those policies, before showing it to you
* look up a project's findings, posture, and merge gate
* export a project's bill of materials
* record a triage decision you've asked it to make, if you allow it

This moves your policies to the earliest point in a change: while the code is being written, before it's committed or reaches a pull request.

## How It Fits Together

Three parts are involved:

| Part                    | What It Is                                                                                                                               |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Your AI client**      | The coding agent you work with, for example Claude Code in your terminal or Copilot in VS Code.                                          |
| **Earnie's MCP server** | Part of your Earnie deployment, at `<your Earnie address>/mcp/v1`. It offers a set of **tools**, each one a specific question or action. |
| **An API key**          | The credential the client sends with every request. It decides which tools the agent can see, and which projects it can reach.           |

```mermaid theme={null}
flowchart LR
    You(["<span style='color:#0B1F3A'>You</span>"]) --> AC

    subgraph AC["<span style='color:#0B1F3A'>Your AI Client</span>"]
        direction TB
        A1["Claude Code, Cursor,<br/>VS Code, or Codex"]
    end

    AC --> ED

    subgraph ED["<span style='color:#0B1F3A'>Your Earnie Deployment</span>"]
        direction TB
        B1["MCP Server<br/>/mcp/v1"] --> B2["Projects, Findings,<br/>and Policies"]
    end

    style You fill:#fff,stroke:#0B1F3A,color:#0B1F3A
    style AC fill:#FFF3EA,stroke:#FF6A1A,color:#0B1F3A
    style ED fill:#FFF3EA,stroke:#FF6A1A,color:#0B1F3A
    style A1 fill:#FF6A1A,stroke:#E85D0F,color:#fff
    style B1 fill:#FF6A1A,stroke:#E85D0F,color:#fff
    style B2 fill:#FF6A1A,stroke:#E85D0F,color:#fff

    linkStyle 2 stroke:#0B1F3A,stroke-width:1px
```

The client sends each tool call to the MCP server over HTTPS, with your API key.

You don't call the tools yourself. You ask the agent something in plain language, such as "is this project blocked?", and the agent decides which Earnie tool to call. [Using Earnie Through MCP](/en/latest/earnie/mcp/tools) lists every tool.

### The Connection and the Repository Setup

Connecting a client to the MCP server gives the agent its tools. If you set up with the [Earnie CLI](/en/latest/earnie/using-earnie/earnie-cli), you also get two things written into your repository:

* **A managed policy block** — your project's policies, written as plain rules into the file your agent reads for instructions, such as `CLAUDE.md` or `AGENTS.md`.
* **Review hooks** — for Claude Code, Cursor, and Codex, an automatic review of the agent's changed files at the end of each turn. Each review is a [Self-check](/en/latest/earnie/using-earnie/self-checks).

[Connecting an AI Client](/en/latest/earnie/mcp/connecting-a-client) explains both routes.

## Supported Clients

| Client                 | Support                                                                                                                                                                                                                                                                       |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Claude Code**        | Supported. Setup with the Earnie CLI also installs review hooks.                                                                                                                                                                                                              |
| **Cursor**             | Supported. Setup with the Earnie CLI also installs review hooks.                                                                                                                                                                                                              |
| **VS Code**            | Supported. No review hooks yet, because VS Code's hook API is in Preview.                                                                                                                                                                                                     |
| **Codex**              | Supported. Setup with the Earnie CLI also installs review hooks, which you must approve inside Codex.                                                                                                                                                                         |
| **Claude.ai, ChatGPT** | Limited. They connect from the vendor's own cloud, so they need an Earnie deployment reachable from the public internet, and they expect OAuth, which Earnie doesn't offer yet. See [Claude.ai and ChatGPT](/en/latest/earnie/mcp/connecting-a-client#claude-ai-and-chatgpt). |

## Before You Start

You need:

* **An Earnie deployment your machine can reach.** Each deployment has its own address, and its MCP server is at that address followed by `/mcp/v1`.
* **A project that has been scanned**, so there's something for the agent to ask about. See [Your First Scan](/en/latest/earnie/getting-started/first-scan).
* **Policies attached to that project**, if you want the agent to follow rules and review its code. See [Setting Policies](/en/latest/earnie/using-earnie/setting-policies).
* **An API key created with the Coding agent (MCP) preset.** Creating one needs the Admin or Operator role. See [Creating a Key](/en/latest/earnie/administration/api-keys#creating-a-key).
* **A supported AI client**, installed on your machine.
* **The Earnie CLI** (optional, but recommended for working in a repository). See [Installing](/en/latest/earnie/using-earnie/earnie-cli#installing).

<Note>
  **What the agent can do depends on the key.** The Coding agent (MCP) preset
  lets the agent read projects, policies, findings, and scans, and submit
  scans. It can't change triage decisions unless you turn on **Allow agents to
  triage findings** when you create the key.
</Note>

## What's Next

Start by [connecting your AI client](/en/latest/earnie/mcp/connecting-a-client) to Earnie.
