ATLAS Governance Gateway MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "MODAL_TOKEN_ID=${MODAL_TOKEN_ID}" -e "MODAL_TOKEN_SECRET=${MODAL_TOKEN_SECRET}" -e "INNGEST_EVENT_KEY=${INNGEST_EVENT_KEY}" -e "INNGEST_SIGNING_KEY=${INNGEST_SIGNING_KEY}" atlas-governance-gateway -- docker run -i --rm atlas-gateway
Required:MODAL_TOKEN_IDMODAL_TOKEN_SECRETINNGEST_EVENT_KEYINNGEST_SIGNING_KEY
README.md

A secure middleware that intercepts AI agent tool calls to manage risks.

ATLAS Governance Gateway (Phase 2)

A Secure Middleware for AI Agents, powered by FastMCP, Inngest, and Modal.

The ATLAS Governance Gateway is a centralized hub that intercepts AI Agent tool calls, evaluates potential risks using a generic LLM/SLM (hosted on Modal.com), and manages "Human-in-the-Loop" (HITL) escalations via durable Inngest workflows.

Logic Attribution: The governance logic and dataset design are attributed to Anna Ko anna_ko@berkeley.edu (UC Berkeley). This implementation strictly follows the "approve -> auto_approve" deterministic flow for low-risk actions per project v3.0 findings.

๐Ÿš€ Key Features

  • Durable Governance: Uses Inngest to manage long-running human review workflows that survive server restarts.
  • FastMCP + FastAPI: Exposes Model Context Protocol (MCP) tools via a robust generic web server.
  • Risk Evaluation: Real-time checking against EU AI Act standards via atlas-welfare-v1 on Modal.
  • Compliance: Enforces Article 14 by pausing high-risk actions until human approval is received.
  • Secure Deployment: Dockerized environment with secure credential management.

๐Ÿ› ๏ธ Architecture

sequenceDiagram
    participant Agent as AI Agent (MCP Client)
    participant GW as Governance Gateway (FastAPI)
    participant Modal as Atlas Brain (Modal Evaluation)
    participant Inngest as Inngest Workflow
    participant Human as Sarah (Human-in-the-Loop)

    Agent->>GW: Call Tool (e.g. request_payment_extension)
    GW->>Inngest: Trigger Governance Event
    GW-->>Agent: Returns "PENDING REVIEW"
    
    Inngest->>Modal: Evaluate Risk (EU AI Act)
    Modal-->>Inngest: Risk Score (0-100)

    alt Risk Score < 70
        Inngest->>Inngest: Auto-Approve Action
    else Risk Score >= 70
        Inngest->>Inngest: PAUSE & Wait for Human
        Human->>GW: POST /webhook/approval (APPROVED)
        GW->>Inngest: Send Approval Event
        Inngest->>Inngest: Resume & Finalize
    end

The system consists of three main components:

  1. Gateway (gateway.py): A FastAPI application that serves as the entry point.

    • MCP Server: Mounted at /mcp/sse to serve Agent tools (check_status, request_extension, etc.).
    • Inngest Endpoint: Served at /api/inngest to handle workflow triggers and step execution.
    • Webhook: Listens at /webhook/approval for external human approval signals.
  2. Workflows (workflows.py): Defines the durable business logic.

    • handle_governance: The core workflow that:
      1. Calls Modal to assess risk.
      2. Auto-approves usage if Risk Score < 70.
      3. Pauses and waits for atlas/sarah.decision event if Risk Score >= 70.
  3. Agent Integration:

    • Any MCP-compliant agent (Claude Desktop, cursor, or custom scripts) can connect to the Gateway.

๐Ÿ“ฆ Installation & Setup

Prerequisites

  • Docker Desktop installed and running.
  • (Optional) python 3.10+ if running locally without Docker.

Quick Start (Docker)

We provide a setup.sh script to automate the configuration and deployment.

  1. Run the Setup Script:

    ./setup.sh
    
  2. Configuration: The script will prompt you for:

    • Modal Function Name: (Default: nislam-mics/ATLAS-NIST-Measure)
    • AI Backend: Choose OpenAI or Local LLM (Ollama).
    • Inngest Keys: Event Key and Signing Key (Required for Production).
    • Modal Credentials: Token ID and Secret.

    Note: The script creates a .env file automatically. DO NOT commit this file.

  3. Usage: The script will build the Docker image atlas-gateway and run it on port 8000.


๐Ÿ”Œ Endpoints

Once running, the Gateway exposes the following endpoints on http://localhost:8000:

Endpoint Method Description
/ GET Health check and status.
/mcp/sse GET MCP Endpoint. Connect your AI Agent here.
/mcp/messages POST MCP Protocol messages (handled by FastMCP).
/api/inngest POST Inngest Webhook. Connects to Inngest Cloud.
/webhook/approval POST Human Approval Webhook. Simulate approval signals.

๐Ÿงช Testing the Governance Flow

1. Manual Verification

Check if the gateway is running:

curl http://localhost:8000/
# Expected: {"status": "ATLAS Governance Gateway Running", ...}

2. End-to-End Simulation

We included a script test_handshake.py that simulates the entire flow without needing an external Agent.

  1. Ensure the Gateway is running (via Docker or locally).

  2. Run the test script:

    python test_handshake.py
    
  3. Flow:

    • Script simulates an Agent calling request_payment_extension (High Risk).
    • Gateway returns PENDING REVIEW.
    • Inngest triggers a workflow run (check Inngest Dashboard).

Tools (2)

check_statusChecks the health and status of the governance gateway.
request_extensionRequests a payment extension, triggering the governance risk evaluation workflow.

Environment Variables

MODAL_TOKEN_IDrequiredAuthentication token ID for Modal services
MODAL_TOKEN_SECRETrequiredAuthentication secret for Modal services
INNGEST_EVENT_KEYrequiredEvent key for Inngest workflow management
INNGEST_SIGNING_KEYrequiredSigning key for Inngest workflow management

Configuration

claude_desktop_config.json
{"mcpServers": {"atlas-gateway": {"command": "docker", "args": ["run", "-i", "--rm", "atlas-gateway"]}}}

Try it

โ†’Check the current status of the governance gateway.
โ†’Request a payment extension for my current project.
โ†’What is the current risk evaluation status for my pending actions?

Frequently Asked Questions

What are the key features of ATLAS Governance Gateway?

Intercepts AI agent tool calls to evaluate potential risks. Manages human-in-the-loop escalations via durable Inngest workflows. Real-time risk assessment against EU AI Act standards using Modal. Pauses high-risk actions until human approval is received. Exposes MCP tools via a robust FastAPI server.

What can I use ATLAS Governance Gateway for?

Enforcing compliance with the EU AI Act for automated agent actions. Implementing human-in-the-loop approval for sensitive financial requests. Managing long-running governance workflows that survive server restarts. Adding a safety layer to AI agents performing high-risk operations.

How do I install ATLAS Governance Gateway?

Install ATLAS Governance Gateway by running: ./setup.sh

What MCP clients work with ATLAS Governance Gateway?

ATLAS Governance Gateway works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep ATLAS Governance Gateway docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare