Skip to main content
Glama
Anshv784
by Anshv784

AgentGate

AIエージェントのための管理されたツールコールゲートウェイ。Terminal 3のADK上に構築。

LLMエージェントにAPIキーを与えると、それは何でも呼び出し、何でも費やし、何でも漏洩させることができます。そして、その事実を後から知るのは、エージェント自身が書いたログを通してです。

AgentGateは、エージェントと外界の間にハードウェア分離されたエンクレーブを置きます。エージェントはURLではなくエンドポイントを指定します。エージェントは資格情報を保持せず、ユーザーの個人データを見ることもありません。そして、許可された試行も拒否された試行も、すべて編集不可能な台帳に記録されます。

これはMCPサーバーとして提供されるため、あらゆるMCPクライアント(Claude Code、Claude Desktop、Cursor、SDKエージェント)は、設定エントリを1つ追加するだけで管理されたツールコールを利用できます。フレームワークの導入も、書き換えも不要です。

  MCP client (Claude / Cursor / your agent)
    │  call_endpoint { endpoint: "resend", path: "/emails",
    │                  body: { to: ["{{profile.verified_contacts.email.value}}"] } }
    ▼
  AgentGate MCP server            ← holds the T3N session; the model holds nothing
    │
    ▼
┌─ z:<tid>:agentgate — TEE contract (Rust → WASM, Intel TDX) ───────────────┐
│  1. every {{…}} marker must be profile.* AND on this endpoint's allowlist │
│  2. path must be one the tenant enumerated — exact match, no globs        │
│  3. credential read from the sealed z:<tid>:secrets map                   │
│  4. host substitutes real PII inside the enclave (contract never sees it) │
│  5. upstream response projected to declared fields only                   │
│  6. ledger entry appended — for ALLOWED and DENIED alike                  │
└───────────────────────────────────────────────────────────────────────────┘
    ▼
  api.resend.com   ← reached only if the data owner's grant permits this host

動作実績。これが証拠です

T3Nテストネットに対するnpm run demo — 以下のすべての呼び出しは、組織が発行したエージェントによって行われます。

🛑 DENIED   profile field outside the endpoint's allowlist  ({{profile.ssn}})
            marker rejected: 'ssn' is not in this endpoint's allowed_placeholders
🛑 DENIED   marker reaching for another namespace  ({{secret.resend_api_key}})
            marker rejected: 'secret.resend_api_key' is not a profile marker
🛑 DENIED   path the tenant never enumerated  (/domains)
            path rejected: '/domains' is not in this endpoint's allowed_paths
🛑 DENIED   endpoint that does not exist  (stripe)
            unknown endpoint

── policy is per-ENDPOINT, not per-host ──────────────────────────────
   'resend' and 'resend-notify' share a host AND a credential.
   The same marker is allowed on one and refused on the other.

✅ ALLOWED  {{profile.first_name}} via 'resend'        (allowlisted there)
            {"data":{"id":"d7299ce6-668f-47f2-8e22-8f3f96c0f255"},"status":200}
🛑 DENIED   {{profile.first_name}} via 'resend-notify' (allowlist is empty)
            marker rejected: 'first_name' is not in this endpoint's allowed_placeholders
✅ ALLOWED  no markers via 'resend-notify'             (allowed, returns nothing)
            {"data":{},"status":200}

実際のメールが配信されました。受信者のアドレスと名前は、データ所有者のプロフィールからエンクレーブ内で解決されました。それらは、エージェントの入力、MCPトランスポート、コントラクトのメモリ、台帳のどこにも現れません。

最後の行は、デフォルト拒否のレスポンス投影です。resend-notifyはresponse_fieldsを宣言しないため、成功した呼び出しはステータスコードと空のオブジェクトを返します。上流のメッセージIDでさえも差し控えられます。

その後の台帳:

denied     0  resend/emails         markers=["profile.ssn", …]        'ssn' not allowed here
denied     0  resend/emails         markers=["secret.resend_api_key"] not a profile marker
denied     0  resend/domains        markers=[]                        path not enumerated
denied     0  stripe/emails         markers=[]                        unknown endpoint
ok       200  resend/emails         markers=["first_name","last_name","verified_contacts.email.value"]
denied     0  resend-notify/emails  markers=["profile.first_name", …] 'first_name' not allowed here
ok       200  resend-notify/emails  markers=[]

マーカーの名前は記録されます。マーカーの値は記録されることは決してありませんでした。

Related MCP server: MCP Warden

クイックスタート

npm install
cp .env.example .env          # add your T3N_API_KEY from terminal3.io/claim-page
npm run test                  # 9 native policy tests, no network, no credits
npm run build                 # Rust → wasm32-wasip2
npm run deploy                # idempotent — safe to re-run
npm run doctor                # pre-flight a deployment you didn't just create
npm run demo                  # the run shown above

任意のMCPクライアントに追加:

{ "mcpServers": {
    "agentgate": { "command": "npx", "args": ["tsx", "/path/to/agentgate/mcp/server.ts"] } } }

エンドポイントの追加

ファイルは1つだけ。Rustも、コントラクトの再デプロイも不要です。

// agentgate.config.json
"endpoints": {
  "stripe": {
    "base": "https://api.stripe.com",
    "secret_key": "stripe_api_key",        // key in z:<tid>:secrets
    "auth_header": "Authorization",
    "auth_prefix": "Bearer ",
    "allowed_paths": ["/v1/customers"],    // exact match only
    "allowed_placeholders": ["first_name", "verified_contacts.email.value"],
    "response_fields": ["id"]              // everything else is dropped
  }
}

その後、npm run deployを実行します。wasmが変更されていない場合はコントラクト登録をスキップするため、エンドポイントの追加には約1,850クレジットではなく約160クレジットしかかかりません。

この設計がこの形になった理由

プラットフォームについて読んだのではなく、測定した結果から生まれた3つの決定があります:

  • 拒否はErrではなくOkを返します。 コントラクトの書き込みはエラー時にロールバックされるため、ポリシー拒否でErrを返すと、その拒否を記録する監査エントリもロールバックされます。エージェントはポリシーを繰り返しトリップさせ、痕跡を残さない可能性があります。

  • レスポンスは透過ではなく投影されます。 http-with-placeholdersは送信側のみを保護します。上流のレスポンスは完全な形でWASMに戻るため、リクエストをエコーするエンドポイントは、マーカーが差し控えたPIIを返してしまいます。これはdocs/BUGS.mdで実証されています。

  • コントラクトはContent-Typeを設定しません。 ホストアプリはあなたのものを置き換えるのではなく独自のものを追加するため、application/json,application/jsonが生成され、厳格な上流はそれを拒否します。HTTP 200と空のボディで、静かに拒否されます。docs/BUGS.md#1を参照してください。

リポジトリ構成

パス

内容

contract/

TEEコントラクト — policy.rsは純粋でネイティブテスト済み、gateway.rsはホストと通信

mcp/server.ts

MCPサーバー — 3つのツール

scripts/deploy.ts

冪等なデプロイ。contract_id台帳を所有

scripts/doctor.ts

事前チェックのヘルスチェック

scripts/demo.ts

上記で示した実行

agentgate.config.json

すべてのエンドポイントと許可を宣言的に定義(2つのエンドポイント、対照的なポリシー)

deployments.json

発行されたすべてのcontract_idのコミット済み台帳

docs/BUGS.md

プラットフォームに対する13件の指摘

docs/ARCHITECTURE.md

エンクレーブ境界がその位置にある理由

docs/HANDOVER.md

次に運用する人向けのランブック

contract-probe/

プレースホルダー表面をマッピングするために使用した使い捨て診断ツール — 出荷対象外

ステータス

@terminal3/t3n-sdk@5.2.0を使用してT3Nテストネットに対してエンドツーエンドで構築・検証済みで、完全な3アイデンティティフローを実行しています:

プリンシパル

保持するもの

上記の実行での役割

テナント

ethキー、資金あり

コントラクトを所有し、資格情報を封印し、ポリシーを列挙

データ所有者

独自のDID + プロフィール

エージェントに許可を与える。マーカーはそのプロフィールに対して解決される

エージェント

不透明なベアラートークンのみ、他には何も持たない

上記のすべての呼び出しを行う

エージェントの署名キーはTEE内で生成され、決して外部に出ませんでした。APIキーもURLも個人データも保持せず、自身の許可を検査するためにコアコントラクトにアクセスすることもできません。それでも、実際の受信トレイにパーソナライズされたメールを配信します。

そこに到達するには、Terminal 3がエージェントDIDに手動で資金を供給する必要がありました。新しく発行されたエージェントはゼロから始まり、1回の呼び出しで10,000トークンを予約しますが、セルフサービスのチャージ手段はありません(docs/BUGS.md#10)。すべての開発者が最初のエージェントでこれに遭遇するでしょう。

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to make authenticated API calls and run commands with secrets injected, while keeping credentials completely hidden from the model, with policy enforcement, grants, and audit logging.
    6
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to reach upstream MCP tool servers through a central policy gateway that authenticates each agent, enforces least-privilege and default-deny rules, and applies response obligations such as redaction, inference stripping, PII masking, and truncation. It also records every decision in a tamper-evident, hash-chained audit log that can be verified later.
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to securely reach enterprise tools and other agents through a governed gateway with pinned tool definitions, delegated authorization, content inspection, human approval, and signed audit trails.
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to call backend tools under per-agent policy, deciding which tools each agent can see, what arguments it may pass, how often it may call, and which writes wait for human approval. It also redacts secrets and PII from tool results, fences untrusted output against injection, and records every call in a hash-chained audit log.
    25 npm
    MIT