Tests a model or prompt change on your own evals and says if it holds, before your agent ships it.
Maintain this server? Claim it
Call this server's tools from your browser. Nothing to install.
Your project's ingest key (mgk_...), from trymargin.io/start, sent as a bearer token. Reads only.
Requests go through mcptry because browsers can't call most MCP servers directly. Header values are sent to the server for that request only and are never stored or logged.
Tool list from our last check. Connect live to refresh it.
Hand a narrower agent key to another agent: a boss agent to a department agent, a department agent to one agent. Pass a spend limit (taken out of YOUR key's limit), an optional label, an optional list of agent files it may test (inside your own scope), whether it may hand out keys in turn, and how many hours it lives (default 24, never past your own key's expiry). Returns the new key ONCE. Only a key a person allowed to delegate can do this. Revoking a key revokes every key it handed out.
the new key's limit, in USD
who it is for, e.g. 'billing department'
agent files it may test; omitted keeps your own scope
hours until it stops working; default 24, max 168
whether it may hand out keys in turn
This tool isn't marked read-only, so it may change something on the server or in an account you connected.
Pick your client. Values in capitals, like YOUR_TOKEN, are yours to fill in.
Run in a terminal
claude mcp add --transport http margin 'https://trymargin.io/api/mcp?tools=core' \ --header 'Authorization: Bearer YOUR_TOKEN'
Headers
Authorization (required): Your project's ingest key (mgk_...), from trymargin.io/start, sent as a bearer token. Reads only.Hand a narrower agent key to another agent: a boss agent to a department agent, a department agent to one agent. Pass a spend limit (taken out of YOUR key's limit), an optional label, an optional list of agent files it may test (inside your own scope), whether it may hand out keys in turn, and how many hours it lives (default 24, never past your own key's expiry). Returns the new key ONCE. Only a key a person allowed to delegate can do this. Revoking a key revokes every key it handed out.
| Argument | Type | Description |
|---|---|---|
| label | string | who it is for, e.g. 'billing department' |
| agents | array | agent files it may test; omitted keeps your own scope |
| ttl_hours | number | hours until it stops working; default 24, max 168 |
| can_delegate | boolean | whether it may hand out keys in turn |
| spend_limit_usd* | number | the new key's limit, in USD |
{
"type": "object",
"required": [
"spend_limit_usd"
],
"properties": {
"label": {
"type": "string",
"description": "who it is for, e.g. 'billing department'"
},
"agents": {
"type": "array",
"items": {
"type": "string"
},
"description": "agent files it may test; omitted keeps your own scope"
},
"ttl_hours": {
"type": "number",
"description": "hours until it stops working; default 24, max 168"
},
"can_delegate": {
"type": "boolean",
"description": "whether it may hand out keys in turn"
},
"spend_limit_usd": {
"type": "number",
"description": "the new key's limit, in USD"
}
},
"additionalProperties": false
}When the fit check says your cases cannot be graded (free-text answers, common for support, ops and finance agents): pass what the agent is for (`task`, with its rules written out, e.g. 'never offer a coupon') and up to 20 real outputs (`samples`). Margin drafts pass/fail checks, code checks first, and shows which samples each one fails. Drafts only: a named person on your team accepts each in the console before it grades anything. Free, except an optional AI pass that uses the project's daily console allowance. Needs the project's key.
| Argument | Type | Description |
|---|---|---|
| task* | string | what the agent is for, with its rules |
| samples* | array | 1 to 20 real outputs of the agent |
{
"type": "object",
"required": [
"task",
"samples"
],
"properties": {
"task": {
"type": "string",
"description": "what the agent is for, with its rules"
},
"samples": {
"type": "array",
"items": {
"type": "string"
},
"description": "1 to 20 real outputs of the agent"
}
},
"additionalProperties": false
}YOUR project's latest measured run, every face-off queued against it with its status and verdict, and the post-merge watch on each change you registered (holding, slipped, or still waiting for graded outcomes). Pull requests open from the console only, because that click is your approval. Needs the project's ingest key.
No arguments.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Before spending anything: can YOUR eval set prove a model switch? Pass the export's text (a promptfoo results file, a Braintrust or LangSmith dataset export, or JSONL of {input or messages, expected, check}). Returns how many cases Margin can grade (exact label, contains, regex or a JSON field; LLM-rubric cases are counted but not graded), how many the 97% switch bar needs, and how many cases a new model may lose and still be promoted. Free and instant. Needs the project's key.
| Argument | Type | Description |
|---|---|---|
| dataset* | string | the export's text |
{
"type": "object",
"required": [
"dataset"
],
"properties": {
"dataset": {
"type": "string",
"description": "the export's text"
}
},
"additionalProperties": false
}Where YOUR project's money goes, per job: each model-calling step over the last 30 days with its calls, cost, live model and whether any eval has exercised it, plus how concentrated the spend is in the top 5/10/20 jobs. A job is labelled 'code and traffic', 'traffic only' or 'code only', never dropped. No per-job outcomes: outcomes are recorded per workflow. Also carries VALUE PER OUTCOME where the person set one (in their own unit, and dollars only at a stated rate); every other job is cost per outcome. Needs the project's key.
No arguments.
{
"type": "object",
"properties": {},
"additionalProperties": false
}YOUR agent key: its spend limit, how much is reserved, which agents it covers, and the keys it has handed out to other agents. Needs an agent key.
No arguments.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Every move Margin can name for YOUR project, ranked, each labelled by its basis: measured (a face-off ran), detected, prior, or untested. A 'pr' move is a setting a face-off can test; a 'structural' one needs a person. Reads only: queueing a face-off spends the project's measurement allowance, so it happens in the console (queue_in) or through margin_test_move with an agent key, never through this tool. Needs the project's ingest key.
No arguments.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Replay YOUR eval dataset against a candidate model, with no repo run: each case goes to `baseline` and `candidate` with the same messages (and the same structured-output schema, when the case has one), is graded by the case's own check, and the two are compared case by case by Margin's parity gate. Returns the verdict: promoted only when the candidate holds the pass rate at the bar AND costs less per case; otherwise the reason. Cases go only to zero-retention hosts and are not stored. The answer leads with a headline: the saving a year at `monthly_calls` (proven only when promoted), the cases the candidate lost and how many cases would settle a hold, or what an upgrade costs per extra case it gets right. `measure_noise` also runs your current model twice to show how far your suite moves on its own. `candidate_system` tests a prompt change instead of (or with) a model change; each prompt tried counts as its own candidate. Spends up to `cap_usd` (max 10) of your AGENT key's limit, and gives back what it did not use. At most 300 cases per call, and a call stops at 4 minutes, says so and is not promoted: 200 cases took 2.7 to 4.4 minutes, so a slow candidate on a large set stops early; run that one with margin-referee.
| Argument | Type | Description |
|---|---|---|
| cap_usd* | number | the most this replay may spend |
| dataset* | string | the export's text |
| baseline | string | the model in use, e.g. openai/gpt-4.1 |
| candidate | string | the model to test |
| measure_noise | boolean | optional: also run the current model twice |
Ask Margin to face off ONE model you name (an OpenRouter slug such as openai/gpt-4.1-mini, or a release from this week) against YOUR project's latest measured run, on your own evals, in Margin's sandbox. Optionally name one `agent` to swap only its calls. Refused, with the reason, when the catalogue does not list the model, it has a retirement date, no host the project may use serves it, or it is the model already in use. The promotion gate decides: a cheaper model is promoted only when the pass rate holds at the bar; a pricier one is reported as an upgrade with what it costs. Read the verdict with margin_faceoff_status. Spends within your key's limit and the project's measuring budget; asking twice does not pay twice. Needs an AGENT key on /api/mcp/agent.
| Argument | Type | Description |
|---|---|---|
| agent | string | optional: swap only this agent's calls |
| model* | string | the model to test, e.g. openai/gpt-4.1-mini |
{
"type": "object",
"required": [
"model"
],
"properties": {
"agent": {
"type": "string",
"description": "optional: swap only this agent's calls"
},
"model": {
"type": "string",
"description": "the model to test, e.g. openai/gpt-4.1-mini"
}
},
"additionalProperties": false
}Ask Margin to TEST one move on YOUR project: a cheaper model, an output cap or a host pin, exactly as a move listed by margin_optimize (pass its level, target and lever). Margin re-runs your own evals with the move applied, in its sandbox, on your latest measured run, and its promotion gate decides: promoted only when the pass rate holds at the bar AND it is cheaper, otherwise refused with the reason (too few cases, quality slipped, the baseline does not stand in for production). Returns the queued run id or a named refusal; read the verdict with margin_faceoff_status. Spends within the project's measuring budget, capped per run, and asking twice does not pay twice. It never changes your code: the pull request opens from the console, which is your approval. Needs an AGENT key (mak_, created in the console with a spend limit) on /api/mcp/agent; the ingest key is refused.
| Argument | Type | Description |
|---|---|---|
| level* | string | the move's level, from margin_optimize |
| lever* | string | the move's lever, from margin_optimize |
| target* | string | the move's target, from margin_optimize |
{
"type": "object",
"required": [
"level",
"target",
"lever"
],
"properties": {
"level": {
"type": "string",
"description": "the move's level, from margin_optimize"
},
"lever": {
"type": "string",
"description": "the move's lever, from margin_optimize"
},
"target": {
"type": "string",
"description": "the move's target, from margin_optimize"
}
},
"additionalProperties": false
}We read every tool's name, description and inputs the way the model will, looking for instructions hidden from you. A clean result means no warning signs, not a guarantee. Scanned Nov 26, 2026.
No readOnlyHint / destructiveHint annotations, so clients can't tell a read from a write without asking.
Fix: Add annotations to each tool, e.g. { readOnlyHint: true } for tools that only read.
| monthly_calls | number | optional: calls this step makes a month |
| candidate_system | string | optional: test a prompt change. The candidate runs with this as its whole system prompt; the candidate model may equal the baseline |
| baseline_endpoint | object | optional: a model in YOUR account, called with your credential for this replay only (never stored) and priced at your rate. kind: openai_compatible (base_url, model, api_key; also your own OpenRouter key at https://openrouter.ai/api/v1), azure_openai (resource, deployment, api_key, api_version), vertex_ai (project, region, model, access_token), bedrock (region, model, api_key: a Bedrock API key). price: {input_per_mtok, output_per_mtok} in USD, required. |
| candidate_endpoint | object | optional: a model in YOUR account, called with your credential for this replay only (never stored) and priced at your rate. kind: openai_compatible (base_url, model, api_key; also your own OpenRouter key at https://openrouter.ai/api/v1), azure_openai (resource, deployment, api_key, api_version), vertex_ai (project, region, model, access_token), bedrock (region, model, api_key: a Bedrock API key). price: {input_per_mtok, output_per_mtok} in USD, required. |
{
"type": "object",
"required": [
"dataset",
"cap_usd"
],
"properties": {
"cap_usd": {
"type": "number",
"description": "the most this replay may spend"
},
"dataset": {
"type": "string",
"description": "the export's text"
},
"baseline": {
"type": "string",
"description": "the model in use, e.g. openai/gpt-4.1"
},
"candidate": {
"type": "string",
"description": "the model to test"
},
"measure_noise": {
"type": "boolean",
"description": "optional: also run the current model twice"
},
"monthly_calls": {
"type": "number",
"description": "optional: calls this step makes a month"
},
"candidate_system": {
"type": "string",
"description": "optional: test a prompt change. The candidate runs with this as its whole system prompt; the candidate model may equal the baseline"
},
"baseline_endpoint": {
"type": "object",
"description": "optional: a model in YOUR account, called with your credential for this replay only (never stored) and priced at your rate. kind: openai_compatible (base_url, model, api_key; also your own OpenRouter key at https://openrouter.ai/api/v1), azure_openai (resource, deployment, api_key, api_version), vertex_ai (project, region, model, access_token), bedrock (region, model, api_key: a Bedrock API key). price: {input_per_mtok, output_per_mtok} in USD, required."
},
"candidate_endpoint": {
"type": "object",
"description": "optional: a model in YOUR account, called with your credential for this replay only (never stored) and priced at your rate. kind: openai_compatible (base_url, model, api_key; also your own OpenRouter key at https://openrouter.ai/api/v1), azure_openai (resource, deployment, api_key, api_version), vertex_ai (project, region, model, access_token), bedrock (region, model, api_key: a Bedrock API key). price: {input_per_mtok, output_per_mtok} in USD, required."
}
},
"additionalProperties": false
}