Skip to main content
Glama
Live Disposable API Gate & MCP Server

Live Disposable API Gate & MCP Server

CryptGate

License: MIT npm Kiroween 2026 Tests Kiro Crew App

Live app: https://cryptgate.keyrook-labs.workers.dev
Demo video (2:13): https://youtu.be/PdQWOC0pXuM
Self-host in 1 command: npx cryptgate serve (npm package)
License: MIT

CryptGate is a temporary, path-locked HTTP proxy and Streamable HTTP MCP server (2025-03-26) for API keys. Instead of putting a raw Stripe, OpenAI, Anthropic, or GitHub key into .env for a coding agent, you store the key encrypted on the server (or locally on 127.0.0.1) and hand out a short-lived proxy URL (/g/<id>/*) and matching MCP endpoint (/g/<id>/mcp).

Incoming requests are checked against strict host, path, and HTTP method allowlists, optionally held open on the server until you click Approve or Deny, stripped of leaked key copies across 8 encodings on the way back, and logged into a signed ECDSA P-256 chain.

CryptGate Proxies console

Quick try (no login required)

  1. Open https://cryptgate.keyrook-labs.workers.dev.

  2. Click Run live walkthrough to create a 15-minute read-only proxy, trigger real blocked probes (401 forged operator token, 403 %252e%252e path traversal, 403 DELETE), approve a live paused MCP request (Y / S / N), inspect 6 redacted secret copies, and verify the ECDSA P-256 receipt.

  3. Or click Test with npm registry to proxy a real HTTPS request to registry.npmjs.org.

Live approval gate holding an MCP request

Related MCP server: nice

Architecture

CryptGate brings six components together around one zero-dependency TypeScript core (@cryptgate/engine, built purely on standard Web APIs URL, TextEncoder, and crypto.subtle) so the same policy engine, 8-encoding redactor, RFC 6238 TOTP generator, and ECDSA P-256 audit chain run on Cloudflare Workers, Node 22, and the browser:

flowchart LR
    Agent["Coding Agent / CLI / MCP Client (zero raw .env keys)"] -->|"/g/:id/* or /g/:id/mcp"| Edge["Cloudflare Worker + SQLite Durable Object"]
    Edge --> Policy["@cryptgate/engine: SSRF, %252e%252e, Method, 3xx"]
    Policy -->|"Blocked"| Deny["401 / 403 / 410 / 423 / 429 Fail-Closed Verdict"]
    Policy -->|"Allowed / Hold 45s"| Approve["Human Approval Gate (Y / S / N + 256-bit operatorToken)"]
    Crew["Kiro Crew App & Side Panel (/apps/cryptgate)"] <-->|"Live control & receipts"| Approve
    Approve -->|"AES-256-GCM decrypt + inject"| Upstream["Target HTTPS API (OpenAI, Anthropic, Stripe, GitHub)"]
    Upstream --> Scrub["8-Encoding Redactor + ECDSA P-256 Hash Chain"]
    Scrub -->|"Scrubbed response + receipt"| Agent
  • packages/engine (@cryptgate/engine): zero-dependency security core covering host/path/method allowlists, iterative %252e%252e percent-decoding, SSRF blocking (RFC1918, loopback, cloud metadata) for upstreams and approval webhooks, hard 3xx redirect blocking, sanitized static upstream headers, hot policy updates (PATCH /api/gates/:id for pause/resume, path/method/TTL updates, and live key rotation), 8-encoding response scrubbing (raw, Base64, Base64URL, hex lower/upper, URL-encoded, JSON-escaped, HTTP Basic), RFC 6238 TOTP, ECDSA P-256 hash-chained audit logs, and an offline 14-rule .env scanner with SARIF v2.1.0 export.

  • worker/src/index.ts & wrangler.jsonc: Cloudflare Worker with a SQLite-backed Durable Object (GateCoordinator) encrypting secrets and webhook URLs with AES-256-GCM at rest, holding live HTTP/MCP requests open up to 45s for approval, requiring a one-time 256-bit operatorToken (X-CryptGate-Operator-Token) on all control-plane routes, purging expired ciphertext via DO alarm(), and keeping an isolate fallback during free-tier quota spikes.

  • web (@cryptgate/web): Light/Dark browser console with 4 tabs (Proxies, Test cases, .env scanner, Kiro app), 1-click provider presets, copyable client configs (curl, Kiro/Cursor mcp.json, Claude Code, TypeScript SDK, Python), keyboard approval shortcuts (Y / S / N), live policy editing, filterable Request Inspector, and offline receipt verification.

  • app.json, agents/, skills/, crons/, ui/: Kiro Crew app package (gatekeeper-ops and secret-exorcist agents, zero-secret-ritual skill, nightly audit cron, and embeddable Light/Dark React UI bundle at ui/dist/index.mjs, mounted at /apps/cryptgate and live-previewable in the Kiro app tab).

  • bin/cryptgate.mjs: standalone CLI (create, watch, extend, rotate, pause, resume, revoke, serve, verify-audit, scan [--sanitize|--json|--sarif], mcp, proxy, wire).

Kiro workspace & Kiro Crew package

Path

Role

.kiro/specs/cryptgate/

requirements.md, design.md, and tasks.md defining the threat model and invariants before UI/Worker code

.kiro/steering/

security-invariants.md and architecture.md keeping security rules pinned across edits

.kiro/hooks/

secret-exorcist-on-save.kiro.hook (npm run scan:self) and invariant-test-gate.kiro.hook (npm test)

.kiro/agents/

gatekeeper-ops.json and secret-exorcist.json (validated with kiro-cli agent validate)

.kiro/settings/mcp.json

MCP server configuration for Kiro

app.json + app-registry.json + ui/dist/index.mjs

Spec-compliant Kiro Crew app manifest (prebuilt ESM bundle, light/dark icons, contributes.panelTabs chat side panel, mcpServers, inline crons, agents, and skill)

Install in Kiro Crew

CryptGate ships a spec-compliant app.json, a prebuilt ESM UI bundle committed at ui/dist/index.mjs (ui.entry: "dist/index.mjs"), light/dark App Store artwork (assets/icon.png, assets/icon-dark.png, assets/hero.png, ui/icon.svg), and a root app-registry.json for direct installation in Kiro Crew:

  • Full page: /apps/cryptgate (sidebar icon via ui/icon.svg and ui/icon-inactive.svg)

  • Chat side-panel tab: CryptGate Approvals (contributes.panelTabs) so you can approve or deny live agent HTTP/MCP calls right beside your active chat

  • Agents, skill, MCP, and cron: gatekeeper-ops, secret-exorcist, skills/zero-secret-ritual, npx -y cryptgate mcp, and nightly-secret-audit (0 2 * * *)

  • Instant browser preview (no Kiro Crew install needed): open the Kiro app tab at https://cryptgate.keyrook-labs.workers.dev

To install and use it in Kiro Crew:

  1. Install the app from the GitHub repo:

    kirocrew app install https://github.com/keyrook/cryptgate

    Or add the repo as a registry in Kiro Crew's config.json (the root app-registry.json is its index):

    { "registries": [{ "name": "keyrook", "repo": "https://github.com/keyrook/cryptgate", "branch": "main" }] }
  2. Start the local server the panel talks to:

    npx cryptgate serve

    Kiro Crew's dashboard only lets app pages connect to loopback addresses, so inside Crew the CryptGate page and side panel use http://127.0.0.1:4173 instead of the hosted Worker. cryptgate serve (1.0.2+) allows CORS for loopback origins only.

Local development

npm install
npm test            # 54 Vitest tests (DO SQLite, AES-GCM, alarm purge, quota fallback, PATCH policy/TTL/rotate, webhooks, SARIF, 413 cap, MCP, SSRF, TOTP, ECDSA, CLI)
npm run typecheck   # TypeScript check across all workspaces
npm run scan:self   # Secret scan across the repo (0 leaks)
npm run build       # Build engine, web app, and Kiro Crew UI
npm run dev         # Local dev server at http://localhost:4173

CLI usage

Create a temporary proxy straight from your terminal without pasting secrets into a browser (reads the key from an environment variable, prints the proxy URL, MCP config, and private manage link):

node bin/cryptgate.mjs create --preset openai --secret-env OPENAI_API_KEY --ttl 15
node bin/cryptgate.mjs create --preset echo
node bin/cryptgate.mjs watch <gateId> --token <operatorToken>
node bin/cryptgate.mjs extend <gateId> --minutes 15 --token <operatorToken>
node bin/cryptgate.mjs rotate <gateId> --secret-env OPENAI_API_KEY_NEW --token <operatorToken>
node bin/cryptgate.mjs pause <gateId> --token <operatorToken>
node bin/cryptgate.mjs resume <gateId> --token <operatorToken>
node bin/cryptgate.mjs revoke <gateId> --token <operatorToken>
node bin/cryptgate.mjs scan .env --sarif > cryptgate.sarif

Self-host the built server locally (no Cloudflare account needed):

node bin/cryptgate.mjs serve --port 4173

Verify an exported receipt offline:

node bin/cryptgate.mjs verify-audit cryptgate-live-receipt.json

Run local stdio MCP or loopback proxy demos:

npm run mcp:demo
npm run demo:live

Optional integration with Passhold Agents

CryptGate's hosted Worker, local CLI, Kiro Crew app, and all 54 tests run completely standalone. For local encrypted vaults on your own machine, generated configs optionally connect to @keyrook/passhold-cli from Keyrook:

npm install -g @keyrook/passhold-cli
npm run wire:kiro -- --apply
passhold mcp --http --port 8765 --expires 8h

Credits

All source code in this repository was written from scratch for CryptGate during Kiroween 2026. The hosted demo and test suite use synthetic fixtures (cg_demo_*) with zero external dependencies required.

License

MIT. See LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A security-hardened MCP gateway that enables AI agents to call LLM APIs (Gemini, OpenAI, Claude, etc.) using ephemeral proxy tokens, eliminating exposure of real API keys.
      49 npm
      6
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides a secure MCP gateway for AI agents to access APIs without exposing raw credentials, with scoped access, audit logging, and OAuth support.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables governed agent access to tools by routing and authorizing MCP requests through configurable policies, credential-bound upstream connections, human approval workflows, and an administration console.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to access remote and local MCP servers plus HTTP APIs through a single MCP endpoint, with per-consumer scoped tokens, tool-level permissions, and encrypted secret management.
      10
      AGPL 3.0