Skip to main content
Security 2026-07-04

MCP Session Risk Scoring: Stop Runaway AI Agents Before They Do Damage

MCP Trail

MCP Trail Team

Security Team

MCP Session Risk Scoring: Stop Runaway AI Agents Before They Do Damage

MCP Session Risk Scoring: Stop Runaway AI Agents Before They Do Damage

Most MCP security is per-call: this tool is allowed, that one is denied. But look at how agent incidents actually unfold and you’ll rarely find one obviously-bad call. You find a session that went bad gradually — an agent that reads one file (fine), then ten (fine?), then sixty, then opens an outbound message tool. A prompt-injected assistant that mixes harmless lookups with a slowly escalating pattern of writes. A retry loop hammering a delete tool at 3am. Every individual call passes the allowlist; the sequence is the attack.

Session risk scoring closes that gap. It’s a rolling behavioral score computed over each session’s recent tool calls at the gateway — and when the session’s behavior crosses your threshold, MCP Trail steps in: log it, block the call, or hold it for human approval. Here’s how it works and how to turn it on for your servers.

How the score works

  • Every tool call adds weight. You assign each tool a semantic level — Ignore, Low, Medium, or High — and unknown tools get a default weight, so a server that suddenly grows new tools doesn’t slip through unscored.
  • The score rolls over a window of the session’s recent calls, so it tracks current behavior: a burst of high-risk activity raises it fast, and it can’t be laundered by padding the window with harmless calls.
  • Sequences count, not just totals. Optional category transition rules add extra risk when one class of tool follows another — the classic read-sensitive-data → send-something-external escalation that per-tool rules can’t see.
  • Crossing the threshold triggers your chosen response. In Monitor mode it’s logged; in Enforce mode the call is denied with an explicit 403 or parked in the approval queue.

Denials are explainable: the audit trail shows which session crossed which threshold and what contributed — an answer for the developer whose agent got stopped, not just a mystery 403.

Step 1: Create your free MCP Trail account

Session risk scoring is a gateway feature, so traffic has to flow through one. Sign up at app.mcptrail.com and add a server — from the marketplace or by fronting your existing server’s URL.

Step 2: Turn on the Session risk score

Open your server under Guardian servers and find the Session risk score card. Pick a sensitivity preset:

  • Conservative — a long window and high threshold; only sustained high-risk behavior trips it
  • Balanced — the default starting point
  • Strict — short window, low threshold; escalation gets caught early
  • Custom — set the threshold and window yourself once you’ve seen your traffic

Start in Monitor mode. Nothing gets blocked yet — you’re collecting evidence about what normal looks like.

The Session risk score card with mode and sensitivity preset

Step 3: Level your tools

Walk your server’s tool list and assign levels: read-only lookups Low (or Ignore), writes Medium, and destructive or outbound tools — deletes, shell-like operations, anything that sends data out — High. This five-minute pass encodes your actual risk model; the presets handle the math.

Assigning Ignore/Low/Medium/High levels to tools

Step 4 (optional): Add sequence rules

If your threat model includes exfiltration-shaped behavior, tag tools with categories (e.g. sensitive-read, external-send) and add a transition rule that boosts risk when the second follows the first. One rule catches the pattern that a hundred per-tool policies can’t.

Step 5: Test with the built-in preview

The policy editor includes a live preview: compose a hypothetical sequence of tool calls and watch the score accumulate — and see exactly where it would cross the threshold and what would happen (deny vs. approval queue). Tune the preset until the sequences you fear trip it and normal workflows don’t.

The risk preview simulating a sequence of tool calls against the policy

Step 6: Watch Monitor mode, then flip to Enforce

Run in Monitor for a few days and check the Audit log for risk_monitor events — sessions that would have been stopped. If those are the sessions you’d want stopped, switch the card to Enforce and choose the response:

  • Deny tool call (403) — hard stop, with the explainable reason in the audit record (blocked_risk_score)
  • Send to approval queue — the risky call pauses for a human decision in the Approval queue; the session continues only if someone signs off

Audit log entries showing risk_monitor and blocked_risk_score events

Try it without a server

Want to feel how the scoring behaves before wiring anything up? The free MCP playground includes a session risk calculator — throw tool sequences at it and watch the score move.

FAQ

How is this different from rate limiting?

Rate limits count calls; risk scoring weighs them. Sixty harmless lookups can be fine while six destructive calls in the same window are not — a rate limit can’t tell those apart, a weighted score can. Use both: they catch different failure modes.

Will normal heavy usage trip it?

Not if your levels are honest: a session doing hundreds of Low-weight reads stays under a Balanced threshold. That’s also exactly what Monitor mode is for — validate against your real traffic before anything blocks.

What does the agent see when a call is denied?

An explicit policy error (403) rather than a silent failure, so the model can tell the user it was stopped — and the audit record explains which threshold the session crossed.

Is the score global or per server?

Per session, per server — each server has its own policy, window, and metrics, so a chatty but harmless server doesn’t inflate risk on a sensitive one.

Your agents’ worst sessions won’t announce themselves one bad call at a time. Create your free MCP Trail account, turn on Monitor mode, and see what your sessions are really doing.

Share this article