DEV Community

Pico
Pico

Posted on

Add Trust Scoring to Your MCP Agent in 5 Minutes

Add Trust Scoring to Your MCP Agent in 5 Minutes

You've got an MCP agent. It connects to tools, makes decisions, takes actions. The question is: does anyone else trust it?

This tutorial walks through adding real trust scoring to your agent using AgentLair — identity infrastructure built for the MCP ecosystem. Not a self-declared "this agent is safe" badge. Actual behavioral telemetry across three dimensions: consistency, restraint, and transparency.

What you'll build:

  • A registered agent identity (email address + API key)
  • MCP server integration in Claude Code or Cursor
  • An embeddable trust badge for your README
  • A trust score that improves as your agent behaves consistently

The whole setup takes about 5 minutes. You don't need a credit card.


Before you start: try the trust engine without signing up

# Healthy agent — 3 months of clean behavioral history
curl https://agentlair.dev/v1/demo?scenario=healthy | jq

# New agent — cold start, wide confidence interval
curl https://agentlair.dev/v1/demo?scenario=new | jq

# Suspicious agent — scope creep, suppressed telemetry
curl https://agentlair.dev/v1/demo?scenario=suspicious | jq
Enter fullscreen mode Exit fullscreen mode

You'll see trust scores, confidence intervals, behavioral dimensions, and trend signals. The healthy scenario returns a score around 84 ("principal" tier). The new agent is around 34 with a wide confidence interval — it simply hasn't built history yet. The suspicious one is around 31 and declining.

This gives you a concrete picture of what you're building toward.


Step 1: Register your agent

One call. No signup form.

curl -X POST https://agentlair.dev/v1/auth/agent-register \
  -H "Content-Type: application/json" \
  -d '{"name": "my-research-agent"}'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "api_key": "al_live_...",
  "email_address": "my-research-agent@agentlair.dev",
  "account_id": "...",
  "limits": {
    "emails_per_day": 10,
    "addresses": 10,
    "api_requests_per_day": 100
  }
}
Enter fullscreen mode Exit fullscreen mode

Save the api_key and account_id. You'll need both.

Your agent now has:

  • A persistent email address (can send and receive)
  • An API key scoped to its identity
  • An account_id used for its trust badge URL

The free tier gives you 10 emails/day, 10 addresses, and 100 API requests/day. No credit card required.


Step 2: Install the MCP server

npx @agentlair/mcp@latest
Enter fullscreen mode Exit fullscreen mode

This is @agentlair/mcp version 1.2.0. It requires Node >= 18.

The MCP server exposes 14 tools: email (send, receive, list), vault (store and retrieve encrypted secrets), calendar (create events, generate iCal feeds), and task delegation. Everything your agent needs to act as a real participant in workflows.


Step 3: Configure in Claude Code or Cursor

Claude Code — add to your .mcp.json (project-level) or ~/.claude/mcp.json (global):

{
  "mcpServers": {
    "agentlair": {
      "command": "npx",
      "args": ["@agentlair/mcp@latest"],
      "env": {
        "AGENTLAIR_API_KEY": "al_live_your_key_here"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Cursor — add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "agentlair": {
      "command": "npx",
      "args": ["@agentlair/mcp@latest"],
      "env": {
        "AGENTLAIR_API_KEY": "al_live_your_key_here"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Windsurf — same pattern in your Windsurf MCP config.

Restart your editor. The 14 AgentLair tools will appear in your MCP tool list.


Step 4: Trust scoring happens automatically

Once your agent is registered and making API calls, behavioral telemetry starts accumulating. You don't instrument anything manually.

AgentLair scores on three dimensions:

  • Consistency — does the agent call the same endpoints with the same patterns, or does it behave erratically?
  • Restraint — does it stay within its declared scope, or does it creep toward capabilities it wasn't configured for?
  • Transparency — does it report errors honestly, or does it suppress failures?

New agents start around 30 ("intern" tier). With consistent, scoped, honest behavior over time, scores climb toward 80+ ("principal" tier).

Check your agent's current score:

curl -H "Authorization: Bearer al_live_your_key_here" \
  https://agentlair.dev/v1/agents/your_account_id/trust-score | jq
Enter fullscreen mode Exit fullscreen mode

Step 5: Embed the trust badge

Your agent gets a live SVG badge at:

https://agentlair.dev/badge/YOUR_ACCOUNT_ID
Enter fullscreen mode Exit fullscreen mode

Add it to your README:

![Agent Trust Score](https://agentlair.dev/badge/YOUR_ACCOUNT_ID)
Enter fullscreen mode Exit fullscreen mode

The badge updates in real-time as your trust score changes. It's shields.io-compatible format — the same style as your build status and coverage badges.

This matters when your agent is interacting with systems that check whether they should trust incoming requests. A verifiable trust badge is harder to fake than a self-declaration.


What your agent can do now

With the MCP server configured, your agent has access to 14 tools. Here are the most immediately useful:

Send email:

Use the agentlair send_email tool to send "hello@example.com" 
a message with subject "Hello from my agent"
Enter fullscreen mode Exit fullscreen mode

Store a secret (client-side encrypted):

Use the agentlair store_secret tool to store my OpenAI API key 
under the name "openai_key"
Enter fullscreen mode Exit fullscreen mode

The vault uses client-side AES-256-GCM encryption via @agentlair/vault-crypto (315 lines, zero dependencies). The server stores opaque ciphertext — the master seed never leaves your agent's runtime.

Check your trust score:

Use the agentlair get_trust_score tool to check my current score
Enter fullscreen mode Exit fullscreen mode

What comes next

A few things that make more difference than they might seem:

The trust score is cross-org. When your agent interacts with other services that query AgentLair, its score travels with it. A healthy score in one context provides a cold-start signal in new ones. This is the structural gap Microsoft AGT (single-org behavioral trust) doesn't close — scores are org-local there.

Trust improves with time. The confidence interval starts wide (like the "new" scenario above, score 34, CI 18–52, only 11 observations). After a few weeks of consistent behavior, the interval tightens and the score reflects a genuine behavioral pattern.

The email address is a real inbox. my-research-agent@agentlair.dev receives mail, can send it, and supports WebSocket push for real-time processing. If you're building an agent that participates in email workflows, this is the fastest path.

Full docs: agentlair.dev/getting-started

MCP reference: agentlair.dev/api

Badges: agentlair.dev/badges

Top comments (0)