Skip to main content
MCP (Model Context Protocol) is an open standard that lets an AI coding agent call tools on an outside 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
  • look up a project’s findings, its posture, and its merge gate: whether Earnie would let the code merge
  • export a project’s bill of materials, from a snapshot Earnie has already made
  • record a triage decision you’ve asked it to make, if the key allows it
The agent learns your policies while it writes the code, so it can avoid a problem before the code is committed, instead of finding out from the pull request check.

How It Fits Together

An MCP connection has three parts: 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 lists every tool, and the key scope each one needs.

When the Agent Checks Its Code

When the agent checks code, Earnie runs a Self-check: a quick check of only the files it’s given. A Self-check creates no findings and never changes the project’s posture. It tells the agent whether those files break a policy, and links to the result in the web app, where it’s kept for 30 days. A Self-check only covers what it was given, so a pass means nothing it checked broke a policy, not that the whole change is clear. The pull request check still decides what merges.

What the Earnie CLI Adds

Connecting a client to the MCP server gives the agent its tools. If you set up with the Earnie CLI, it also sets up your repository:
  • A managed policy block. The CLI writes your project’s policies as plain rules into the file your agent reads for instructions, such as CLAUDE.md or AGENTS.md, so the agent has them from the start of every session.
  • Review hooks. For Claude Code, Cursor, and Codex, a hook sends the agent’s changed files for a Self-check at the end of each turn, without the agent having to ask.
  • A session-start hook. For the same three clients, it refreshes the policy block when your policies change.
Without the CLI, you add Earnie to your client with the install snippet Earnie shows when you create the key. The agent then calls the tools only when it decides to. Connecting an AI client explains both ways.

Supported Clients

Before You Start

You need:
  • An Earnie your machine can reach. Its MCP server is at your Earnie address followed by /mcp/v1, for example https://your-company.earnie.dev/mcp/v1.
  • A project that has been scanned, so the agent has something to ask about. See Your first scan.
  • Policies attached to that project, if you want the agent to follow rules and check its code. See Setting policies.
  • An API key created with the Coding agent (MCP) preset. Admins and Operators can create one. See Creating a key.
  • A supported AI client, installed on your machine.
  • The Earnie CLI, if you work in a repository. It’s optional, but it’s the only way to get the policy block and review hooks. See Installing.
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. Used with the Earnie CLI, the same key can start a full scan that changes the project’s findings, so treat it like a CI key. The agent can’t record triage decisions unless you turn on Allow agents to triage findings when you create the key. The audit log records each decision under the key’s name.

What’s Next

Start by connecting your AI client to Earnie.