Search documentation

Search all documentation pages

MCP Server Integration

Integrate Aguardic with Model Context Protocol compatible AI agents.

Overview

Aguardic exposes an MCP server that AI agents can call for policy evaluation. The MCP endpoint provides an evaluate tool that agents invoke via the standard Model Context Protocol. When your agent calls the tool, Aguardic evaluates the content against bound policies and returns an outcome -- all within the MCP tool response.

This lets MCP-compatible agents govern their own actions without custom integration code.

Setup

1. Create an MCP Server Integration

Navigate to Integrations in the Aguardic dashboard, click Add Integration, and select MCP Server. Give it a name and copy the API key.

API keys are shown only once. Store it securely. If you lose it, revoke it and create a new one.

2. Bind Policies

Go to Policy Bindings and bind your governance policies to the MCP Server integration. The evaluate tool will check content against all bound policies.

3. Configure Your MCP Client

Point your MCP client at the Aguardic MCP endpoint with your API key.

Endpoint

POST https://api.aguardic.com/v1/mcp

Authenticated via Bearer token in the Authorization header. This is a stateless Streamable HTTP transport -- each request is independent with no server-side session tracking.

Configuration

Add Aguardic as an MCP server in your agent's configuration:

{
  "mcpServers": {
    "aguardic": {
      "url": "https://api.aguardic.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer ag_live_abc123def456"
      }
    }
  }
}

This configuration format works with any MCP client that supports the Streamable HTTP transport, including Claude Desktop, Cursor, and custom agent frameworks.

Available Tools

The MCP server exposes a single evaluate tool with the following parameters:

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | input | object | Yes | The content to evaluate. Keys and values depend on your use case. | | targetKey | string | No | Identifier for the target being evaluated (e.g., "send_email", "write_file"). | | targetType | string | No | Type of target (e.g., "email", "document", "chat"). | | correlationId | string | No | Correlation ID for request tracing. | | sessionId | string | No | Session ID to track multi-step evaluation chains. |

Dynamic Tool Description

The evaluate tool description is dynamically generated based on your bound policies. When an agent discovers the tool, it sees which policies are active, their enforcement modes, and their rules. This helps the agent understand what governance constraints apply before making tool calls.

Tool Response

The evaluate tool returns a JSON object in the tool result:

{
  "outcome": "BLOCK",
  "enforcementAction": "BLOCK",
  "evaluationRunId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "reviewRequestId": null,
  "pollUrl": null,
  "sessionId": null,
  "violations": [
    {
      "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
      "ruleId": "rule-1",
      "ruleName": "PII Detection",
      "severity": "HIGH",
      "resolvedAction": "BLOCK",
      "explanation": "Content contains social security reference",
      "field": "content",
      "snippet": "send your SSN"
    }
  ]
}

Outcomes:

  • ALLOW -- No violations. The agent can proceed.
  • WARN -- Violations found but enforcement allows continuation. The agent should log the warning.
  • BLOCK -- Violations found. The agent must not execute the action.

When enforcementAction is APPROVAL_REQUIRED, the response includes a reviewRequestId and pollUrl for checking review status.

Example: Agent Tool Call

An MCP-compatible agent calling the evaluate tool before sending an email:

{
  "method": "tools/call",
  "params": {
    "name": "evaluate",
    "arguments": {
      "input": {
        "tool": "send_email",
        "to": "customer@example.com",
        "subject": "Account Details",
        "body": "Your account number is 1234567890"
      },
      "targetKey": "send_email",
      "targetType": "email"
    }
  }
}

The agent receives the evaluation result and decides whether to proceed based on the outcome.

Compatible Frameworks

The Aguardic MCP server works with any framework that supports the MCP Streamable HTTP transport:

  • Claude Desktop -- Add to your claude_desktop_config.json
  • Cursor -- Configure in MCP server settings
  • OpenAI Agents SDK -- Via MCP client integration
  • LangChain / LangGraph -- Via MCP tool adapters
  • Custom agents -- Any client implementing the MCP Streamable HTTP transport

Next Steps