Skip to main content
Glama

cage-mcp-server

OpenSSF Scorecard

cage-mcp-server is an offline Model Context Protocol server that gives AI coding assistants deterministic application-security guardrails. It exposes ten bounded MCP tools backed directly by ten published npm security packages: sentinel-lint, pathcage, headersafe, redirectcage, envcage, cookiecage, zipcage, logcage, corscage, and jsoncage.

The server speaks JSON-RPC 2.0 over stdio. It supports the newline-delimited framing used by MCP stdio clients and strict Content-Length framing for harnesses that use that transport style.

Security model

  • Offline and deterministic: the server makes no network requests and does not depend on a model, a cloud API or a remote scanner.

  • No command execution: tool input is never evaluated, passed to a shell or executed as source. lint_security_code writes a snippet only so sentinel-lint can scan it as data.

  • Tightly bounded: JSON-RPC frames are limited to 2 MiB, header blocks to 8 KiB, and every tool applies stricter input limits before calling a security package.

  • Prototype-pollution resistant: __proto__, constructor and prototype keys are rejected in the JSON-RPC envelope before arguments are used. JSON text supplied as a string can still be audited for those keys by audit_json.

  • Filesystem minimization: the server never reads or writes caller-selected paths. The only filesystem write is a mode-0600 temporary source snippet in the operating-system temporary directory for lint_security_code; it is removed in a finally block before the tool returns. ZIP archives are inspected in memory and never extracted.

  • Secret minimization: dotenv values are never returned. Parsed Cookie values are redacted. Set-Cookie audit values are redacted. Use redact_log before putting potentially sensitive log data into a model transcript.

  • Fail-closed framing: malformed JSON, invalid UTF-8, duplicate length headers, unsupported headers, oversized frames and prototype-pollution keys produce bounded JSON-RPC errors rather than process crashes.

  • Static analysis limits: findings are deterministic guardrails, not proof that an application is secure. They complement review, testing and runtime controls.

Related MCP server: VibeGuard MCP Server

Install and run

Node.js 18 or newer is required.

From a source checkout:

npm ci
npm test
npm run smoke
node bin/cage-mcp-server.mjs

The process intentionally writes no startup banner. MCP clients own stdin and stdout.

MCP client configuration

The examples use the intended npm executable cage-mcp-server@1.0.0. Pinning the exact version prevents a future package release from being selected silently.

Claude Code

CLI registration:

claude mcp add cage-security -- npx -y cage-mcp-server@1.0.0

Equivalent project-scoped .mcp.json:

{
  "mcpServers": {
    "cage-security": {
      "command": "npx",
      "args": ["-y", "cage-mcp-server@1.0.0"]
    }
  }
}

Codex CLI

CLI registration:

codex mcp add cage-security -- npx -y cage-mcp-server@1.0.0

Equivalent ~/.codex/config.toml entry:

[mcp_servers.cage-security]
command = "npx"
args = ["-y", "cage-mcp-server@1.0.0"]
startup_timeout_sec = 10
tool_timeout_sec = 30

Cursor

Add this server to the Cursor MCP configuration:

{
  "mcpServers": {
    "cage-security": {
      "command": "npx",
      "args": ["-y", "cage-mcp-server@1.0.0"]
    }
  }
}

Windsurf

Open the MCP config file from the Cascade MCP menu and add:

{
  "mcpServers": {
    "cage-security": {
      "command": "npx",
      "args": ["-y", "cage-mcp-server@1.0.0"]
    }
  }
}

Refresh the MCP server list after saving.

Tool reference

MCP tool

Backing package

Purpose

Required input

audit_path

pathcage

Lexically resolve a path inside an absolute root and report traversal, encoded traversal and length violations. No filesystem access.

path

audit_headers

headersafe

Validate header names and values, audit CSP and Set-Cookie strings, and compare supplied headers with a strict baseline.

one of headers, csp, setCookie

audit_redirect

redirectcage

Evaluate relative or absolute redirect targets against explicit origin, host, protocol, query, fragment and blocked-path policy.

target

audit_env

envcage

Parse dotenv text without expansion or interpolation, optionally validate a schema, and report secret hygiene without returning values.

dotenv

audit_cookie

cookiecage

Parse Cookie headers with duplicate and encoding protection, or serialize a hardened Set-Cookie header.

mode plus mode fields

audit_zip_entries

zipcage

Inspect a small base64 ZIP archive in memory for traversal, polyglot structure, compression bombs, special files, encryption and metadata inconsistencies.

archiveBase64

redact_log

logcage

Sanitize line-forging controls and redact credentials, tokens, sensitive object keys and optional high-precision PII patterns.

exactly one of text, record

audit_cors

corscage

Lint a CORS policy and optionally evaluate a bounded request for origin, method, credential, preflight and private-network behavior.

none; policy recommended

audit_json

jsoncage

Inspect JSON text for duplicate keys, prototype-pollution keys, excess depth or size, unsafe numbers, Unicode hazards and NUL hazards.

json

lint_security_code

sentinel-lint

Scan one bounded source snippet for dangerous eval and HTML sinks, command-injection patterns, hardcoded credential shapes, insecure MCP configuration and risky GitHub Actions patterns.

code

Every tool accepts a JSON object and returns both MCP text content and structured content. An unsafe audit result normally has ok: false; it is not a tool execution failure. isError: true is reserved for operational failures inside the tool.

Example JSON-RPC exchange

Newline-delimited stdio:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"example-client","version":"1.0.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"audit_json","arguments":{"json":"{\"__proto__\":{\"x\":1}}"}}}

The final response has a structured result similar to:

{
  "ok": false,
  "findings": [
    {
      "code": "JSONCAGE_PROTOTYPE_KEY",
      "message": "prototype pollution key rejected",
      "position": 1,
      "key": "__proto__"
    }
  ]
}

Registry metadata

server.json describes the package for the Official MCP Registry using schema 2025-12-11. Its name matches the mcpName field in package.json, which is how the registry verifies npm package ownership.

glama.json declares draarivpatel-ui as the GitHub maintainer for Glama ownership claims.

Development

npm ci
npm test
npm run test:fuzz
npm run smoke
npm audit

The test suite uses only node:test. It covers direct behavior for all ten tools, newline-delimited and Content-Length stdio sessions, malformed JSON, oversized frames, prototype pollution, unknown methods, invalid arguments and repository hygiene.

Runtime dependencies are intentionally limited to the ten security packages. fast-check is the only development dependency, used only by the property-based fuzz tests. The fuzz suite uses seed 20261127 by default, and FUZZ_SEED can override it to replay a failure.

Repository layout

Path

Purpose

bin/cage-mcp-server.mjs

Executable stdio entrypoint

src/server.mjs

JSON-RPC validation, hybrid framing, lifecycle and tool dispatch

src/tools.mjs

Tool schemas, strict input validation and package adapters

src/validation.mjs

Bounded validation helpers and prototype-key rejection

test/

Unit, integration, adversarial and hygiene tests

scripts/smoke-mcp.mjs

Live stdio smoke test used by CI

server.json

Official MCP Registry publishing metadata

glama.json

Glama maintainer ownership metadata

License

MIT. See LICENSE.

Available Tools

10 tools
audit_corsAudit a CORS policyC

Lint a CORS configuration with corscage and optionally evaluate a bounded request shape for origin, method, preflight, credential, private-network, and header exposure decisions.

Inputs: policy, evaluate.

audit_envAudit dotenv contentB

Parse dotenv text with envcage without shell expansion or interpolation, optionally validate it against a small schema DSL, and report secret hygiene without returning secret values.

Inputs: dotenv (required), schema, maxBytes, maxEntries, +3 more.

audit_headersAudit HTTP security headersB

Audit HTTP headers with headersafe, including CSP and Set-Cookie analysis, CRLF validation, and comparison against a strict security header baseline.

Inputs: csp, headers, setCookie.

audit_jsonAudit a JSON payloadB

Inspect JSON text with jsoncage for duplicate keys, prototype pollution keys, depth, size, node count, unsafe numbers, invalid Unicode, BOM, and NUL hazards.

Inputs: json (required), options.

audit_pathAudit a path for traversal outside a rootB

Resolve a caller-supplied path inside an absolute root with pathcage and report traversal, encoded traversal, symlink-independent lexical escapes, and length violations. This is lexical and does not read the filesystem.

Inputs: path (required), root, decodeCheck, maxPathLength.

audit_redirectAudit a redirect targetC

Check a relative or absolute redirect target with redirectcage against explicit origin, host, protocol, query, fragment, dot-segment, and blocked-path policy.

Inputs: target (required), fallback, allowHash, maxLength, +10 more.

audit_zip_entriesAudit ZIP archive entriesA

Inspect a small base64 ZIP archive with zipcage and report traversal, polyglot, compression-ratio, encrypted-entry, duplicate-name, special-file, and metadata inconsistencies without extracting files.

Inputs: archiveBase64 (required), options.

lint_security_codeLint source for security issuesB

Run sentinel-lint rules against one bounded source snippet in an isolated temporary file. The scanner never executes the snippet, never follows symlinks, and the temporary file is deleted before the tool returns.

Inputs: code (required), filename, maxFileSize.

redact_logRedact and sanitize logsB

Neutralize log forging, terminal controls, secrets, credentials, sensitive object keys, optional high-precision PII patterns, and oversized structured records with logcage.

Inputs: pii, mode, text, record, +8 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 10 tools

    Disambiguation4/5

    Each tool targets a distinct input artifact (path, headers, code snippet, redirect, dotenv, cookie, ZIP, log, CORS config, JSON), so an agent can usually pick correctly. The main overlaps are audit_headers (which also does Set-Cookie analysis) vs audit_cookie, and audit_cors vs audit_headers, plus secret-handling appearing in both audit_env and redact_log.

    Naming Consistency4/5

    Eight of ten tools follow a clean audit_<noun> pattern with predictable snake_case. lint_security_code and redact_log deviate in verb only, but both read naturally and the deviation signals a genuinely different action rather than sloppiness.

    Tool Count5/5

    Ten tools is squarely in the sweet spot for a security-auditing server. Each tool covers a distinct hazard class and none feels like filler or a redundant wrapper.

    Completeness4/5

    The surface covers most common untrusted-input categories (paths, headers, redirects, env, cookies, ZIP, JSON, logs, source, CORS) with both reporting and sanitization verbs. Minor gaps remain for full-URL/SSRF analysis, HTML/XML/XXE, and templating or shell-command input auditing.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      MCP security server for AI coding agents. 12 tools: pre-install guardian, vulnerability audit, supply-chain attack detection via static code analysis, and CycloneDX 1.6 SBOM generation. Zero runtime dependencies.
      15
      99 npm
      15
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding tools to scan projects for security vulnerabilities, hardcoded secrets, injection flaws, and privacy violations with 699 rules and 76 MCP tools, all running locally with zero telemetry.
      2,608 npm
      7
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to run deterministic, fully local static security and compliance audits of code, configurations, and dependencies through 32 MCP tools covering 24 vulnerability categories. It also detects the project stack, generates risk reports and checklists, suggests stack-aware remediations, and re-validates fixes to confirm vulnerabilities were eliminated.
      32
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Exposes seven MCP tools that let an AI coding agent detect a project's stack, fetch the priority security checks for that platform, search 2,057 OWASP-derived check cards with file-and-commit provenance, and record evidence-backed pass/fail results in a report.
      7
      MIT