Skip to main content
Glama
tomjwxf

protect-mcp

by tomjwxf

⚠️ Este repositorio se ha movido. El desarrollo activo continúa en ScopeBlind/scopeblind-gateway.

Este fork personal puede estar desactualizado respecto al repositorio canónico. Por favor, utilice el repositorio de la organización para problemas, solicitudes de extracción (pull requests) y el código más reciente.

protect-mcp

Puerta de enlace de seguridad para servidores MCP. Registros en modo sombra por defecto, políticas por herramienta, recibos locales opcionales con Ed25519 y salida de auditoría fácil de verificar.

Ruta actual de la CLI: envuelve cualquier servidor MCP stdio como un proxy transparente. En modo sombra, registra cada solicitud tools/call y permite que todo pase. Añada un archivo de política para aplicar reglas por herramienta. Ejecute protect-mcp init para generar claves de firma locales y configuración, de modo que la puerta de enlace también pueda emitir recibos firmados.

Inicio rápido

# Wrap an existing OpenClaw / MCP config into a usable pack
npx @scopeblind/passport wrap --runtime openclaw --config ./openclaw.json --policy email-safe

# Shadow mode — log every tool call, enforce nothing
npx protect-mcp -- node my-server.js

# Generate keys + config template for local signing
npx protect-mcp init

# Shadow mode with local signing enabled
npx protect-mcp --policy protect-mcp.json -- node my-server.js

# Enforce mode
npx protect-mcp --policy protect-mcp.json --enforce -- node my-server.js

# Export an offline-verifiable audit bundle
npx protect-mcp bundle --output audit.json

Related MCP server: protect-mcp

Qué hace

protect-mcp se sitúa entre su cliente MCP y el servidor como un proxy stdio:

MCP Client ←stdin/stdout→ protect-mcp ←stdin/stdout→ your MCP server

Intercepta las solicitudes JSON-RPC tools/call y:

  • Modo sombra (por defecto): registra cada llamada a herramienta y permite que todo pase

  • Modo de cumplimiento: aplica reglas de política por herramienta como block, rate_limit y min_tier

  • Firma local opcional: cuando la firma está configurada, emite un recibo firmado con Ed25519 junto con el registro estructurado

Todos los demás mensajes MCP (initialize, tools/list, notificaciones) pasan de forma transparente.

Qué incluye hoy

  • Políticas por herramienta — bloquee herramientas destructivas, limite la tasa de las costosas y adjunte requisitos de nivel mínimo

  • Registros de decisión estructurados — cada decisión se emite a stderr con [PROTECT_MCP]

  • Recibos locales firmados opcionales — generados cuando se ejecuta con una política que contiene signing.key_path, guardados en .protect-mcp-receipts.jsonl y expuestos en http://127.0.0.1:9876/receipts

  • Verificación sin conexión — verifique recibos o paquetes con npx @veritasacta/verify

  • No se requiere cuenta — claves locales, política local, proceso local

Límites de capacidad actuales

Esto es importante antes de implementar esto o hablar con los usuarios:

  • La firma no es automática en la ruta básica npx protect-mcp -- .... Esa ruta registra decisiones en modo sombra. Para la firma local, ejecute npx protect-mcp init y luego inicie la puerta de enlace con el archivo de política generado.

  • Las comprobaciones de política conscientes del nivel están activas, pero la admisión de manifiestos no está conectada a la ruta CLI/stdio por defecto. La CLI establece las sesiones como unknown a menos que una integración de host llame a la API de admisión mediante programación.

  • La configuración de credenciales actualmente valida las referencias de credenciales respaldadas por variables de entorno y registra etiquetas de credenciales en registros/recibos. La inyección genérica por llamada en herramientas stdio arbitrarias es específica del adaptador y no la realiza la ruta de proxy por defecto.

  • Los adaptadores PDP externos y los ayudantes de paquetes de auditoría existen como utilidades exportadas. Aún no están completamente conectados a la ruta CLI por defecto.

Archivo de política

{
  "default_tier": "unknown",
  "tools": {
    "dangerous_tool": { "block": true },
    "admin_tool": { "min_tier": "signed-known", "rate_limit": "5/hour" },
    "read_tool": { "require": "any", "rate_limit": "100/hour" },
    "*": { "rate_limit": "500/hour" }
  },
  "signing": {
    "key_path": "./keys/gateway.json",
    "issuer": "protect-mcp",
    "enabled": true
  },
  "credentials": {
    "internal_api": {
      "inject": "env",
      "name": "INTERNAL_API_KEY",
      "value_env": "INTERNAL_API_KEY"
    }
  }
}

Reglas de política

Campo

Valores

Descripción

block

true

Bloquear explícitamente esta herramienta

require

"any", "none"

Requisito de acceso básico

min_tier

"unknown", "signed-known", "evidenced", "privileged"

Nivel mínimo requerido si su host establece el estado de admisión

rate_limit

"N/unit"

Límite de tasa (ej. "5/hour", "100/day")

Los nombres de las herramientas coinciden exactamente, con "*" como comodín de respaldo.

Configuración del cliente MCP

Claude Desktop

Añada a claude_desktop_config.json:

{
  "mcpServers": {
    "my-protected-server": {
      "command": "npx",
      "args": [
        "-y", "protect-mcp",
        "--policy", "/path/to/protect-mcp.json",
        "--enforce",
        "--", "node", "my-server.js"
      ]
    }
  }
}

Cursor / VS Code

El mismo patrón: reemplace el comando del servidor con protect-mcp envolviéndolo.

Opciones de CLI

protect-mcp [options] -- <command> [args...]
protect-mcp init

Commands:
  init              Generate Ed25519 keypair + config template
  status            Show decision stats and local passport identity
  digest            Generate a local human-readable summary
  receipts          Show recent persisted signed receipts
  bundle            Export an offline-verifiable audit bundle

Options:
  --policy <path>   Policy/config JSON file
  --slug <slug>     Service identifier for logs/receipts
  --enforce         Enable enforcement mode (default: shadow)
  --verbose         Enable debug logging
  --help            Show help

Ganchos programáticos

La biblioteca también expone las primitivas que aún no están conectadas a la ruta CLI por defecto:

import {
  ProtectGateway,
  loadPolicy,
  evaluateTier,
  meetsMinTier,
  resolveCredential,
  initSigning,
  signDecision,
  queryExternalPDP,
  buildDecisionContext,
  createAuditBundle,
} from 'protect-mcp';

Úselas si desea añadir:

  • admisión de manifiesto antes de que comience una sesión

  • un PDP externo (OPA, Cerbos o un webhook HTTP genérico)

  • integraciones personalizadas mediadas por credenciales

  • exportación de paquetes de auditoría alrededor de su propio almacén de recibos

Registros de decisión y recibos

Cada llamada a herramienta emite JSON estructurado a stderr:

[PROTECT_MCP] {"v":2,"tool":"read_file","decision":"allow","reason_code":"observe_mode","policy_digest":"none","mode":"shadow","timestamp":1710000000}

Cuando la firma está configurada, sigue un recibo firmado:

[PROTECT_MCP_RECEIPT] {"v":2,"type":"decision_receipt","algorithm":"ed25519","kid":"...","issuer":"protect-mcp","issued_at":"2026-03-22T00:00:00Z","payload":{"tool":"read_file","decision":"allow","policy_digest":"...","mode":"shadow","request_id":"..."},"signature":"..."}

Verifique con la CLI: npx @veritasacta/verify receipt.json Verifique en el navegador: scopeblind.com/verify

Paquetes de auditoría

El paquete exporta un ayudante para paquetes de auditoría autónomos:

{
  "format": "scopeblind:audit-bundle",
  "version": 1,
  "tenant": "my-service",
  "receipts": ["..."],
  "verification": {
    "algorithm": "ed25519",
    "signing_keys": ["..."]
  }
}

Use createAuditBundle() alrededor de sus propios recibos firmados recopilados.

Filosofía

  • Primero sombra. Vea lo que hacen los agentes antes de aplicar nada.

  • Los recibos superan a los registros solo de panel. Los artefactos firmados deben ser verificables de forma independiente.

  • Mantenga las afirmaciones ajustadas. La ruta CLI por defecto aún no hace todo lo que la arquitectura a largo plazo soportará.

  • Capa sobre la autenticación existente. No desmonte su pila solo para añadir control y evidencia.

Paquetes de políticas anclados a incidentes

Se envían con protect-mcp: cada uno previene un ataque real:

Política

Incidente

Categorías OWASP

clinejection.json

CVE-2025-6514: Secuestro de proxy OAuth MCP (437K entornos)

A01, A03

terraform-destroy.json

Agente Terraform autónomo destruye producción

A05, A06

github-mcp-hijack.json

Inyección de prompt mediante issue de GitHub manipulado

A01, A02, A03

data-exfiltration.json

Robo de datos del agente mediante abuso de herramientas salientes

A02, A04

financial-safe.json

Transacción financiera no autorizada

A05, A06

npx protect-mcp --policy node_modules/protect-mcp/policies/clinejection.json -- node server.js

Asignación completa de OWASP Agentic Top 10: scopeblind.com/docs/owasp

BYOPE: Motores de política externos

Soporta OPA, Cerbos, Cedar (AWS AgentCore) y puntos finales HTTP genéricos:

{
  "policy_engine": "hybrid",
  "external": {
    "endpoint": "http://localhost:8181/v1/data/mcp/allow",
    "format": "cedar",
    "timeout_ms": 200,
    "fallback": "deny"
  }
}

Estándares y PI

  • IETF Internet-Draft: draft-farley-acta-signed-receipts-00 — Recibos de decisión firmados para control de acceso máquina a máquina

  • Estado de la patente: 4 patentes provisionales australianas pendientes (2025-2026) que cubren recibos de decisión con divulgación configurable, puerta de enlace de llamada a herramientas, manifiestos de agente e identidad portátil

  • Verificación: Licencia MIT — npx @veritasacta/verify --self-test

Licencia

MIT: libre de usar, modificar, distribuir y construir sobre él sin restricciones.

scopeblind.com · npm · GitHub · IETF Draft

Available Tools

5 tools
delete_fileB

Delete a file from the filesystem

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to delete

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose that deletion is irreversible or mention behavior for missing paths or directories, which is critical for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short and front-loaded, but could be improved by including context about irreversibility without significant length increase.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive operation with no output schema or annotations, the description lacks completeness: no mention of return values, errors, or required permissions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the parameter description 'File path to delete' is already clear; the description adds no extra meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'delete' and the resource 'file from the filesystem', distinguishing it from sibling tools like read_file (read) and write_file (write).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, no context about prerequisites or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deployC

Deploy the application to production

ParametersJSON Schema
NameRequiredDescriptionDefault
reasonNoDeployment reason
environmentYesTarget environment

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description fails to disclose behavioral traits like destructiveness, auth requirements, or failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely short (5 words), but underspecified – conciseness should not sacrifice necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema; description does not explain return values, side effects, or deployment process outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameters are already well-documented. Description adds no extra meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states 'deploy the application to production' – clear verb and resource, but slightly misleading as schema allows staging also. No confusion with sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, no prerequisites or when-not-to-use mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_fileB

Read the contents of a file

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to read

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description only mentions reading without specifying encoding, size limits, existence requirements, or return format, leaving behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise single-sentence description that is front-loaded and efficient with no unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite simplicity, description lacks details on return format, error handling, and behavioral constraints, which are critical for an agent invoking a file read tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a single parameter 'path' described as 'File path to read'; description adds no additional meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'read' and resource 'contents of a file', distinguishing it from sibling tools like write_file and delete_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives; usage is implied by the name and description but lacks context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

write_fileC

Write content to a file

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to write
contentYesContent to write

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description does not disclose important behavioral traits such as whether the file is overwritten, permissions required, or error handling. Without annotations, the description carries the full burden, and it is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, to-the-point sentence with no wasted words. It earns its place by conveying the core action concisely.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple file write tool, the description lacks completeness. It does not mention return values, overwrite behavior, or any constraints, making it less useful for an AI agent to fully understand the tool's effect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for both parameters, so the description adds no extra meaning. Baseline 3 is appropriate; the schema already documents path and content adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Write content to a file' clearly states the verb 'Write' and the resource 'content to a file', distinguishing it from sibling tools like read_file and delete_file. However, it does not specify whether it overwrites or appends, which would add more precision.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. An explicit mention of use cases or exclusions (e.g., when to use deploy instead) is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updates
    • First observeddelete_file
    • First observeddeploy
    • First observedread_file
    • First observedweb_search
    • First observedwrite_file

TDQS

B3.2/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct action: file operations (delete, read, write), deployment, and web search. There is no overlap or ambiguity between them.

Naming Consistency4/5

Most tools follow verb_noun pattern (delete_file, read_file, write_file, web_search), but 'deploy' lacks a noun, breaking the consistent pattern slightly.

Tool Count4/5

5 tools is a reasonable count, but the mix of file management, deployment, and web search seems odd for a single server scope.

Completeness2/5

The tool set lacks obvious necessary operations for any single domain: e.g., no update for files, no environment or config for deployment, making it incomplete for a coherent purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    MCP server for offline verification of signed artifacts — receipts, manifests, and audit bundles. MIT licensed, works without accounts or API calls. Tools: self_test, verify_receipt, verify_bundle, explain_artifact.
    4
    64 npm
    5
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Security gateway for MCP servers. Wraps any MCP server with per-tool policies (Cedar + JSON), Ed25519-signed decision receipts, human approval gates, and trust tiers. Shadow mode by default — logs everything, blocks nothing.
    789 npm
    9
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Security gateway for MCP tool calls. Sits between your LLM client and MCP servers, enforcing per-tool policies (allow/block/approve/read-only), logging every call, and pausing dangerous operations for human approval in terminal or Slack.
    2 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Self-hosted MCP gateway that applies deterministic, compiled policy to tool discovery, invocation, and outbound data flow, with no model in the enforcement path. Every decision emits a hash-chained receipt sealed with Ed25519 and verifiable using public keys only.
    Apache 2.0