Skip to content
MCP server

Margin

Tests a model or prompt change against your own evals before an agent ships it

Margin is a paid MCP server for ai models and llm tooling. It runs as a hosted remote server, so there is nothing to install locally.

Pricing
Paid
Platforms
API, CLI, Web
Runs
Remotely
What it can do
Can change data (1 tool)
Version
0.2.0
Listing updated

Similar MCP servers

Install

Add with the CLI

Run in a terminal

claude mcp add --transport http margin 'https://trymargin.io/api/mcp?tools=core'

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "margin": {
      "type": "http",
      "url": "https://trymargin.io/api/mcp?tools=core"
    }
  }
}

Claude Code setup guide

In Customize → Connectors → Add → Add custom connector

https://trymargin.io/api/mcp?tools=core

Paste this URL, choose how to sign in, then click Add and Connect. On Team and Enterprise an Owner adds it in Organization settings → Connectors.

Claude Desktop setup guide

Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "margin": {
      "url": "https://trymargin.io/api/mcp?tools=core"
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "margin": {
      "type": "http",
      "url": "https://trymargin.io/api/mcp?tools=core"
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

In chatgpt.com → Plugins → + → Add custom MCP server

https://trymargin.io/api/mcp?tools=core

Paste this URL, set up sign-in, accept the warning and install the plugin. Then type @ in a chat to use it.

ChatGPT setup guide

Add with the CLI

Run in a terminal

codex mcp add margin --url 'https://trymargin.io/api/mcp?tools=core'

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.margin]
url = "https://trymargin.io/api/mcp?tools=core"

Codex setup guide

Add to Grok Bot desktop app → Connect apps → Add a custom connector

https://trymargin.io/api/mcp?tools=core

Enter a Name (for example "Margin"), choose Type: Remote HTTPS, paste this as the Server URL and choose Add plugin.

Full Grok Bot setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "margin": {
      "type": "http",
      "url": "https://trymargin.io/api/mcp?tools=core"
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "margin": {
          "httpUrl": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Or run: gemini mcp add -s user --transport http margin 'https://trymargin.io/api/mcp?tools=core'

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "margin": {
          "serverUrl": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "margin": {
          "url": "https://trymargin.io/api/mcp?tools=core",
          "transport": "http"
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "margin": {
          "type": "streamableHttp",
          "url": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "margin": {
          "url": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "margin": {
          "url": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "margin": {
          "url": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "margin": {
          "url": "https://trymargin.io/api/mcp?tools=core"
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

About Margin

Margin is a measurement service for teams running LLM agents who want to know what each workflow costs per completed outcome. It meters model calls, either through a Python or TypeScript SDK, OpenRouter broadcast, or by recording replies from plain HTTP clients, and pairs that spend with outcomes you define, such as a merged pull request or a passed eval.

The headline use is checking a change before it reaches production. A model swap or prompt edit is replayed against your existing eval cases, and the gate reports whether the candidate holds quality at a lower cost. Margin publishes a promote, hold or revert decision, but your code decides whether to act on it, since there is no runtime routing endpoint.

The product is aimed at engineering and finance leads with agents already in production. It offers an MCP server so coding assistants and scheduled agents can query spend, blind spots and face-off results, with a separate agent key that can request tests within a spend limit.

Tools this server provides (9)

Taken from the project documentation; the running server may differ.

From the tool list in its README, going by the names, 1 of 9 tools changes data; 7 names don't say.

From the server's own tool labels and tool names; not verified by us.

margin_portfolio_summary
How many projects exist and how many emit real economics
margin_portfolio_economics
Cross-project spend, cost-per-outcome and savings at stake
margin_fix_this_first
Ranked highest-impact opportunities across the estate
margin_list_projectsName suggests: reads
Every project and its connection state
margin_project_economics
One project's spend, cost-per-outcome, token yield and retry tax
margin_parity_prior
For a task class, how often a cheaper model has held parity
margin_optimize
Every move Margin can name for a project, ranked by basis
margin_test_moveName suggests: changes
Agent key only: test one listed move on your evals within the key's spend limit
margin_test_model
Agent key only: face off one named model on your evals

What it does

Model call metering
Records token counts, cost, request hashes and retry signals from OpenAI, Anthropic, Gemini and litellm calls without proxying requests.
Cost per outcome
Divides measured spend by outcomes you define, such as passed evals or merged changes, per workflow.
Eval adapters
Reads results from promptfoo, Braintrust, LangSmith, Ragas, deepeval, Langfuse, pytest and vitest or jest.
Model replay gate
Replays an eval dataset on a current and candidate model and returns a promote, hold or revert verdict.
MCP server for agents
Exposes read tools for spend, recommendations and blind spots, plus an agent key for requesting tests within a set limit.
OpenRouter broadcast
Accepts OpenRouter traces via an OpenTelemetry endpoint so calls can be metered without the SDK.

Good for

  • Check whether a cheaper model holds quality on your existing eval cases before switching
  • Track which agent workflows drive the largest share of LLM spend
  • Compare cost per completed task before and after a prompt or system change
  • Let a scheduled coding agent open a pull request only when a candidate change passes the gate
  • Find unmetered model call sites in a repository before a bill arrives

Pricing

Paid, from $2,000 a month

Free tier with 2 runs; Pilot $2,000 once for 45 days; Production $2,000 per month flat

Prices change. Check trymargin.io before you buy.

Margin FAQ

Does Margin sit in the request path?

No. Agents call model providers directly and the SDK reads token counts after the response returns. Emits do not raise into the request path.

What does the free plan include?

Two measurement runs on one repository and up to $100 of measurement inference, paid by Margin, once per account.

Is Margin's MCP server read-only?

The ingest key reads only. An agent key can request a test within its spend limit, and opening pull requests happens only in the console.

Does Margin change my model routing?

No. It publishes decisions and your code applies them or ignores them.

How do I add Margin to Claude Code?

Run this command in your terminal: claude mcp add --transport http margin 'https://trymargin.io/api/mcp?tools=core'

What are the best alternatives to Margin?

The closest alternatives to Margin are LLM Margin, SentioGate FinOps & LLM Router, Plzebo, LLM Prover and Agentcents.

Where this comes from

  • Description: written from the project's website and its MCP Registry entry.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers