Skip to main content
Glama

MCP Airlock

CI License: MIT Python

MCP 도구를 위한 제로 트러스트 보안 게이트웨이. MCP Airlock은 모든 도구 호출을 변조 방지 출처가 포함된 단기적이고 컨텍스트에 바인딩된 권한 결정으로 전환합니다.

이 프로젝트의 존재 이유

에이전트 도구 생태계는 한 가지 고통스러운 경계에서 실패하고 있습니다: 신뢰할 수 없는 프롬프트 텍스트에서 권한이 부여된 도구 실행으로 넘어가는 단계입니다.

현재의 패턴은 대개 다음 중 하나입니다:

  • 정적 허용 목록 (에이전트는 도구 X를 호출할 수 있음)

  • 취약한 정규식 필터링

  • 무결성 보장이 없는 사후 로그

이러한 방식은 프롬프트 주입이 세션 도중 의도를 변경하여 조용한 권한 상승이나 데이터 유출을 유발할 때 실패합니다.

MCP Airlock은 MCP에 누락된 기본 요소를 통해 이 문제를 해결합니다:

  • 권한 임대(Capability Leases): 단기적이고 서명된 컨텍스트 바인딩 권한 (세션 + 의도 + 도구 범위 + 제약 조건)

  • 컨텍스트 인식 정책: 모든 호출에 대한 동적 승인 (위험 점수 + 도구 제약 조건 + 임대 확인)

  • 변조 방지 출처(Tamper-Evident Provenance): 모든 허용/거부 결정에 대한 추가 전용 해시 체인

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.

    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
    • 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