Skip to content
Conduit

mcp server

aegis

Runtime security & governance control plane for AI agents. Enforces per-tool authorization, OPA policy, behavioral risk scoring, blast-radius analysis, autonomy contracts, and tenant kill-switch. Ever

Abhi-mishra998/aegiscommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "abhi-mishra998-aegis": {
      "command": "uvx",
      "args": [
        "acp"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 25, 2026

🛡️ Aegis

The runtime security control plane for AI agents. Every LLM prompt scanned. Every tool call authorized. Every decision cryptographically signed.

License: Apache 2.0 Live PyPI aegis-anthropic Attack recall 0.887 Chain integrity 0 violations

Live demo · Client setup · Test report · Docs · Blog post


What Aegis does in 30 seconds

Your AI agent is about to call db.query(sql="DROP TABLE users") or send a prompt with "Ignore all previous instructions". Without Aegis, that call goes through. With Aegis, it's blocked in ~150 ms with a signed audit receipt.

from sdk.acp_client import Client, DeniedError

acp = Client()  # reads AEGIS_EMPLOYEE_KEY + AEGIS_URL from env

@acp.protect(agent_id="agent_42", tool="db.query")
def query(sql: str) -> list[dict]:
    return db.execute(sql)

query("SELECT name FROM users LIMIT 10")   # ✅ runs
query("DROP TABLE users")                   # ❌ DeniedError raised before it runs

Aegis blocks: prompt injection · DAN / OMEGA / STAN jailbreaks · SSN / credit-card / API-key exfil · cost bombs · cross-tenant escapes · runaway loops · unauthorized tool calls · unauthorized shell commands · unauthorized file reads.

Aegis produces: an ed25519-signed, Merkle-rooted, per-tenant audit chain that any regulator can verify offline in one command:

pip install aegis-aevf==1.1.1 && aegis-verify --bundle exported.json

Why it exists

AI agents ship faster than they can be secured. In 2026 an agent framework will happily execute a tool call constructed from a prompt-injected LLM response — no policy layer between "the model said so" and "the database was dropped." Existing solutions either:

  • Live inside the model (safety fine-tuning) — good, but 100 % model-specific and easily jailbroken
  • Live outside the process (WAF / IAM) — good for shapes of traffic, blind to the semantics of prompts and tool calls
  • Live in a paid SaaS — good if you like sending your prompts to a third party

Aegis is the fourth option: a process-adjacent runtime firewall — open source, self-hosted, model-agnostic, tool-agnostic. It reads every prompt and every tool call, applies a 10-layer policy pipeline, and produces a tamper-evident audit trail.


📐 The three diagrams

1. AWS deployment topology

Everything Aegis needs to run on AWS in ap-south-1 (or any AWS region). Provisioned by Terraform in infra/terraform/.

flowchart TB
    user[User / Agent Process] -->|HTTPS| r53[Route 53]
    r53 --> waf[AWS WAFv2<br/>Bot Control + Core Rules]
    waf --> alb[Application Load Balancer<br/>TLS termination · dualstack]

    subgraph vpc [VPC · ap-south-1 · 3 AZs]
        subgraph public [Public subnets]
            alb
        end
        subgraph private [Private subnets]
            asg[Auto Scaling Group<br/>2× m6g.large EC2]
            alb --> asg
        end
        subgraph data [Data subnets]
            rds[(RDS Postgres 15<br/>Multi-AZ)]
            redis[(ElastiCache Redis 7<br/>cluster 2-node)]
        end
        asg --> rds
        asg --> redis
    end

    subgraph aws [AWS managed services]
        s3[(S3<br/>bundle store +<br/>public transparency roots)]
        sm[Secrets Manager<br/>DB pass · JWT keys · mesh keys]
        ssm[SSM Parameter Store<br/>Clerk · Anthropic · feature flags]
        kms[KMS<br/>audit envelope encryption]
        cw[CloudWatch<br/>logs · metrics · alarms]
        ct[CloudTrail<br/>immutable API history]
    end

    asg --> s3
    asg --> sm
    asg --> ssm
    asg --> kms
    asg --> cw
    ct -.-> cw

    style user fill:#fff,stroke:#333,stroke-width:2px
    style waf fill:#c0392b,color:#fff
    style alb fill:#3498db,color:#fff
    style asg fill:#27ae60,color:#fff
    style rds fill:#e67e22,color:#fff
    style redis fill:#e67e22,color:#fff
    style s3 fill:#8e44ad,color:#fff
    style kms fill:#8e44ad,color:#fff

~$290/month baseline on-demand at current tenant volume — see test report §12 for the itemized bill. Free on local Docker Compose.


2. Aegis internal services

19 microservices per host, all in Python 3.11 + FastAPI. Each service is a separate container with its own DB pool, mesh JWT signing key, and health check. Cross-service calls use ES256 mesh JWTs.

flowchart TB
    subgraph front [Client-facing]
        gw[gateway<br/>· auth<br/>· PII scan<br/>· injection scan<br/>· cost cap]
        ui[ui<br/>React + Vite<br/>nginx static]
    end

    subgraph decision [Decision pipeline]
        pol[policy<br/>OPA rules]
        opa[OPA<br/>rego engine]
        dec[decision<br/>10-layer risk<br/>pipeline]
        beh[behavior<br/>agent baseline<br/>+ drift]
    end

    subgraph identity [Identity + registry]
        idn[identity<br/>tenant · user · role]
        reg[registry<br/>agent · permissions<br/>allow-list]
        api[api<br/>employee virtual keys<br/>incidents · ARE]
        ig[identity_graph<br/>blast radius<br/>compromise sim]
    end

    subgraph audit [Audit + evidence]
        aud[audit<br/>ed25519 chain<br/>16 shards]
        fr[flight_recorder<br/>step-level<br/>replay]
        fo[forensics<br/>timeline<br/>investigation]
    end

    subgraph auto [Autonomy + intelligence]
        au[autonomy<br/>contracts<br/>overrides]
        ins[insight<br/>cross-tenant<br/>correlation]
        lrn[learning<br/>signal weights]
    end

    subgraph other [Ops + specialty]
        u[usage<br/>cost telemetry<br/>+ outbox]
        wit[witness<br/>ATF §6<br/>execution attest]
        mcp[mcp_gate<br/>MCP protocol<br/>middleware]
        mcs[mcp_server<br/>stdio bridge]
        sec[security<br/>signal registry<br/>34 signals]
    end

    subgraph data [Shared infra]
        pg[(Postgres 15<br/>via pgbouncer)]
        rd[(Redis 7<br/>stream + cache)]
    end

    gw --> pol
    gw --> reg
    gw --> dec
    gw --> beh
    pol --> opa
    dec --> aud
    dec --> u
    dec --> fr
    dec --> fo
    dec --> ig
    reg --> pg
    idn --> pg
    aud --> pg
    aud --> rd
    fr --> pg
    fo --> pg
    au --> pg
    u --> pg
    ig --> pg
    ins --> pg
    all_services["all services"] -.-> pg
    all_services -.-> rd

    style gw fill:#3498db,color:#fff
    style dec fill:#c0392b,color:#fff
    style aud fill:#27ae60,color:#fff
    style opa fill:#e67e22,color:#fff

Full service inventory + memory limits + purpose in Service inventory.


3. Request workflow — end-to-end

What actually happens when your agent calls client.messages.create(...):

sequenceDiagram
    participant A as Agent (your process)
    participant SDK as Aegis SDK<br/>(aegis-anthropic)
    participant WAF as AWS WAF
    participant G as Gateway<br/>auth + scan
    participant P as Policy + OPA
    participant D as Decision<br/>+ Registry + Behavior
    participant U as Upstream Claude
    participant AU as Audit<br/>(async)

    Note over A,AU: user prompt: "Summarize this email: ..."

    A->>SDK: messages.create(model, prompt, max_tokens)
    SDK->>WAF: POST /v1/messages<br/>x-api-key: acp_emp_...
    WAF->>WAF: bot-control + rate rules
    WAF->>G: forward
    G->>G: validate employee key → tenant
    G->>G: check X-Tenant-ID matches
    G->>G: check max_tokens ≤ ceiling
    G->>G: check input ≤ 24 000 chars
    G->>G: PII scan (SSN / CC / API-keys)
    G->>G: injection scan (regex + normalize)

    alt scan hits attack
        G-->>SDK: 400 or 403 + specific reason
        SDK-->>A: raise HTTPStatusError
        G->>AU: audit-write via Redis stream
        Note right of AU: deny recorded<br/>even on blocked requests
    else scan clean
        G->>P: OPA policy check
        P-->>G: allow / deny / escalate
        G->>D: agent risk + behavior signals
        D-->>G: risk score + recommendation
        alt risk high or policy deny
            G-->>SDK: 403 with reason
        else all clear
            G->>U: forward prompt to Anthropic
            U-->>G: Claude response
            G-->>SDK: 200 + response + receipt_id
            SDK-->>A: response
        end
    end

    G->>AU: audit-write (Redis XADD, non-blocking)
    Note over AU: audit worker drains stream →<br/>ed25519 sign →<br/>append to shard-N chain →<br/>Postgres

The client sees a normal messages.create() call. Everything above happens in ~150 ms for deny paths, ~440 ms for allow paths + Claude's own inference latency.


🚀 Quickstart

For clients using the hosted service

If a customer just wants to use Aegis without deploying it, docs/setup.md is the 12-section walkthrough. TL;DR:

pip install 'aegis-anthropic==1.1.5'   # or aegis-openai / -langchain / -bedrock

Then log in at aegisagent.in, mint an employee key, and use the SDK.

For engineers self-hosting on AWS

git clone https://github.com/Abhi-mishra998/aegis.git
cd aegis/infra/terraform
# Edit envs/prod/terraform.tfvars with your account + domain
terraform init && terraform apply
# ~15 minutes. Populates ALB, RDS, ElastiCache, ASG, WAF, R53, everything.

Total baseline cost: ~$290/month (see test report §12 for itemized breakdown).

For engineers running locally

Zero AWS, zero Clerk, single laptop:

git clone https://github.com/Abhi-mishra998/aegis.git
cd aegis/infra
cp .env.aws.template .env      # then fill in the placeholders
docker compose up -d
# 25 containers per host — takes ~2 minutes on first cold start
open http://localhost:5173

Total cost: $0.


Service inventory

19 Python microservices + 6 infrastructure containers = 25 containers per host.

Aegis services

ServicePort (internal)PurposeMemory limit
gateway8000Auth · rate limit · PII/injection scan · request routing1 GB
decision800010-layer risk pipeline · cumulative-risk quarantine576 MB
policy8000OPA client wrapper · policy CRUD480 MB
audit8000ed25519-signed chain · 16 shards per tenant · Merkle root sealing512 MB
registry8000Agent + permission CRUD · allow-list enforcement480 MB
identity8000Tenant + user + role · Clerk provisioning480 MB
api8000Employee virtual keys · incidents · ARE workflow192 MB
usage8000Cost telemetry · outbox reconciliation160 MB
behavior8000Per-agent baseline · drift detection640 MB
autonomy8000Contracts · overrides · playbooks320 MB
forensics8000Timeline · investigation · replay320 MB
flight_recorder8000Step-level replay · phase timing128 MB
identity_graph8000Blast radius · compromise simulation160 MB
insight8000Cross-tenant correlation192 MB
insight_worker—Background insight computation128 MB
learning—Signal weight tuning (offline)128 MB
witness8000ATF v3.2 §6 execution attestation192 MB
mcp_gate8000MCP protocol authentication + rate192 MB
mcp_serverstdioMCP protocol bridge (no HTTP)128 MB
security(library)Signal registry — 34 MITRE-tagged signals—

Infrastructure containers

ServicePurpose
opaRego policy engine (Open Policy Agent 0.69)
postgres / pgbouncerData plane · connection pool
redisCache · rate-limit token bucket · audit stream · pub/sub
prometheus / grafana / alertmanagerMetrics + dashboards + paging
jaegerDistributed tracing (opt-in per request)
uiReact SPA (Vite) served by nginx
bundle-serverSigned bundle distribution

📦 SDK packages

Four provider-specific SDKs + one offline verifier. All published to PyPI.

pip install 'aegis-anthropic==1.1.5'    # Anthropic Claude
pip install 'aegis-openai==1.1.6'       # OpenAI GPT
pip install 'aegis-langchain==1.1.7'    # LangChain
pip install 'aegis-bedrock==1.1.7'      # AWS Bedrock
pip install 'aegis-aevf==1.1.1'         # offline compliance verifier

Three integration patterns

Pattern A — decorate a plain Python function:

from sdk.acp_client import Client, DeniedError
acp = Client()

@acp.protect(agent_id="my_agent", tool="db.query")
def query(sql: str) -> list[dict]:
    return db.execute(sql)

Pattern B — framework-dispatched tools (LangChain, CrewAI, AutoGen):

from sdk.acp_client import Client
acp = Client()
decision = acp.guard(tool="read_file", parameters={"path": path})
result = open(path).read()  # only runs if allow

Pattern C — LLM proxy (full prompt scanning):

from aegis_anthropic import AegisAnthropicProxy
client = AegisAnthropicProxy(
    employee_key=os.environ["AEGIS_EMPLOYEE_KEY"],
    gateway_url="https://aegisagent.in",
)
resp = client.messages.create(
    model="claude-sonnet-4-5", max_tokens=1024,
    messages=[{"role": "user", "content": "Summarize this doc: ..."}],
)

Every prompt is PII-scanned, injection-scanned, cost-capped before it reaches Claude. See setup §4 for the full walkthrough.


🔒 Security layers

Every request passes through 10 checks. Each has its own status code + reason so you always know what stopped it.

LayerWhereBlocksFail mode
1AWS WAFbot UA · rate-based · SQL injection signaturesfail-open (upstream)
2Gateway authinvalid key · missing header · expired JWTfail-CLOSED (401)
3Cross-tenantX-Tenant-ID mismatchfail-CLOSED (403)
4Cost capmax_tokens > ceiling · input > 24 000 charsfail-CLOSED (400)
5PII scannerSSN · CC (Luhn) · API keys · private-key PEMfail-CLOSED (400)
6Injection scanner30+ regex patterns + NFKC normalizefail-CLOSED (403)
7Agent allow-listtool not in registry allow-listfail-CLOSED (403)
8OPA policytenant-configured Rego rulesfail-CLOSED per config
9Cumulative riskquarantine on 50+ failures in 5 minfail-CLOSED (403)
10Audit chained25519 sign + shard-lock appendfail-async (never blocks request path)

Test evidence: test report §7-9 — real destructive tests against production, all findings documented (including the ones that didn't pass).


📊 What we tested + published

The report at docs/testing/2026-07-26/report.md is a 16-section engineering paper in the format Anthropic + Cloudflare publish theirs. It includes:

  • Threat model — assets, actors, boundaries, assumptions
  • Architecture rationale — why we chose each component + what we rejected
  • Attack coverage matrix — 123 payloads, per-class breakdown
  • Chaos engineering — real destructive tests: kill Decision / Audit / OPA / Gateway, measure recovery
  • Scalability sweep — 50 → 2 000 concurrent workers, find the breaking point
  • Resource metrics — CPU + memory + queue depth under load
  • Cost analysis — real AWS bill, per-10M-request projection
  • 6 SVG charts — latency histograms, CDFs, scalability, chaos timeline
  • 4 Mermaid diagrams — chain flow, request lifecycle, attack layers, ALB failover
  • Honest limitations — 3 open bugs called out in the executive summary

Headline numbers: 88.7 % recall · 98.6 % precision · 0 chain violations · 100 % PII/cost/scope block · 16 s Decision-service fail-closed recovery.


🔧 Configuration

Every knob is an env var or a Redis key. The tuning ones that matter:

SettingDefaultWhereWhat it does
MAX_TOKENS_CEILING2048gateway envHard cap on max_tokens per LLM call
MAX_INPUT_CHARS24 000gateway envHard cap on prompt character count
LLM_DRIP_THRESHOLD20/60sgateway envSlow-drip correlation threshold
RUNAWAY_FAILURE_THRESHOLD50/5mincode constAuto-quarantine threshold per agent
OPA_FAIL_MODEclosedgateway envWhat OPA does when unreachable
AUDIT_CHAIN_SHARD_COUNT16audit envPer-tenant chain parallelism
ACP_AUTH_PROVIDERbothgateway envlegacy (HS256) / clerk (RS256) / both
tenant requests_per_second10Postgres tenants rowPer-tenant token bucket refill
tenant burst20Postgres tenants rowPer-tenant token bucket size
agent daily_inference_cost_cap_usdNULLPostgresPer-agent daily $ cap (opt-in)

🎛️ Operations

Monitoring surfaces

  • Live status: https://aegisagent.in/status — 13/13 operational should always be true
  • Grafana: provisioned dashboards in infra/grafana-dashboards/
    • platform-slo.json — request rate · error budget · availability
    • trust-layers.json — chain integrity · signed receipts · Merkle root age
    • tenant-activity.json — per-tenant traffic + deny rate
    • queues.json — audit stream · DLQ · outbox
  • Alerts: in infra/prometheus-rules.yml
    • Highest priority: ChainViolationImmediate — pages on any chain-integrity failure

Runbooks

Located in docs/runbooks/ — every one structured Alert → Immediate action → Recovery steps → Verification:

  • audit_chain_violation.md — highest severity, freeze writes + investigate
  • key_rotation.md — 90-day rotation cadence
  • restore_drill.md — cross-region DR
  • tenant_data_request.md — GDPR / DPDP right-to-portability + right-to-erasure

📚 Documentation index

DocPurpose
docs/setup.mdClient-facing setup guide (12 sections, SDK examples, attack coverage table)
docs/testing/2026-07-26/report.mdPublic engineering test report (16 sections, threat model, chaos, charts)
docs/guide.mdEnd-to-end evaluator → signup → integration → rollout guide
docs/architecture-failure-modes.mdPer-component failure behavior
docs/security/rbac_matrix.mdEvery endpoint → role required
docs/security/subprocessors.mdThird-party vendors + data flow
docs/api/reference.mdFull HTTP API reference
docs/runbooks/Operational runbooks
SECURITY.mdResponsible-disclosure policy
CONTRIBUTING.mdHow to contribute

🤝 Contributing

  • Bug reports + feature ideas: open an issue
  • Security disclosures: email founder@aegisagent.in — see SECURITY.md
  • PRs: read CONTRIBUTING.md; every merged change must have a test.
  • Pattern-recall improvements: the biggest open area — see test report §14. If you can add an injection payload that Aegis missed, that's a valid contribution.

⚖️ License


Ship AI agents you can defend under oath.

Live · Setup · Test report · Docs · Blog · Email

↑↓ navigate openesc close