内存隐私盾,防止 MCP 工具中的上下文泄露
In-memory privacy shield to prevent context leaks in MCP tools

原始链接: https://github.com/rohan-protocol/sdk

Rohan 是一个开源的 MCP 隐私护盾(beta v0.6.0),可防止明文工具参数泄露到 LLM 上下文。它在隔离的客户端 RAM 中评估工具参数,过滤提示注入和隐藏 Unicode,确定性清零见证内存,并生成锚定到 Midnight 的 32 字节加密意图承诺(免 Gas)。附带的 MCP 服务器可通过 npx 或源码运行,并暴露 `rohan_zk_handshake`。它与 Claude Desktop 和 Cursor 等客户端集成,使用中继器进行免 Gas 交易,并包含针对注入、内存窃取、Socket 耗尽和浏览器抓取的缓解措施。原生客户端 WASM ZK-SNARK 证明仍在积极研究中。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 内存隐私屏蔽,防止 MCP 工具中的上下文泄露 ( github.com/rohan-protocol ) 7 分 由 jvonb 1 小时前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 tcdent 35 分钟前 [–] 更简单且实际上更安全的方式,是通过代理服务注入敏感凭证;理想情况下,该代理服务应运行在智能体所在盒子之外。 因为即使你做这种内存替换,内容仍然存在于系统内存中。因此,它只是让泄露凭证不那么明显,但绝对不能防止泄露。 回复 考虑申请 YC 2027 年冬季批次! 申请 开放至 11 月 2 日。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

⚠️ Public Beta (v0.6.0): Rohan currently enforces client-side RAM witness isolation, V-01 semantic policy firewalls, and V-02 deterministic memory zeroization (zeroize) to shield MCP tool calls while native client-side WASM ZK-SNARK proving circuits are under active research (Milestone 1).

⚡ The Problem: Plaintext Context Leaks in MCP

The Model Context Protocol (MCP) connects autonomous agents to tools. However, transport encryption (TLS) only protects data in flight — at the host boundary, standard MCP tools execute in cleartext:

🔴 WITHOUT ROHAN (Standard MCP)
Agent calls tool ➔ { "api_key": "sk_live_...", "db_password": "secret" } in plaintext
                 ➔ Leaked directly into LLM conversation context & inference logs
                 ➔ Permanent risk of context exfiltration & prompt injection

🟢 WITH ROHAN SHIELD
Agent calls tool ➔ Arguments evaluated strictly in isolated client RAM
                 ➔ V-02 Zeroize wipes witness memory immediately from volatile memory
                 ➔ Zero plaintext parameters ever enter the model context window

🛠️ Running the MCP Server from Source

This repository contains the complete open-source MCP server implementation. You can clone and run the server locally over standard stdio:

# 1. Clone the repository
git clone https://github.com/rohan-protocol/sdk.git
cd sdk

# 2. Install dependencies & build packages
npm install
npm run build

# 3. Start the MCP Server directly over stdio
node packages/mcp/dist/server.js

Or run directly via npx without cloning:

npx -y @rohan-protocol/mcp@latest

The @rohan-protocol/mcp server registers standard Model Context Protocol tool endpoints over JSON-RPC:

MCP Tool Description Input Parameters
rohan_zk_handshake Evaluates tool execution parameters in ephemeral RAM, strips prompt injections, generates a cryptographic 32-byte intent commitment, and anchors state transitions gaslessly to Midnight. targetAgentId (string), intent (string), privatePayload (object)

🚀 Universal MCP Client Setup

Add rohan-shield to your claude_desktop_config.json:

{
  "mcpServers": {
    "rohan-shield": {
      "command": "npx",
      "args": ["-y", "@rohan-protocol/mcp@latest"],
      "env": {
        "ROHAN_RELAYER_URL": "https://api.rohanprotocol.network/api/v1/handshake"
      }
    }
  }
}
  1. Navigate to Settings → Features → MCP Servers → Add New MCP Server.
  2. Set the name to rohan-shield.
  3. Set the type to command.
  4. Use the command: npx -y @rohan-protocol/mcp@latest
rohan-protocol/sdk
├── packages/
│   ├── mcp/         # 🤖 The Official Model Context Protocol (MCP) Server (Stdio)
│   ├── sdk/         # ⚙️ Core in-memory commitment engine & relayer client
│   └── webmcp/      # 🌐 React / Next.js browser hooks with V-07 DOM isolation
├── contracts/       # 📜 Midnight Compact smart contracts (rohan_handshake.compact)
└── README.md
┌─────────────────────────────────────────────────────────────────────────────┐
│                           AUTONOMOUS AGENT RUNTIME                          │
│               Claude Desktop / Cursor IDE / Custom Agent Workflows          │
└──────────────────────────────────────┬──────────────────────────────────────┘
                                       │ Tool Execution (JSON-RPC)
                                       ▼
 ┌───────────────────────────────────────────────────────────────────────────┐
 │                  [@rohan-protocol/mcp] SERVER (packages/mcp)              │
 │  • Stdio MCP Protocol Server: Compliant with Anthropic MCP Specification  │
 │  • V-01 Semantic Firewall: Filters hidden Unicode & prompt injections     │
 └─────────────────────────────────────┬─────────────────────────────────────┘
                                       │ In-Memory Witness
                                       ▼
 ┌───────────────────────────────────────────────────────────────────────────┐
 │                  [@rohan-protocol/sdk] ENGINE (packages/sdk)              │
 │  • Ephemeral RAM Commitment (32-Byte Intent Hash)                         │
 │  • V-02 Deterministic Zeroize: Overwrites buffers immediately in memory   │
 │  • ZERO disk writes. ZERO swap-file exposure.                             │
 └─────────────────────────────────────┬─────────────────────────────────────┘
                                       │ Streamable HTTP (NDJSON)
                                       │ received ➔ approved ➔ proving ➔ anchored
                                       ▼
 ┌───────────────────────────────────────────────────────────────────────────┐
 │                       ROHAN RELAYER PAYMASTER                             │
 │  • Gasless Transaction Sponsoring ($tDUST covered automatically)          │
 │  • Scale-to-Zero Native (No persistent SSE connection bottlenecks)        │
 └─────────────────────────────────────┬─────────────────────────────────────┘
                                       │ Immutable Replay Protection
                                       ▼
 ┌───────────────────────────────────────────────────────────────────────────┐
 │                      MIDNIGHT BLOCKCHAIN LEDGER                           │
 │  Contract: rohan_handshake.compact (Preprod: 585ac0c4448257507d8ffa2a...) │
 └───────────────────────────────────────────────────────────────────────────┘

🛡️ Security Register (Threat & Mitigation)

Threat ID Threat Vector Mitigation Mechanism
V-01 Adversarial Prompt Injection Pre-Prover Semantic Firewall: intercepts out-of-bounds payloads and strips zero-width Unicode injection characters ([\u200B-\u200D\uFEFF]).
V-02 Residual Heap Exfiltration Deterministic Memory Zeroize: multi-pass volatile memory wiping overwriting witness buffers with deterministic 0x00 byte patterns.
V-05 Persistent Socket Exhaustion Scale-to-Zero NDJSON: uses chunked Streamable HTTP instead of long-lived SSE connections, allowing proxies to spin down on idle.
V-07 DOM / WebWorker Scraping WebMCP Thread Isolation: isolates execution buffers inside WebWorkers, shielded from malicious third-party browser extensions.

The cryptographic foundations, threat registers, and formal mathematical proofs are documented in our research paper:

Rohan: A Stateless Zero-Knowledge Trust Gateway for Privacy-Preserving Agentic Workflows via Streamable HTTP
Model Context Protocol Working Group & Rohan Protocol Lab
Published via Zenodo / IEEE Spec v2.0 • DOI: 10.5281/zenodo.22730240

🤝 Community & Contributing

We build in the open.

  • 🐛 Found a bug or bypass vector? Open a GitHub Issue.
  • ⭐️ Support: consider starring the repository to help other developers discover privacy-first MCP tools.
Licensed under the MIT License. Maintained by the Rohan Protocol community.
联系我们 contact @ memedata.com