Integrations

MCP Integration

Model Context Protocol tool call and server governance.

MCP Integration

Overview

AgentTrust provides mcp_tool_guard and MCPServerGuard for Model Context Protocol servers and tool invocations. Validates tool inputs/outputs at the MCP boundary.

Tier: Developer+

Why It Matters

MCP tools expose agents to external capabilities. Tool trust checks at the MCP layer prevent unauthorized or risky tool executions.

Prerequisites

pip install agentrust-sdk
# Developer+ API key for MCP adapter

Step-by-Step Guide

from agentrust_sdk import mcp_tool_guard, MCPServerGuard

# Guard individual tool calls
@mcp_tool_guard(agent_id="mcp-tools")
async def my_tool_handler(request):
    return await execute_tool(request)

# Guard entire MCP server
guard = MCPServerGuard(agent_id="mcp-server")

Examples

See agentrust_sdk/agentrust_sdk/adapters/mcp.py.

Best Practices

  • Guard at server level for comprehensive coverage
  • Include tool name and arguments in validation metadata
  • Use tool trust policy rules for allowlist/denylist

Common Mistakes

  • Developer tier required (not OSS)
  • Not passing tool metadata to validation engine

Troubleshooting

IssueFix
Tool trust check failsReview tool allowlist in policy pack
TierGateErrorDeveloper tier minimum