AEGISdocs
API Reference

MCP Tools Reference

AEGIS MCP Server -- Model Context Protocol interface for agentic AI governance.

AEGIS MCP Server -- Model Context Protocol interface for agentic AI governance.

The AEGIS MCP server exposes governance gates as MCP tools that AI agents (Claude Code, Codex, custom agents) can call to evaluate proposals before taking action.

Hosted MCP Endpoint

AEGIS provides a hosted MCP endpoint on GCP Cloud Run. No local installation required — connect any MCP-compatible client directly.

EnvironmentEndpoint
Productionhttps://aegis-mcp-980022636831.us-central1.run.app/mcp

Authentication uses a Bearer token (same API key from the portal).

Claude Code (.mcp.json)

{
  "mcpServers": {
    "aegis": {
      "type": "streamable-http",
      "url": "https://aegis-mcp-980022636831.us-central1.run.app/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Replace YOUR_API_KEY with your API key from the portal.

Health Check

The /health route is public (no authentication required):

curl https://aegis-mcp-980022636831.us-central1.run.app/health

Local MCP Server (stdio)

For local development or air-gapped environments, run the MCP server locally via stdio.

Claude Code Integration

pip install -e ".[mcp]"

Add a .mcp.json to the project root (preferred — portable and version-controllable):

{
  "mcpServers": {
    "aegis": {
      "type": "stdio",
      "command": "aegis-mcp-server"
    }
  }
}

Or add to your project's .claude/settings.json:

{
  "mcpServers": {
    "aegis-governance": {
      "command": "aegis-mcp-server",
      "args": []
    }
  }
}

This exposes 7 tools to Claude Code: aegis_evaluate_proposal, aegis_quick_risk_check, aegis_check_thresholds, aegis_get_scoring_guide, aegis_crypto_status, aegis_list_decisions, and aegis_get_decision.


Starting the Server

The MCP server uses the official MCP Python SDK (FastMCP) and supports two transports:

aegis-mcp-server                                          # stdio (default, for Claude Code)
aegis-mcp-server --transport streamable-http --port 8080  # HTTP (ECS/hosted)

In production (ECS Fargate), the server runs with streamable-http behind an internal ALB, exposed publicly via API Gateway HTTP API with Unkey Bearer token authentication. A /health endpoint is available for container and load-balancer health checks.


Rate Limiting

The server includes a token bucket rate limiter (CoSAI MCP-T10 compliance).

  • Default: 60 requests per minute
  • Configurable via AegisConfig.mcp_rate_limit
  • Set to 0 to disable
  • Exceeding the limit returns an error in the tool response

Audit Logging

Every aegis_evaluate_proposal invocation is logged with:

  • SHA-256 hash of parameters (first 16 hex chars, PII-safe)
  • Decision status
  • Latency in milliseconds
  • Caller ID (from agent_id argument)

Tools

aegis_evaluate_proposal

Full governance gate evaluation via pcw_decide(). Evaluates a proposal through all six quantitative gates (Risk, Profit, Novelty, Complexity, Quality, Utility) and returns a structured decision with per-gate details and rationale.

Required parameters:

ParameterTypeDescription
proposal_summarystringBrief description of the proposed action
estimated_impactstringImpact level: low, medium, high, critical

Optional parameters:

ParameterTypeDefaultDescription
risk_scorenumber0.0Alias for risk_proposed (0.0-1.0)
risk_proposednumber0.0Predicted risk after change (0.0-1.0)
risk_baselinenumber0.0Current risk level (0.0-1.0). Gate triggers when risk doubles vs baseline with 95% Bayesian confidence.
profit_proposednumber0.0Expected profit/performance after change
profit_baselinenumber0.0Current profit/performance metric
novelty_scorenumber0.5How unprecedented the proposal is (0.0-1.0). Gate passes when novelty >= ~0.74. Logistic inflection at 0.7.
complexity_scorenumber0.5Normalized complexity where HIGHER = SIMPLER (0.0-1.0). Hard floor at 0.5: below this the proposal HALTs and CANNOT be overridden.
quality_scorenumber0.7Overall proposal quality (0.0-1.0). Must be >= 0.7.
quality_subscoresarray[number][0.7, 0.7, 0.7]Detailed quality subscores. None may be zero.
agent_idstring"unknown"Identifier of the calling agent
session_idstring(auto UUID)Session identifier for correlation
phasestring"plan"Lifecycle phase: plan, commit, work
shadow_modebooleanfalseShadow mode: gates evaluate but results are advisory only. Requires Professional tier or higher.
telemetry_urlstring(none)HTTPS URL for structured telemetry events
drift_baseline_dataarray[number](none)30+ historical observations for KL divergence drift detection
requires_human_approvalbooleanfalseWhether this proposal requires human approval
time_sensitivebooleanfalseWhether this proposal is time-sensitive
reversiblebooleantrueWhether this proposal is reversible
metadataobject{}Additional key-value metadata
change_typestring"feature"Type of change: feature, refactor, bugfix, config. Non-feature types skip novelty and profit gates.

Utility auto-synthesis: If utility_result is not provided (the common case), the MCP server auto-synthesizes it from profit_baseline/profit_proposed using symmetric PERT three-point estimation (±20% spread) with a profit delta epsilon clamp of 0.001. This matches CLI and REST API behaviour — all three surfaces produce identical utility gate results for the same inputs.

Response fields:

FieldTypeDescription
statusstringDecision: proceed, pause, halt, escalate
confidencenumberMinimum confidence across all gates
gates_passednumberCount of passing gates
gates_failednumberCount of failing gates
failing_gatesarray[string]Names of failed gates
rationalestringHuman-readable decision rationale
next_stepsarray[string]Recommended next actions
constraintsarray[string]Active constraints
decision_idstringUnique decision UUID
timestampstringISO 8601 UTC timestamp
override_eligiblebooleanWhether override is possible
override_requiresarray[string]Roles needed for override
gatesobjectPer-gate detail (value, threshold, confidence, message)

aegis_quick_risk_check

Quick risk threshold check (risk_score < threshold).

Warning: This is a simplified check without Bayesian evaluation. For governance decisions, use aegis_evaluate_proposal instead.

Required parameters:

ParameterTypeDescription
action_descriptionstringBrief description of the action to risk-check
risk_scorenumberEstimated risk score (0.0-1.0)

Optional parameters:

ParameterTypeDefaultDescription
thresholdnumber0.5Risk threshold. Score below this is considered safe.
agent_idstring"unknown"Identifier of the calling agent

Response fields:

FieldTypeDescription
safebooleantrue if risk is below threshold
risk_scorenumberThe evaluated risk score
thresholdnumberThe threshold used

aegis_check_thresholds

Introspect all six gate thresholds and current configuration. Call this before submitting proposals to understand gate behavior and parameter values.

Parameters: None required.

Response fields:

FieldTypeDescription
gatesarrayArray of 6 gate definitions with name, type, threshold, description
configobjectFull AegisConfig as dict

aegis_get_scoring_guide

Get domain-specific parameter derivation guidance. Returns formulas, range guides, common mistakes, and worked examples showing how to map domain metrics to AEGIS parameters.

Recommended workflow:

  1. aegis_check_thresholds — understand gate configuration
  2. aegis_get_scoring_guide(domain) — get derivation formulas for your domain
  3. aegis_evaluate_proposal(...) — submit with derived values

Parameters:

ParameterTypeRequiredDescription
domainstringNoDomain for tailored guidance. One of: trading, cicd, moderation, agents, generic. Defaults to generic if omitted or unrecognized.

Response fields:

FieldTypeDescription
domainstringThe domain returned
domain_descriptionstringBrief description of the domain context
parametersobjectPer-parameter guidance with description, derivation, formula, example, and range_guide
common_mistakesarray[string]Domain-specific pitfalls (e.g., complexity inversion, novelty pass direction)
worked_exampleobjectComplete scenario with input JSON and expected_gates results

Available domains:

DomainUse CaseKey Metric
tradingAlgorithmic trading, portfolio changesVaR / position limit
cicdCI/CD pipelines, deploymentsError rate, rollback rate
moderationContent moderation, safety filtersFalse positive rate
agentsAutonomous AI agentsTask failure rate
genericAny domain (default)General-purpose guidance

aegis_crypto_status

Check availability of all AEGIS cryptographic providers (signatures, encryption, key management). Returns which providers are installed and active.

Parameters: None.

Response fields:

FieldTypeDescription
signatures.hybridbooleanEd25519 + ML-DSA-44 hybrid available
signatures.bip322booleanBIP-322 Schnorr available
signatures.ed25519booleanEd25519 (deprecated) available
encryption.hybrid_kembooleanX25519 + ML-KEM-768 + AES-256-GCM available
post_quantum.ml_dsabooleanML-DSA-44 signatures available
post_quantum.ml_kembooleanML-KEM-768 encryption available
key_management.aws_kmsbooleanAWS KMS envelope encryption available
key_management.hsm_pkcs11booleanPKCS#11 HSM key wrapping available
schema_signing.availablebooleanAMTSS schema signer package installed
default_providerstringActive signature provider: bip322-simple, ed25519, or none
kek_providerstringBest available KEK provider: kms, hsm, or environment
documentation_urlstringLink to crypto documentation

aegis_list_decisions

List governance decisions for the current customer. Returns recent decisions with status, confidence, proposal summary, and gate results.

Parameters:

ParameterTypeRequiredDefaultDescription
monthstringNoCurrent monthYYYY-MM filter for decision history
limitintegerNo50Maximum decisions to return (max 200)
customer_idstringNoFrom env varOverride customer ID

Response fields:

FieldTypeDescription
decisionsarrayArray of decision summaries
decisions[].decision_idstringUnique decision UUID
decisions[].statusstringDecision outcome: proceed, pause, halt, escalate
decisions[].confidencenumberMinimum confidence across all gates
decisions[].proposal_summarystringBrief description of the proposal
decisions[].timestampstringISO 8601 UTC timestamp
decisions[].gates_passedintegerCount of passing gates
decisions[].gates_failedintegerCount of failing gates
totalintegerTotal decisions matching the filter
monthstringThe YYYY-MM filter applied

aegis_get_decision

Get a specific governance decision by ID. Returns the full decision record including input context, all gate results, rationale, next steps, and audit hash.

Parameters:

ParameterTypeRequiredDefaultDescription
decision_idstringYes--UUID of the decision to retrieve
monthstringNoCurrent monthYYYY-MM of the decision (improves lookup performance)
customer_idstringNoFrom env varOverride customer ID

Response fields:

FieldTypeDescription
decision_idstringUnique decision UUID
statusstringDecision outcome: proceed, pause, halt, escalate
confidencenumberMinimum confidence across all gates
proposal_summarystringBrief description of the proposal
estimated_impactstringImpact level: low, medium, high, critical
timestampstringISO 8601 UTC timestamp
rationalestringHuman-readable decision rationale
next_stepsarray[string]Recommended next actions
gatesobjectPer-gate evaluation details (value, threshold, confidence, message)
constraintsarray[string]Active constraints
override_eligiblebooleanWhether override is possible
override_requiresarray[string]Roles needed for override
audit_hashstringSHA-256 hash of the decision record for tamper detection
input_contextobjectOriginal input parameters submitted with the proposal

Integration with MCP Clients

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "aegis-governance": {
      "command": "aegis-mcp-server",
      "args": []
    }
  }
}

Custom MCP Clients

Connect via stdio using the MCP Python SDK:

from mcp import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client

params = StdioServerParameters(command="aegis-mcp-server", args=[])
async with stdio_client(params) as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        result = await session.call_tool(
            "aegis_evaluate_proposal",
            arguments={
                "proposal_summary": "Add caching layer",
                "estimated_impact": "medium",
                "risk_score": 0.2,
                "complexity_score": 0.7,
            },
        )

Security

SSRF Protection

Telemetry URLs provided via telemetry_url are validated with a resolve-then-validate approach:

  • DNS resolution is performed first to catch DNS rebinding
  • Private, loopback, link-local, reserved, and CGNAT addresses are blocked
  • Only https:// schemes are accepted in production

Input Validation

  • All numeric parameters reject NaN, Inf, and -Inf
  • Boolean parameters reject non-boolean types (prevents Python truthiness confusion)
  • estimated_impact is validated as a string enum
  • The validate_float() helper preserves legitimate falsy values like 0 and 0.0

On this page