krypton-mcp
🛡️ KryptonMCP
面向 AI 代理的零信任安全与隐私网关
确定性 PII 脱敏 • 提示注入防护 • JIT 临时凭证 • 签名 Merkle 审计账本
🤖 借助 AI 即时集成到项目
要集成到现有项目? 我们在
KRYPTON_INTEGRATION_PROMPT.md中提供了一个即用型 AI 提示词。只需将整个提示词复制粘贴到项目中的 Claude Code、Cursor Composer、Windsurf 或 Antigravity,你的 AI 助手就会自动审计你的工具、生成
krypton.yaml、创建 Ed25519 审计密钥,并透明地接入所有 MCP 客户端!
Related MCP server: Node9-Proxy
⚡ 为什么选择 KryptonMCP?
将 AI 模型(如 Claude、Cursor、Windsurf、LangChain、AutoGen)直接连接到数据库、Redis 实例和企业 API 会带来灾难性的安全挑战:
PII 与数据泄露:明文客户信用卡、电子邮件、SSN 和私有 API 密钥会随提示上下文直接发送给云端 LLM 提供商。
提示注入与劫持:恶意用户或间接内容注入会诱骗模型执行破坏性工具(
DROP TABLE、rm -rf、数据外泄)。静态长期凭证:向 AI 代理授予数据库密码或管理员令牌会留下持久的后门。
缺乏可验证的合规性:传统日志可能被篡改或删除,无法满足 SOC2、HIPAA 和 ISO27001 审计标准。
KryptonMCP 是一个独立的单二进制零信任网关,透明地驻留在你的 AI 客户端与下游 MCP 工具之间,无需 HashiCorp Vault 等外部代理。
🌟 核心支柱
flowchart TD
Client["🤖 AI Client (Claude / Cursor / Windsurf / LangChain)"]
subgraph InboundPipeline["🔒 Inbound Security Pipeline"]
G["1. Prompt-Injection Guardrails & RBAC"]
D["2. Inbound Detokenization Engine"]
B["3. JIT Ephemeral Credential Broker"]
A1["4. Merkle Audit Signer (Ed25519)"]
G --> D --> B --> A1
end
Downstream[("🗄️ Downstream Services (Postgres, Redis, Remote APIs)")]
subgraph OutboundPipeline["🎭 Outbound Privacy Pipeline"]
M["5. In-Flight PII Masker (AES-256-GCM Vault)"]
A2["6. Merkle Leaf Digest & JSONL Sync"]
M --> A2
end
Client -->|"1. JSON-RPC Tool Request (stdio / SSE)"| G
A1 -->|"2. Sanitized Cleartext Request"| Downstream
Downstream -->|"3. Raw Database / API Result"| M
A2 -->|"4. Protected Result with Surrogate Tokens ([EMAIL_REF_...])"| Client1. 🎭 传输中的确定性 PII 脱敏
透明脱敏:在载荷到达 LLM 之前,将敏感数据(信用卡、SSN、电子邮件、API 密钥、JWT、电话号码、IPv4/IPv6)替换为可逆的代理令牌(
[EMAIL_REF_a1b2c3d4]、[CREDIT_CARD_REF_8f9e0a1b])。算法验证:通过 Luhn Mod 10 校验和、SSA 地区检查实现高精度扫描,对标准代码零误报。
可逆去令牌化:当 LLM 使用代理令牌调用下游工具时,Krypton 会在传输中将参数还原为明文。
内存加密保险库:磁盘零明文存储;所有代理映射均在内存中通过临时 AES-256-GCM 密钥保护。
2. 🛡️ 提示注入与工具执行防护
多向量威胁检测:阻止指令覆盖、DAN/开发者模式越狱、分隔符注入(
<|im_start|>、<<SYS>>)以及 Base64 混淆载荷。声明式工具 RBAC:通配符白名单(
query_*)和黑名单(drop_*、execute_shell)。参数约束:字段级验证(正则模式、最小/最大长度、数值边界)。
滑动窗口限流:防止失控的递归执行循环。
3. 🔑 即时(JIT)临时凭证
动态微凭证:按需生成短时数据库和缓存用户,TTL 低于一小时。
自动撤销:精确的后台定时器在租约到期时自动终止后端会话并删除临时角色。
内置驱动:为 PostgreSQL(
CREATE ROLE ... VALID UNTIL、pg_terminate_backend、DROP ROLE)和 Redis(ACL SETUSER、CLIENT KILL USER、ACL DELUSER)提供原生驱动。原生 MCP 工具:暴露
krypton_request_credential、krypton_revoke_credential和krypton_list_leases。
4. 🔏 加密签名的 Merkle 审计账本
RFC 6962 域分离:仅追加的二进制 Merkle 树,记录每个请求、响应、工具调用和凭证租约。
Ed25519 非对称签名:对 Merkle 根检查点进行数学签名。
防篡改检测:篡改或删除历史日志记录会立即破坏加密验证。
CLI 验证器与证明导出器:为合规审计人员提供
krypton audit verify和krypton audit proof。
🚀 快速开始(30 秒)
安装
# Option 1: Install with Go (Zero dependencies)
go install github.com/krypton-mcp/krypton/cmd/krypton@v0.1.0-alpha
# Option 2: Pull the production Docker image
docker pull ghcr.io/muhammetemirerkut/krypton-mcp:latest
# Option 3: Build from source
git clone https://github.com/MuhammetEmirErkut/krypton-mcp.git
cd krypton-mcp
go build -o krypton ./cmd/krypton初始化配置与审计密钥
# 1. Generate production configuration template
krypton config init --out krypton.yaml
# 2. Generate Ed25519 cryptographic audit signing keypair
krypton audit keygen --out-dir ./security-keys⚙️ 客户端集成
1. Claude Desktop 配置(Stdio 代理模式)
在 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows)中将 Krypton 添加为透明代理:
{
"mcpServers": {
"postgres-secure": {
"command": "/usr/local/bin/krypton",
"args": [
"start",
"--config", "/path/to/krypton.yaml",
"--",
"npx", "-y", "@modelcontextprotocol/server-postgres", "postgresql://admin:password@localhost:5432/mydb"
]
}
}
}2. Cursor IDE / 远程 MCP 集成(HTTP 与 SSE 模式)
对于容器化或远程环境,将 Krypton 作为安全网络网关启动:
# Launch SSE gateway on port 8080 proxying a remote MCP service
krypton start --transport sse --host 0.0.0.0 --port 8080 --downstream-url http://downstream-service:8001/rpc在工作区中的 .cursor/mcp.json 中添加:
{
"mcpServers": {
"secure-gateway": {
"command": "krypton",
"args": ["start", "--config", "./krypton.yaml"]
}
}
}📋 配置规范(krypton.yaml)
version: "v1"
server:
transport: "stdio" # "stdio" or "sse"
host: "127.0.0.1"
port: 8080
log_level: "info"
downstream:
transport: "stdio" # "stdio" or "http"
# url: "http://localhost:8001/rpc"
command: ""
args: []
security:
masking_enabled: true
guardrails_enabled: true
audit_enabled: true
ephemeral_creds_enabled: true
masking:
mode: "tokenize" # "tokenize", "redact", or "hash"
builtin_rules:
- "email"
- "credit_card"
- "ssn"
- "api_key"
- "jwt"
- "phone"
- "ip_address"
guardrails:
block_injection: true
block_exfiltration: true
max_prompt_size_bytes: 1048576 # 1 MB
# Declarative Tool RBAC
allowed_tools:
- "*"
denied_tools:
- "drop_*"
- "delete_database"
- "execute_raw_shell"
audit:
log_path: "./audit.jsonl"
sign_enabled: true
signing_key_path: "./krypton_audit.key"
public_key_path: "./krypton_audit.pub"💻 CLI 命令矩阵
命令 | 描述 |
| 启动网关代理或独立服务器 |
| 生成生产配置模板 |
| 验证配置语法和模式规则 |
| 生成用于加密审计签名的 Ed25519 密钥对 |
| 加密验证 Merkle 账本完整性 |
| 导出某个叶节点的加密包含证明 |
| 打印二进制构建版本和提交元数据 |
📊 性能基准
在 Apple M2(arm64,Go 1.26)上测得:
基准操作 | 吞吐量 | 延迟 | 内存分配 |
传输中 PII 脱敏与令牌化 | ~30,000 ops/sec | 33.4 μs / op | 20 allocs / op |
提示注入与防护扫描 | ~33,000 ops/sec | 30.3 μs / op | 3 allocs / op |
RFC 6962 Merkle 树叶节点追加 | ~2,000 ops/sec | 489 μs / op | 5,074 allocs / op |
完整网关流水线端到端 | ~1,800 ops/sec | 550 μs / op | 5,110 allocs / op |
🔒 安全与漏洞披露
KryptonMCP 非常重视安全漏洞。如果你发现漏洞,请通过 GitHub 私有漏洞报告提交,或发送邮件至 security@krypton-mcp.org。请勿针对零日漏洞公开提交 issue。
📄 许可证
Apache License 2.0。详见 LICENSE。
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA 7-layer security system for AI agents that detects and blocks prompt injection, data exfiltration, and malicious tool calls. It enables real-time scanning of inputs, outputs, and tool definitions to protect agentic workflows from emerging AI-specific threats.1MIT
- AlicenseNot gradedqualityAmaintenanceThe Execution Security Layer for the Agentic Era. Providing deterministic "Sudo" governance and audit logs for autonomous AI agents.2,111209Apache 2.0
- AlicenseAqualityAmaintenanceLocal zero-trust permission gateway for AI agents. Enforces policy-based tool authorization, human approvals, scoped permissions, and cryptographically verifiable audit logs.45Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides a privacy-preserving security framework for AI agents using the Model Context Protocol, enabling transparent anonymization of sensitive data and blockchain-like audit trails for regulated domains.MIT
Related MCP Connectors
Protect AI agents from API-key exposure with secretless credentials and signed execution proofs.
Sovereign Agent OS — Persistent Memory, Governance & Compliance for AI Agents.
Verifiable provenance for AI agents — ZK proofs over confidential documents, no plaintext exposure.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/MuhammetEmirErkut/krypton-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server