Skip to content

UnitOneAI/unitone-agentgateway

Repository files navigation

UnitOne AgentGateway

Production-ready Azure deployment of AgentGateway with MCP Security Guards.

What is AgentGateway?

AgentGateway is an API gateway for AI agents that provides:

  • MCP Protocol Support - Route and proxy Model Context Protocol (MCP) requests
  • Security Guards - Protect against tool poisoning, rug pulls, and PII leakage
  • Multi-tenant Routing - Single gateway for multiple MCP servers
  • Web UI - Visual dashboard for monitoring and configuration

Quick Start

Prerequisites

1. Clone and Setup

git clone --recursive https://github.com/UnitOneAI/unitone-agentgateway.git
cd unitone-agentgateway
./agw setup

The setup wizard guides you through Azure configuration, OAuth setup, and deployment.

2. Build and Deploy

./agw build --deploy

3. Access Your Gateway

./agw status

CLI Reference

All operations use the unified ./agw CLI:

./agw setup              # Interactive first-time setup
./agw scope              # Manage deployment scopes (dev/staging/prod)
./agw auth               # Configure OAuth authentication
./agw build              # Build and push image to ACR
./agw build --deploy     # Build and deploy in one step
./agw deploy             # Deploy latest image
./agw test               # Run E2E tests locally
./agw test-servers       # Deploy test servers to Azure
./agw logs               # View container logs
./agw logs --follow      # Stream logs
./agw status             # Show deployment status
./agw help               # Show all commands

Multi-Scope Support

Manage multiple deployments (dev, staging, prod) with scopes:

./agw scope list                 # List all scopes
./agw scope import --name dev    # Import from terraform
./agw scope set prod             # Switch to prod
./agw scope add staging          # Add new scope interactively

Authentication

Configure OAuth providers via CLI (no portal needed):

./agw auth urls      # Get callback URLs for OAuth app setup
./agw auth setup     # Configure Microsoft/Google/GitHub
./agw auth enable    # Require authentication
./agw auth disable   # Allow anonymous access

Documentation

Guide Description
Production Setup Detailed deployment guide
Security Guards Configure protection policies
Authentication Configure OAuth and mTLS
E2E Test Guide Run security guard tests locally
Config Hot Reload Runtime configuration updates
Sticky Sessions Multi-replica session affinity

Local E2E Testing

./agw test                 # Run full test suite
./agw test --skip-build    # Use existing image
./agw test --stop          # Stop test containers

Tests validate:

  • Tool Poisoning Guard - Blocks malicious tool descriptions
  • Rug Pull Guard - Detects runtime tool changes
  • PII Guard - Masks sensitive data in responses

See docs/E2E_TEST_GUIDE.md for details.

Security Guards

Guard Purpose Default
toolPoisoning Block malicious tool descriptions Enabled
rugPull Detect runtime tool changes Enabled
pii Block PII in responses Configurable

See docs/SECURITY_GUARDS.md for configuration details.

Build Options

The CLI supports two build modes:

Mode Command Best For
ACR Cloud Build ./agw build Default. No local Docker needed.
Local Build ./agw build --local Faster iteration on a VM.

When to Use Local Builds

Use ./agw build --local when you have a dedicated Linux build VM:

  • Faster iteration (Docker layer caching)
  • Lower ACR build costs
  • More control over the build process

Quick Setup on a fresh Ubuntu/Debian VM:

# 1. Setup build VM with Docker and Azure CLI
curl -fsSL https://raw.githubusercontent.com/UnitOneAI/unitone-agentgateway/main/scripts/setup-build-vm.sh | bash

# 2. Log out/in for docker group, then login to Azure
az login

# 3. Clone and build
git clone --recursive https://github.com/UnitOneAI/unitone-agentgateway.git
cd unitone-agentgateway
./agw build --local --deploy

Repository Structure

unitone-agentgateway/
├── agw                        # Unified CLI (start here)
├── .agw/                      # Local scope config (gitignored)
│   ├── current                # Active scope name
│   └── scopes/*.env           # Scope configurations
├── agentgateway/              # Git submodule (core gateway)
├── terraform/                 # Azure infrastructure
├── tests/                     # E2E test suite
├── testservers/               # Mock MCP servers for testing
├── scripts/
│   ├── setup-build-vm.sh      # Setup a Linux VM for local builds
│   ├── build-on-vm.sh         # Used by ./agw build --local
│   └── deploy-test-servers.sh # Deploy test servers to Azure
└── docs/                      # Documentation

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     Azure Container Apps                     │
│  ┌─────────────────────────────────────────────────────┐    │
│  │                 UnitOne AgentGateway                 │    │
│  │  ┌──────────────────────────────────────────────┐   │    │
│  │  │              Security Guards                  │   │    │
│  │  │  ┌─────────┐ ┌─────────┐ ┌─────────────────┐ │   │    │
│  │  │  │ Tool    │ │ Rug     │ │ PII Detection   │ │   │    │
│  │  │  │Poisoning│ │ Pull    │ │                 │ │   │    │
│  │  │  └────┬────┘ └────┬────┘ └────────┬────────┘ │   │    │
│  │  │       └───────────┼───────────────┘          │   │    │
│  │  └───────────────────┼──────────────────────────┘   │    │
│  │                      ▼                               │    │
│  │  ┌──────────────────────────────────────────────┐   │    │
│  │  │              MCP Route Handlers               │   │    │
│  │  │  /mcp/server-a → Backend A                   │   │    │
│  │  │  /mcp/server-b → Backend B                   │   │    │
│  │  └──────────────────────────────────────────────┘   │    │
│  └─────────────────────────────────────────────────────┘    │
│                              │                               │
│  ┌───────────────────────────┼───────────────────────────┐  │
│  │         Azure Easy Auth   │   (OAuth)                 │  │
│  │  Microsoft | Google | GitHub                          │  │
│  └───────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘
                               │
                               ▼
                 ┌──────────────────────────┐
                 │    Your MCP Servers      │
                 └──────────────────────────┘

License

MIT License - see LICENSE.

Support

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published