Skip to main content
Glama
MCP Airlock

MCP Airlock

by lara-muhanna

MCP Airlock

CI License: MIT Python

MCPツール向けのゼロトラストセキュリティゲートウェイ MCP Airlockは、すべてのツール呼び出しを、改ざん検知可能な来歴を持つ、短命でコンテキストに紐付いた機能決定へと変換します。

なぜこれが必要なのか

エージェントのツールエコシステムは、ある痛みを伴う境界線で失敗しています。それは、信頼できないプロンプトテキストから特権的なツール実行への移行です。

現在のパターンは通常、以下のいずれかです:

  • 静的な許可リスト(エージェントはツールXを呼び出せる)

  • 脆弱な正規表現フィルタリング

  • 完全性保証のない事後ログ

これらは、プロンプトインジェクションがセッション中に意図を改変し、密かに権限昇格やデータ流出を引き起こす場合に失敗します。

MCP Airlockは、MCPに欠けているプリミティブでこれを解決します:

  • 機能リース(Capability Leases): 短命で署名済み、コンテキストに紐付いた権利(セッション + 意図 + ツールスコープ + 制約)

  • コンテキスト認識ポリシー: すべての呼び出しに対する動的な認可(リスクスコア + ツール制約 + リースチェック)

  • 改ざん検知可能な来歴: すべての許可/拒否決定にわたる追記専用のハッシュチェーン

Related MCP server: mcp-permission-server

コアとなる革新

コンテキスト紐付け機能リース(CBCL)

各ツール呼び出しは、署名済みのリースに対して認可されます:

  • session_id に紐付け

  • intent_hash に紐付け

  • 特定のツールにスコープを限定

  • 時間制限付き

  • オプションの制約(例:許可されたドメイン、最大リスク)

プロンプトインジェクションが意図を変更しようとしたり、ツールのスコープを飛び越えようとしたりした場合、実行は拒否されます。

アーキテクチャ

flowchart LR
    A[Agent / MCP Client] -->|tools/call| B[MCP Airlock Server]
    B --> C[Risk Engine]
    B --> D[Capability Verifier]
    B --> E[Policy Engine]
    E -->|allow| F[Tool Adapter Layer]
    E -->|deny| G[Policy Deny Response]
    F --> H[External APIs / Internal Services]
    B --> I[Provenance Ledger Hash Chain]

信頼の境界

flowchart TB
    subgraph Untrusted
      U1[Prompt Content]
      U2[Agent Reasoning Trace]
    end

    subgraph Trusted Control Plane
      T1[MCP Airlock]
      T2[Policy + Lease Validation]
      T3[Signed Provenance Ledger]
    end

    subgraph External Targets
      X1[Public APIs]
      X2[Internal APIs]
    end

    U1 --> T1
    U2 --> T1
    T1 --> T2
    T2 --> X1
    T2 --> X2
    T1 --> T3

主な機能

  • initialize、tools/list、tools/call と互換性のあるMCP stdioサーバー

  • 機能発行ツール: airlock_issue_capability

  • エージェント/API使用状況分析ツール: airlock_usage_stats

  • API公開範囲測定ツール: airlock_exposure_report

  • ツールごとのリスクしきい値を持つポリシー適用ミドルウェア

  • プロンプトインジェクションのシグネチャスコアリング

  • SSRF耐性のあるHTTPツールアダプター (http_get_json)

  • 実際のAPI統合例 (weather_hourly)

  • 改ざん検知可能な来歴ログ + 検証コマンド

  • エージェントAPIセキュリティのためのサンドボックス強化ガイド

  • serve/demo/issue/verify/stats/exposure 用のCLI

2分でわかるクイックスタート

git clone https://github.com/lara-muhanna/mcp-airlock
cd mcp-airlock
python -m pip install -e .
python -m mcp_airlock --config examples/airlock.config.json demo

確認できること:

  • 人間に優しい要約(ハンドシェイク、機能、許可/拒否、監査の完全性)

  • 悪意のある呼び出しが平易な英語の理由で拒否される様子

  • 署名済みの来歴証拠

ワンコマンドのローカルデモ(インストール不要)

python -m mcp_airlock --config examples/airlock.config.json demo --city Austin --state Texas

デモ中の完全なJSONペイロードについては:

python -m mcp_airlock --config examples/airlock.config.json demo --raw

MCPサーバーとして実行

python -m mcp_airlock --config examples/airlock.config.json serve

MCPクライアントの設定例:

CLI

# Issue a capability directly
python -m mcp_airlock --config examples/airlock.config.json issue \
  --session-id sess-123 \
  --subject agent:planner \
  --tools weather_hourly,http_get_json \
  --intent "Plan safe outdoor activities" \
  --ttl-seconds 900 \
  --constraints '{"allowed_domains":["api.open-meteo.com"],"max_risk":0.6}'

# Verify audit integrity
python -m mcp_airlock --config examples/airlock.config.json verify-log

# API usage stats by agent
python -m mcp_airlock --config examples/airlock.config.json stats --lookback-hours 24

# API exposure measurement
python -m mcp_airlock --config examples/airlock.config.json exposure --lookback-hours 24

エージェント統合の例

実行:

python examples/agent_integration.py

このスクリプトは:

  • stdio経由でAirlockを起動

  • MCPのinitialize/listをネゴシエーション

  • リースを発行

  • 通常のツール呼び出しを実行

  • ブロックされるインジェクションされた呼び出しを実行

設定テンプレート

examples/airlock.config.json

{
  "secret_key": "dev-secret-change-this-before-production",
  "provenance_log": "./airlock-provenance.log",
  "max_ttl_seconds": 1800,
  "default_risk_threshold": 0.55,
  "tools": {
    "weather_hourly": {
      "require_capability": true,
      "risk_threshold": 0.7
    },
    "http_get_json": {
      "require_capability": true,
      "risk_threshold": 0.45,
      "allowed_domains": ["api.open-meteo.com", "geocoding-api.open-meteo.com"]
    }
  }
}

セキュリティモデルの概要

  1. エージェントが airlock_issue_capability を介してリースを要求。

  2. リースはHMAC署名され、session、intent_hash、tool_scope、expiry が含まれる。

  3. すべての tools/call リクエストには _capability と _context が含まれる。

  4. Airlockは以下を強制する:

    • リースの有効性 + 署名

    • セッションと意図の継続性

    • リスクしきい値

    • ツール固有の制約(例:ドメイン許可リスト)

  5. 決定 + 証拠は来歴ログにハッシュチェーンされる。

プロジェクト構造

mcp-airlock/
  mcp_airlock/
    cli.py
    server.py
    policy.py
    capability.py
    risk.py
    provenance.py
    config.py
    tool_ids.py
    tools/
      http_json.py
      weather.py
  examples/
    airlock.config.json
    agent_integration.py
  docs/
    CLIENT_SETUP.md
    SANDBOXING_AGENTIC_APIS.md

ロードマップ

  • アップストリームMCPプロキシモード(既存のMCPサーバーを透過的にラップ)

  • OPA/Regoポリシーバックエンド

  • OpenTelemetryトレース + SIEMシンク

  • 管理された機能ブローカー + 鍵ローテーション

  • インシデント対応のための署名済みリプレイパッケージ

コミュニティ

ライセンス

MIT

Available Tools

4 tools
airlock_audit_tailC

Read recent signed provenance events.

Inputs: limit.

airlock_issue_capabilityC

Issue a short-lived capability lease bound to session+intent.

Inputs: session_id (required), subject (required), tools (required), intent (required), +2 more.

http_get_jsonA

Fetch JSON from a public HTTPS API endpoint.

Inputs: url (required), query.

weather_hourlyA

Resolve US city/state and fetch hourly weather from Open-Meteo.

Inputs: city (required), state (required), hours.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool targets a distinct function (provenance auditing, capability issuance, generic HTTP fetching, and weather retrieval) with minimal overlap. An agent can easily distinguish when to use each based on the task requirements.

    Naming Consistency3/5

    Mixed naming patterns: two tools use 'airlock_' prefix with verbs (issue, audit_tail), while others use 'http_' prefix or no prefix (weather_hourly). The weather tool breaks the verb-first convention used by others, using a noun-adjective pattern instead.

    Tool Count3/5

    Four tools is acceptably compact but the set suffers from scope confusion, mixing core Airlock security functions with unrelated utility tools (weather, HTTP). This feels like two different servers merged together rather than a cohesive toolset.

    Completeness2/5

    The Airlock domain (capability management) is severely underdeveloped, offering only issuance and audit tail reading without revocation, validation, or capability listing. The utility tools (weather, HTTP) are also minimal, offering only hourly forecasts and GET requests without parameter customization.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables secure interaction between LLMs and MCP tools by applying zero-trust security controls, including sensitive data masking, file system protection, and policy enforcement.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enforces fine-grained, context-aware access control on MCP tool calls, with a tamper-evident, replayable audit log that records denials and verifies every decision.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM agents to enforce security policies by authorizing tool calls, scanning for prompt injection, checking memory writes, redacting PII, and accessing audit trails through MCP.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables production-hardened MCP tool serving with OAuth 2.1 audience-restricted tokens, purpose-bound tools, human-in-the-loop approvals, containment, and audit trails for AI agents.
      Apache 2.0