Skip to main content
Glama
mcp-policy-gateway

mcp-policy-gateway

by jcorrego

mcp-policy-gateway

정책 우선(policy-first) MCP 서버 참조 구현입니다. 에이전트에게 유용한 도구를 제공하면서도, 모델이 권한 부여를 결정하거나, 테넌트 경계를 넘거나, 직접적인 PII를 유출하거나, 고영향 변경을 스스로 실행하지 못하도록 하는 방법을 보여줍니다.

이는 포트폴리오/참조 구현입니다. 모든 레코드는 합성 데이터이며, 프로덕션 소프트웨어가 아니며 은행, 결제 처리자, 고객 시스템과의 통합을 주장하지 않습니다.

왜 존재하는가

일반적인 MCP 데모는 원시 API를 모델에 노출하고 성공적인 도구 호출을 보안 모델로 취급합니다. 이 프로젝트는 반대 입장을 취합니다:

  • 정책은 결정적입니다. 모델은 스스로를 승인할 수 없습니다.

  • 테넌트 경계는 서버 측에서 강제됩니다. 도구 인자가 테넌트를 변경할 수 없습니다.

  • 도구 출력은 최소화됩니다. 계정 요약은 의도적으로 소유자 이름과 이메일을 제외합니다.

  • 고영향 작업은 승인 게이트에서 중단됩니다. 동결 요청은 상태 변경을 생성하지 않습니다.

  • 모든 결정은 감사 가능합니다. 허용, 거부, 승인 필요 결과는 구조화된 감사 이벤트를 생성합니다.

  • 변경 요청에는 사유와 멱등성 키가 필요합니다.

Related MCP server: Aegis

아키텍처

MCP client / agent
       │ tool call
       ▼
FastMCP stdio adapter
       │ verified principal (demo fixture here)
       ▼
GatewayService ──► PolicyEngine ──► allow / deny / require approval
       │                 │
       ▼                 ▼
synthetic domain data   structured audit event

프로덕션 배포에서는 주체(principal)가 모델 컨텍스트 외부의 검증된 ID/세션에서 파생되어야 합니다. tenant_id, 역할, 범위를 도구 인자나 모델 출력에서 절대 수락하지 마십시오.

도구

도구

위험

동작

get_case(case_id)

읽기

호출자의 테넌트에 속하고 올바른 범위가 있는 경우에만 케이스를 허용합니다.

get_account_summary(account_id)

읽기

최소화된 요약을 반환하며, 직접적인 PII는 절대 반환하지 않습니다.

request_account_freeze(...)

변경

범위, 사유, 멱등성 키가 필요하며, 이후 항상 인간 승인이 필요합니다.

빠른 시작

Python 3.11+ 필요.

python -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest
.venv/bin/ruff check .

MCP stdio 서버로 실행:

.venv/bin/mcp-policy-gateway

어댑터는 로컬 탐색을 위해 의도적으로 고정된 데모 주체를 사용합니다. 실제 ID 전파는 여기서 가짜로 구현하지 않고 프로덕션 통합 고려 사항으로 의도적으로 문서화합니다.

입증된 남용 통제

테스트는 게이트웨이가 다음을 증명합니다:

  1. tenant_red의 에이전트가 tenant_blue 데이터를 읽으려는 시도를 거부합니다;

  2. 필수 범위가 없는 도구 호출을 거부합니다;

  3. 요약 도구를 통해 소유자 이름이나 이메일을 반환하지 않습니다;

  4. 계정 상태를 변경하는 대신 require_approval을 반환합니다; 그리고

  5. 사유나 멱등성 키가 누락된 상태 변경 요청을 거부합니다.

위협 모델 및 비목표

THREAT_MODEL.md를 참조하십시오. 설계는 의도적으로 좁습니다: MCP 도구 주변의 정책 경계를 보여주며, 완전한 ID 인프라, 지속적 감사 저장소, 비밀 관리, 또는 결제/원장 시스템을 다루지 않습니다.

인터뷰 워크스루

프로젝트를 간결하게 설명하는 방법:

저는 MCP 경계를 설계하여 모델이 안전하고 범위가 제한된 데이터에 대해 추론할 수 있지만, 접근을 결정하거나 고영향 작업을 실행할 수 없도록 했습니다. 권한 부여는 결정적이며, 테넌트 격리는 서버 측에서 강제되고, 도구 표면은 PII를 최소화하며, 민감한 변경은 감사 가능한 인간 승인 게이트에서 종료됩니다.

개발

.venv/bin/pytest
.venv/bin/ruff check .

CI는 푸시와 풀 리퀘스트 모두에서 두 검사를 실행합니다.

라이선스

MIT. LICENSE를 참조하십시오.

Available Tools

3 tools
get_account_summaryB

Return a minimized account summary; this tool never exposes direct PII.

Inputs: account_id (required).

get_caseA

Retrieve a support case inside the caller's tenant boundary.

Inputs: case_id (required).

request_account_freezeB

Request a high-impact account freeze. Policy always requires human approval.

Inputs: reason (required), account_id (required), idempotency_key (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool targets a distinct resource/action: case retrieval, account summary (with PII restriction), and a freeze request. There is no overlap in purpose, and the descriptions clearly differentiate the operations.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (get_case, get_account_summary, request_account_freeze). The verbs are clear and the nouns identify the target, making the set predictable and easy to navigate.

    Tool Count5/5

    With only 3 tools, the server is tightly scoped and each tool serves a distinct, essential function within the policy gateway context. This is within the typical 3-15 range and feels appropriately lean rather than sparse.

    Completeness3/5

    The tools cover core read operations and a high-impact action, but there are notable gaps: no listing of cases or accounts, no update/modification paths, and no way to track the status of a freeze request. Agents would need to work around these missing operations.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      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
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables governing tenant-aware MCP tools with policy enforcement, scoped access, human approval workflows, and tamper-evident audit logging.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and MCP clients to safely access upstream MCP servers through centralized policy enforcement, including allow/deny/approval decisions, schema pinning, circuit breakers, and audit logging.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enforces default-deny policies, budgets, and tamper-evident audit logging for MCP tool calls before they reach upstream servers.
      -