@rohan-protocol/mcp 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -189
- package/dist/firewall.js +2 -2
- package/dist/firewall.js.map +1 -1
- package/dist/gateway.d.ts +4 -8
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +7 -8
- package/dist/gateway.js.map +1 -1
- package/dist/server.js +25 -31
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
- package/smithery.yaml +1 -1
- package/src/firewall.ts +2 -2
- package/src/gateway.ts +7 -8
- package/src/server.ts +25 -34
package/README.md
CHANGED
|
@@ -1,189 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Add the Rohan MCP server to your `claude_desktop_config.json`:
|
|
51
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
52
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
53
|
-
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"mcpServers": {
|
|
58
|
-
"rohan-zk-gateway": {
|
|
59
|
-
"command": "npx",
|
|
60
|
-
"args": ["-y", "@rohan-protocol/mcp"],
|
|
61
|
-
"env": {
|
|
62
|
-
"ROHAN_CONTRACT_ADDRESS": "6d2d603235f996424d76c85186a79cc403245ea8ee1ba9087e40967fe71bdc4d",
|
|
63
|
-
"ROHAN_RELAYER_URL": "https://api.rohanprotocol.network/api/v1/handshake/stream",
|
|
64
|
-
"ROHAN_API_KEY": "rohan_live_..."
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
> **Sandbox vs. Production**: The MCP server works out of the box with **10 free handshakes per day** without an API key. For continuous agent workflows, provide `ROHAN_API_KEY` in the environment configuration.
|
|
72
|
-
|
|
73
|
-
### 2. Cursor IDE Integration
|
|
74
|
-
|
|
75
|
-
In Cursor, navigate to **Settings > Features > MCP Servers > Add New MCP Server**:
|
|
76
|
-
- **Name**: `rohan-zk`
|
|
77
|
-
- **Type**: `command`
|
|
78
|
-
- **Command**: `npx -y @rohan-protocol/mcp`
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## 🛠️ Exposed MCP Tools
|
|
83
|
-
|
|
84
|
-
The server automatically registers the following tool in your LLM's context:
|
|
85
|
-
|
|
86
|
-
### `rohan_zk_handshake`
|
|
87
|
-
|
|
88
|
-
Executes a confidential, tamper-proof Zero-Knowledge handshake on Midnight with real-time streamable verification.
|
|
89
|
-
|
|
90
|
-
#### Input Schema:
|
|
91
|
-
|
|
92
|
-
```json
|
|
93
|
-
{
|
|
94
|
-
"agentId": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"description": "Decentralized Identifier (DID) of the initiator agent (e.g. did:midnight:agent-01)"
|
|
97
|
-
},
|
|
98
|
-
"intent": {
|
|
99
|
-
"type": "string",
|
|
100
|
-
"description": "Semantic action plan, financial intent, or agreement to seal in ZK"
|
|
101
|
-
},
|
|
102
|
-
"counterpartyId": {
|
|
103
|
-
"type": "string",
|
|
104
|
-
"description": "Optional DID of the target recipient agent"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
#### Example Agent Invocation Prompt:
|
|
110
|
-
|
|
111
|
-
> *"Claude, seal our data-sharing agreement with `did:midnight:agent-partner` using Rohan ZK Handshake."*
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
<a id="streamable-http-handshake-lifecycle"></a>
|
|
116
|
-
## ⚡ Streamable HTTP Handshake Lifecycle
|
|
117
|
-
|
|
118
|
-
During tool execution, the MCP server connects to the Relayer via Chunked Transfer-Encoding (NDJSON), processing the following sequential stages:
|
|
119
|
-
|
|
120
|
-
```text
|
|
121
|
-
📡 [LIVE CHUNK] stage: 'received' | Data: {"stage":"received","timestamp":1788903808207}
|
|
122
|
-
📡 [LIVE CHUNK] stage: 'firewall_approved' | Data: {"stage":"firewall_approved","v01":"passed"}
|
|
123
|
-
📡 [LIVE CHUNK] stage: 'subsidizing_gas' | Data: {"stage":"subsidizing_gas","gasPayer":"rohan-relayer-node-01"}
|
|
124
|
-
📡 [LIVE CHUNK] stage: 'confirmed' | Data: {"stage":"confirmed","status":"success","txHash":"0x7c92...","intentHash":"0916..."}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
#### Returned Structured Receipt to LLM:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"status": "success",
|
|
132
|
-
"receipt": {
|
|
133
|
-
"stage": "confirmed",
|
|
134
|
-
"status": "success",
|
|
135
|
-
"contractAddress": "6d2d603235f996424d76c85186a79cc403245ea8ee1ba9087e40967fe71bdc4d",
|
|
136
|
-
"intentHash": "0916542f526dd3117104f23f113873a5331fdc2d885340081aef79dab0ee7393",
|
|
137
|
-
"txHash": "0x7c92f75ca7d3bc8c767953b69c29d87d3848084c68d401bbd7987ff1afdb8271",
|
|
138
|
-
"gasPaidBy": "rohan-relayer-node-01",
|
|
139
|
-
"timestamp": 1788903808208
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
<a id="security-architecture"></a>
|
|
147
|
-
## 🔒 Security Architecture (V-01 & V-02)
|
|
148
|
-
|
|
149
|
-
```text
|
|
150
|
-
┌────────────────────────────────────────────────────────┐
|
|
151
|
-
│ AI Agent (Claude / Cursor / Headless Bot) │
|
|
152
|
-
│ "Perform confidential handshake with Agent B" │
|
|
153
|
-
└──────────────────────────┬─────────────────────────────┘
|
|
154
|
-
│ 💬 MCP Tool Request: rohan_zk_handshake
|
|
155
|
-
▼
|
|
156
|
-
┌────────────────────────────────────────────────────────┐
|
|
157
|
-
│ 🛡️ PRE-PROVER SEMANTIC FIREWALL (V-01) │
|
|
158
|
-
│ - Inspects against indirect injection patterns │
|
|
159
|
-
│ - Validates schema and DID integrity │
|
|
160
|
-
└──────────────────────────┬─────────────────────────────┘
|
|
161
|
-
│ ✅ Filter Passed
|
|
162
|
-
▼
|
|
163
|
-
┌────────────────────────────────────────────────────────┐
|
|
164
|
-
│ 📦 @rohan-protocol/sdk (Local WASM Engine) │
|
|
165
|
-
│ - Computes ZK-Proof in isolated RAM │
|
|
166
|
-
│ - Multi-pass memory wipe destroys witness w (V-02) │
|
|
167
|
-
└──────────────────────────┬─────────────────────────────┘
|
|
168
|
-
│ 📡 Streamable HTTP (POST /api/v1/handshake/stream)
|
|
169
|
-
▼
|
|
170
|
-
┌────────────────────────────────────────────────────────┐
|
|
171
|
-
│ ⚡ Rohan Relayer & Gas Station (NDJSON Stream) │
|
|
172
|
-
│ - Chunk 1: stage: 'received' │
|
|
173
|
-
│ - Chunk 2: stage: 'firewall_approved' │
|
|
174
|
-
│ - Chunk 3: stage: 'subsidizing_gas' │
|
|
175
|
-
│ - Chunk 4: stage: 'confirmed' (on-chain finalization)│
|
|
176
|
-
└──────────────────────────┬─────────────────────────────┘
|
|
177
|
-
│
|
|
178
|
-
┌──────────────────────────▼─────────────────────────────┐
|
|
179
|
-
│ 🌌 Midnight Network Settlement Layer │
|
|
180
|
-
│ - Compact Smart Contract: rohan_handshake │
|
|
181
|
-
│ - Preprod Address: 6d2d603235f996424d76c85186a... │
|
|
182
|
-
└────────────────────────────────────────────────────────┘
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## 📄 License
|
|
188
|
-
|
|
189
|
-
MIT © Rohan Protocol. Part of the Private Agentic Economy.
|
|
1
|
+
@rohan-protocol/mcp
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
Official Model Context Protocol (MCP) server for Rohan Protocol.
|
|
7
|
+
Equips autonomous AI agents (Claude Desktop, Cursor, Gemini, Google ADK) with confidential Zero-Knowledge state transitions on Midnight Blockchain.
|
|
8
|
+
Features
|
|
9
|
+
|
|
10
|
+
Pre-Prover Semantic Firewall (V-01): Defends autonomous agents from indirect prompt injections and malicious payload expansions.
|
|
11
|
+
|
|
12
|
+
Universal Tool Interface: Exposes standard-compliant rohan_zk_handshake tool schema for LLMs in 100% technical English.
|
|
13
|
+
|
|
14
|
+
Gasless L1 Anchoring: Routes state commitments through the Rohan Relayer Pool with sponsored $tDUST network gas.
|
|
15
|
+
|
|
16
|
+
Installation & Setup
|
|
17
|
+
Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add to your claude_desktop_config.json:
|
|
20
|
+
code JSON
|
|
21
|
+
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"rohan-zk-shield": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "@rohan-protocol/mcp"],
|
|
27
|
+
"env": {
|
|
28
|
+
"ROHAN_RELAYER_URL": "https://api.rohanprotocol.network/api/v1/handshake",
|
|
29
|
+
"ROHAN_API_KEY": "rohan_live_..."
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Cursor IDE
|
|
36
|
+
|
|
37
|
+
Open Settings → Features → MCP Servers → Add New MCP Server:
|
|
38
|
+
|
|
39
|
+
Name: rohan-shield
|
|
40
|
+
|
|
41
|
+
Type: command
|
|
42
|
+
|
|
43
|
+
Command: npx -y @rohan-protocol/mcp
|
|
44
|
+
|
|
45
|
+
Environment: ROHAN_API_KEY=rohan_live_...
|
|
46
|
+
|
|
47
|
+
License
|
|
48
|
+
|
|
49
|
+
MIT © Rohan Protocol.
|
package/dist/firewall.js
CHANGED
|
@@ -12,10 +12,10 @@ export class SemanticFirewall {
|
|
|
12
12
|
}
|
|
13
13
|
const serialized = JSON.stringify(intent.payload);
|
|
14
14
|
if (serialized.length > 8192) {
|
|
15
|
-
return false; // Denial-of-Service
|
|
15
|
+
return false; // Denial-of-Service Protection (Payload size cap)
|
|
16
16
|
}
|
|
17
17
|
if (this.INJECTION_REGEX.test(serialized)) {
|
|
18
|
-
return false; // Prompt Injection
|
|
18
|
+
return false; // Semantic Prompt Injection detected
|
|
19
19
|
}
|
|
20
20
|
return true;
|
|
21
21
|
}
|
package/dist/firewall.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firewall.js","sourceRoot":"","sources":["../src/firewall.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAU,eAAe,GACrC,uKAAuK,CAAC;IAE1K,MAAM,CAAC,QAAQ,CAAC,MAAuB;QACrC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YACzF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM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AC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC,CAAC,qCAAqC;QACrD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/gateway.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RohanRelayerClient } from '
|
|
1
|
+
import { RohanRelayerClient } from '@rohan-protocol/sdk';
|
|
2
2
|
export interface RohanMcpGatewayOptions {
|
|
3
3
|
transport?: 'stdio' | 'streamable-http';
|
|
4
4
|
relayerUrl?: string;
|
|
@@ -6,7 +6,7 @@ export interface RohanMcpGatewayOptions {
|
|
|
6
6
|
apiKey?: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* RohanMcpGateway
|
|
10
10
|
* Connects AI Agent pipelines (Google ADK 2.0, Gemini, Claude, Cursor)
|
|
11
11
|
* to the Rohan Protocol Gas Station via Streamable HTTP (NDJSON) or Stdio.
|
|
12
12
|
*/
|
|
@@ -31,18 +31,14 @@ export declare class RohanMcpGateway {
|
|
|
31
31
|
type: string;
|
|
32
32
|
description: string;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
type: string;
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
publicInputs: {
|
|
34
|
+
counterpartyId: {
|
|
39
35
|
type: string;
|
|
40
36
|
description: string;
|
|
41
37
|
};
|
|
42
38
|
};
|
|
43
39
|
required: string[];
|
|
44
40
|
};
|
|
45
|
-
execute: (params: any) => Promise<
|
|
41
|
+
execute: (params: any) => Promise<import("@rohan-protocol/sdk").HandshakeReceipt>;
|
|
46
42
|
};
|
|
47
43
|
}
|
|
48
44
|
//# sourceMappingURL=gateway.d.ts.map
|
package/dist/gateway.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,aAAa,EAAE,kBAAkB,CAAC;IAElD,YAAY,OAAO,GAAE,sBAA2B,EAO/C;IAED;;OAEG;IACH,SAAS;QAEL,IAAI;QACJ,WAAW;QACX,UAAU;YACR,IAAI;YACJ,UAAU;gBACR,OAAO;oBAAI,IAAI;oBAAY,WAAW;;gBACtC,MAAM;oBAAI,IAAI;oBAAY,WAAW;;gBACrC,cAAc;oBAAI,IAAI;oBAAY,WAAW;;;YAE/C,QAAQ;;QAEV,OAAO,WAAiB,GAAG;MAI9B;CACF"}
|
package/dist/gateway.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RohanRelayerClient } from '
|
|
1
|
+
import { RohanRelayerClient } from '@rohan-protocol/sdk';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* RohanMcpGateway
|
|
4
4
|
* Connects AI Agent pipelines (Google ADK 2.0, Gemini, Claude, Cursor)
|
|
5
5
|
* to the Rohan Protocol Gas Station via Streamable HTTP (NDJSON) or Stdio.
|
|
6
6
|
*/
|
|
@@ -11,7 +11,7 @@ export class RohanMcpGateway {
|
|
|
11
11
|
this.transport = options.transport || 'streamable-http';
|
|
12
12
|
this.relayerClient = new RohanRelayerClient({
|
|
13
13
|
relayerUrl: options.relayerUrl || 'http://127.0.0.1:4005/api/v1/handshake',
|
|
14
|
-
contractAddress: options.contractAddress || '
|
|
14
|
+
contractAddress: options.contractAddress || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e',
|
|
15
15
|
apiKey: options.apiKey,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -25,15 +25,14 @@ export class RohanMcpGateway {
|
|
|
25
25
|
parameters: {
|
|
26
26
|
type: 'object',
|
|
27
27
|
properties: {
|
|
28
|
-
agentId: { type: 'string', description: 'Identifier of calling agent' },
|
|
29
|
-
intent: { type: 'string', description: 'Semantic action intent' },
|
|
30
|
-
|
|
31
|
-
publicInputs: { type: 'object', description: 'Public inputs for on-chain verification' },
|
|
28
|
+
agentId: { type: 'string', description: 'Decentralized Identifier (DID) of calling agent' },
|
|
29
|
+
intent: { type: 'string', description: 'Semantic action intent or agreement payload' },
|
|
30
|
+
counterpartyId: { type: 'string', description: 'Optional recipient agent identifier' },
|
|
32
31
|
},
|
|
33
32
|
required: ['agentId', 'intent'],
|
|
34
33
|
},
|
|
35
34
|
execute: async (params) => {
|
|
36
|
-
return await this.relayerClient.
|
|
35
|
+
return await this.relayerClient.submitHandshake(params);
|
|
37
36
|
},
|
|
38
37
|
};
|
|
39
38
|
}
|
package/dist/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AASzD;;;;GAIG;AACH,MAAM,OAAO,eAAe;IACV,SAAS,CAAS;IAClB,aAAa,CAAqB;IAElD,YAAY,OAAO,GAA2B,EAAE;QAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,CAAC;YAC1C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,wCAAwC;YAC1E,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,kEAAkE;YAC9G,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,WAAW,EAAE,qGAAqG;YAClH,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iDAAiD,EAAE;oBAC3F,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;oBACtF,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;iBACvF;gBACD,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;aAChC;YACD,OAAO,EAAE,KAAK,EAAE,MAAW,EAAE,EAAE;gBAC7B,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC1D,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/server.js
CHANGED
|
@@ -3,44 +3,48 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { SemanticFirewall } from './firewall.js';
|
|
6
|
-
import { RohanClient } from '
|
|
7
|
-
|
|
8
|
-
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '6d2d603235f996424d76c85186a79cc403245ea8ee1ba9087e40967fe71bdc4d';
|
|
6
|
+
import { RohanClient } from '@rohan-protocol/sdk';
|
|
7
|
+
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e';
|
|
9
8
|
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || 'http://127.0.0.1:4005/api/v1/handshake';
|
|
10
|
-
const
|
|
9
|
+
const API_KEY = process.env.ROHAN_API_KEY || '';
|
|
10
|
+
const rohanClient = new RohanClient({
|
|
11
|
+
contractAddress: CONTRACT_ADDRESS,
|
|
12
|
+
relayerUrl: RELAYER_URL,
|
|
13
|
+
apiKey: API_KEY,
|
|
14
|
+
});
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
16
|
+
* ROHAN PROTOCOL MCP SERVER
|
|
17
|
+
* Empowers autonomous LLM agents with native Zero-Knowledge Handshakes via Model Context Protocol.
|
|
14
18
|
*/
|
|
15
19
|
const server = new Server({
|
|
16
20
|
name: 'rohan-protocol-mcp',
|
|
17
|
-
version: '0.
|
|
21
|
+
version: '0.6.0',
|
|
18
22
|
}, {
|
|
19
23
|
capabilities: {
|
|
20
24
|
tools: {},
|
|
21
25
|
},
|
|
22
26
|
});
|
|
23
|
-
// 1.
|
|
27
|
+
// 1. Declare tool schema for LLMs (100% Technical English)
|
|
24
28
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
25
29
|
return {
|
|
26
30
|
tools: [
|
|
27
31
|
{
|
|
28
32
|
name: 'rohan_zk_handshake',
|
|
29
|
-
description: '
|
|
33
|
+
description: 'Executes a cryptographic zero-knowledge state transition on Midnight Blockchain. Proves an intent, transaction, or inter-agent agreement without exposing confidential parameters.',
|
|
30
34
|
inputSchema: {
|
|
31
35
|
type: 'object',
|
|
32
36
|
properties: {
|
|
33
37
|
agentId: {
|
|
34
38
|
type: 'string',
|
|
35
|
-
description: '
|
|
39
|
+
description: 'Decentralized Identifier (DID) or identifier of the initiating agent',
|
|
36
40
|
},
|
|
37
41
|
intent: {
|
|
38
42
|
type: 'string',
|
|
39
|
-
description: '
|
|
43
|
+
description: 'Semantic action plan, payload, or agreement terms to be cryptographically committed',
|
|
40
44
|
},
|
|
41
45
|
counterpartyId: {
|
|
42
46
|
type: 'string',
|
|
43
|
-
description: '
|
|
47
|
+
description: 'Optional identifier of counterparty agent',
|
|
44
48
|
},
|
|
45
49
|
},
|
|
46
50
|
required: ['agentId', 'intent'],
|
|
@@ -49,13 +53,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
49
53
|
],
|
|
50
54
|
};
|
|
51
55
|
});
|
|
52
|
-
// 2.
|
|
56
|
+
// 2. Execute tool invocation
|
|
53
57
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
54
58
|
if (request.params.name !== 'rohan_zk_handshake') {
|
|
55
|
-
throw new Error(`
|
|
59
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
56
60
|
}
|
|
57
61
|
const args = request.params.arguments;
|
|
58
|
-
// A. Semantic Firewall
|
|
62
|
+
// A. Semantic Firewall Verification (Security Vector V-01)
|
|
59
63
|
const isValid = SemanticFirewall.validate({
|
|
60
64
|
agentId: args.agentId,
|
|
61
65
|
action: 'rohan_zk_handshake',
|
|
@@ -76,29 +80,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
try {
|
|
79
|
-
// B.
|
|
80
|
-
const
|
|
83
|
+
// B. Generate cryptographic commitment & submit via Relayer
|
|
84
|
+
const receipt = await rohanClient.submitHandshake({
|
|
81
85
|
agentId: args.agentId,
|
|
82
86
|
intent: args.intent,
|
|
87
|
+
counterpartyId: args.counterpartyId,
|
|
83
88
|
});
|
|
84
|
-
// C. Proof an Relayer (Gas Station) übermitteln
|
|
85
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
86
|
-
if (process.env.ROHAN_API_KEY) {
|
|
87
|
-
headers['x-rohan-api-key'] = process.env.ROHAN_API_KEY;
|
|
88
|
-
}
|
|
89
|
-
const response = await fetch(RELAYER_URL, {
|
|
90
|
-
method: 'POST',
|
|
91
|
-
headers,
|
|
92
|
-
body: JSON.stringify(proofData),
|
|
93
|
-
});
|
|
94
|
-
const receipt = await response.json();
|
|
95
89
|
return {
|
|
96
90
|
content: [
|
|
97
91
|
{
|
|
98
92
|
type: 'text',
|
|
99
93
|
text: JSON.stringify({
|
|
100
94
|
status: 'success',
|
|
101
|
-
message: 'Zero-Knowledge Handshake
|
|
95
|
+
message: 'Zero-Knowledge Handshake successfully settled on Midnight Blockchain.',
|
|
102
96
|
receipt,
|
|
103
97
|
}, null, 2),
|
|
104
98
|
},
|
|
@@ -123,10 +117,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
123
117
|
async function run() {
|
|
124
118
|
const transport = new StdioServerTransport();
|
|
125
119
|
await server.connect(transport);
|
|
126
|
-
console.error('🛡️ Rohan Protocol MCP Server
|
|
120
|
+
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.0)...');
|
|
127
121
|
}
|
|
128
122
|
run().catch((error) => {
|
|
129
|
-
console.error('
|
|
123
|
+
console.error('Fatal MCP server error:', error);
|
|
130
124
|
process.exit(1);
|
|
131
125
|
});
|
|
132
126
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+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AM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,SAAS;wBACjB,OAAO,EAAE,uEAAuE;wBAChF,OAAO;qBACR,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,4BAA4B;qBACnD,CAAC;iBACH;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;AAC/E,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rohan-protocol/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) Gateway for Rohan Protocol ZK-Handshakes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
14
|
-
"@rohan-protocol/sdk": "^0.
|
|
14
|
+
"@rohan-protocol/sdk": "^0.6.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "*",
|
package/smithery.yaml
CHANGED
|
@@ -14,7 +14,7 @@ startCommand:
|
|
|
14
14
|
args: ['-y', '@rohan-protocol/mcp@latest'],
|
|
15
15
|
env: {
|
|
16
16
|
ROHAN_FIREWALL_LEVEL: 'V-01_STRICT',
|
|
17
|
-
ROHAN_CONTRACT_ADDRESS: '
|
|
17
|
+
ROHAN_CONTRACT_ADDRESS: '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e',
|
|
18
18
|
ROHAN_RELAYER_URL: 'https://api.rohanprotocol.network/api/v1/handshake/stream',
|
|
19
19
|
...(config.rohanApiKey ? { ROHAN_API_KEY: config.rohanApiKey } : {})
|
|
20
20
|
}
|
package/src/firewall.ts
CHANGED
|
@@ -21,11 +21,11 @@ export class SemanticFirewall {
|
|
|
21
21
|
|
|
22
22
|
const serialized = JSON.stringify(intent.payload);
|
|
23
23
|
if (serialized.length > 8192) {
|
|
24
|
-
return false; // Denial-of-Service
|
|
24
|
+
return false; // Denial-of-Service Protection (Payload size cap)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (this.INJECTION_REGEX.test(serialized)) {
|
|
28
|
-
return false; // Prompt Injection
|
|
28
|
+
return false; // Semantic Prompt Injection detected
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return true;
|
package/src/gateway.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RohanRelayerClient } from '
|
|
1
|
+
import { RohanRelayerClient } from '@rohan-protocol/sdk';
|
|
2
2
|
|
|
3
3
|
export interface RohanMcpGatewayOptions {
|
|
4
4
|
transport?: 'stdio' | 'streamable-http';
|
|
@@ -8,7 +8,7 @@ export interface RohanMcpGatewayOptions {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* RohanMcpGateway
|
|
12
12
|
* Connects AI Agent pipelines (Google ADK 2.0, Gemini, Claude, Cursor)
|
|
13
13
|
* to the Rohan Protocol Gas Station via Streamable HTTP (NDJSON) or Stdio.
|
|
14
14
|
*/
|
|
@@ -20,7 +20,7 @@ export class RohanMcpGateway {
|
|
|
20
20
|
this.transport = options.transport || 'streamable-http';
|
|
21
21
|
this.relayerClient = new RohanRelayerClient({
|
|
22
22
|
relayerUrl: options.relayerUrl || 'http://127.0.0.1:4005/api/v1/handshake',
|
|
23
|
-
contractAddress: options.contractAddress || '
|
|
23
|
+
contractAddress: options.contractAddress || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e',
|
|
24
24
|
apiKey: options.apiKey,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -35,15 +35,14 @@ export class RohanMcpGateway {
|
|
|
35
35
|
parameters: {
|
|
36
36
|
type: 'object',
|
|
37
37
|
properties: {
|
|
38
|
-
agentId: { type: 'string', description: 'Identifier of calling agent' },
|
|
39
|
-
intent: { type: 'string', description: 'Semantic action intent' },
|
|
40
|
-
|
|
41
|
-
publicInputs: { type: 'object', description: 'Public inputs for on-chain verification' },
|
|
38
|
+
agentId: { type: 'string', description: 'Decentralized Identifier (DID) of calling agent' },
|
|
39
|
+
intent: { type: 'string', description: 'Semantic action intent or agreement payload' },
|
|
40
|
+
counterpartyId: { type: 'string', description: 'Optional recipient agent identifier' },
|
|
42
41
|
},
|
|
43
42
|
required: ['agentId', 'intent'],
|
|
44
43
|
},
|
|
45
44
|
execute: async (params: any) => {
|
|
46
|
-
return await this.relayerClient.
|
|
45
|
+
return await this.relayerClient.submitHandshake(params);
|
|
47
46
|
},
|
|
48
47
|
};
|
|
49
48
|
}
|
package/src/server.ts
CHANGED
|
@@ -9,22 +9,26 @@ import {
|
|
|
9
9
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
10
10
|
|
|
11
11
|
import { SemanticFirewall } from './firewall.js';
|
|
12
|
-
import { RohanClient } from '
|
|
12
|
+
import { RohanClient } from '@rohan-protocol/sdk';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '6d2d603235f996424d76c85186a79cc403245ea8ee1ba9087e40967fe71bdc4d';
|
|
14
|
+
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e';
|
|
16
15
|
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || 'http://127.0.0.1:4005/api/v1/handshake';
|
|
16
|
+
const API_KEY = process.env.ROHAN_API_KEY || '';
|
|
17
17
|
|
|
18
|
-
const rohanClient = new RohanClient(
|
|
18
|
+
const rohanClient = new RohanClient({
|
|
19
|
+
contractAddress: CONTRACT_ADDRESS,
|
|
20
|
+
relayerUrl: RELAYER_URL,
|
|
21
|
+
apiKey: API_KEY,
|
|
22
|
+
});
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
25
|
+
* ROHAN PROTOCOL MCP SERVER
|
|
26
|
+
* Empowers autonomous LLM agents with native Zero-Knowledge Handshakes via Model Context Protocol.
|
|
23
27
|
*/
|
|
24
28
|
const server = new Server(
|
|
25
29
|
{
|
|
26
30
|
name: 'rohan-protocol-mcp',
|
|
27
|
-
version: '0.
|
|
31
|
+
version: '0.6.0',
|
|
28
32
|
},
|
|
29
33
|
{
|
|
30
34
|
capabilities: {
|
|
@@ -33,28 +37,28 @@ const server = new Server(
|
|
|
33
37
|
}
|
|
34
38
|
);
|
|
35
39
|
|
|
36
|
-
// 1.
|
|
40
|
+
// 1. Declare tool schema for LLMs (100% Technical English)
|
|
37
41
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
38
42
|
return {
|
|
39
43
|
tools: [
|
|
40
44
|
{
|
|
41
45
|
name: 'rohan_zk_handshake',
|
|
42
46
|
description:
|
|
43
|
-
'
|
|
47
|
+
'Executes a cryptographic zero-knowledge state transition on Midnight Blockchain. Proves an intent, transaction, or inter-agent agreement without exposing confidential parameters.',
|
|
44
48
|
inputSchema: {
|
|
45
49
|
type: 'object',
|
|
46
50
|
properties: {
|
|
47
51
|
agentId: {
|
|
48
52
|
type: 'string',
|
|
49
|
-
description: '
|
|
53
|
+
description: 'Decentralized Identifier (DID) or identifier of the initiating agent',
|
|
50
54
|
},
|
|
51
55
|
intent: {
|
|
52
56
|
type: 'string',
|
|
53
|
-
description: '
|
|
57
|
+
description: 'Semantic action plan, payload, or agreement terms to be cryptographically committed',
|
|
54
58
|
},
|
|
55
59
|
counterpartyId: {
|
|
56
60
|
type: 'string',
|
|
57
|
-
description: '
|
|
61
|
+
description: 'Optional identifier of counterparty agent',
|
|
58
62
|
},
|
|
59
63
|
},
|
|
60
64
|
required: ['agentId', 'intent'],
|
|
@@ -64,10 +68,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
64
68
|
};
|
|
65
69
|
});
|
|
66
70
|
|
|
67
|
-
// 2.
|
|
71
|
+
// 2. Execute tool invocation
|
|
68
72
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
69
73
|
if (request.params.name !== 'rohan_zk_handshake') {
|
|
70
|
-
throw new Error(`
|
|
74
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
const args = request.params.arguments as {
|
|
@@ -76,7 +80,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
76
80
|
counterpartyId?: string;
|
|
77
81
|
};
|
|
78
82
|
|
|
79
|
-
// A. Semantic Firewall
|
|
83
|
+
// A. Semantic Firewall Verification (Security Vector V-01)
|
|
80
84
|
const isValid = SemanticFirewall.validate({
|
|
81
85
|
agentId: args.agentId,
|
|
82
86
|
action: 'rohan_zk_handshake',
|
|
@@ -99,26 +103,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
try {
|
|
102
|
-
// B.
|
|
103
|
-
const
|
|
106
|
+
// B. Generate cryptographic commitment & submit via Relayer
|
|
107
|
+
const receipt = await rohanClient.submitHandshake({
|
|
104
108
|
agentId: args.agentId,
|
|
105
109
|
intent: args.intent,
|
|
110
|
+
counterpartyId: args.counterpartyId,
|
|
106
111
|
});
|
|
107
112
|
|
|
108
|
-
// C. Proof an Relayer (Gas Station) übermitteln
|
|
109
|
-
const headers: Record<string, string> = { 'Content-Type': 'application/json' };
|
|
110
|
-
if (process.env.ROHAN_API_KEY) {
|
|
111
|
-
headers['x-rohan-api-key'] = process.env.ROHAN_API_KEY;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const response = await fetch(RELAYER_URL, {
|
|
115
|
-
method: 'POST',
|
|
116
|
-
headers,
|
|
117
|
-
body: JSON.stringify(proofData),
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const receipt = await response.json();
|
|
121
|
-
|
|
122
113
|
return {
|
|
123
114
|
content: [
|
|
124
115
|
{
|
|
@@ -126,7 +117,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
126
117
|
text: JSON.stringify(
|
|
127
118
|
{
|
|
128
119
|
status: 'success',
|
|
129
|
-
message: 'Zero-Knowledge Handshake
|
|
120
|
+
message: 'Zero-Knowledge Handshake successfully settled on Midnight Blockchain.',
|
|
130
121
|
receipt,
|
|
131
122
|
},
|
|
132
123
|
null,
|
|
@@ -154,10 +145,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
154
145
|
async function run() {
|
|
155
146
|
const transport = new StdioServerTransport();
|
|
156
147
|
await server.connect(transport);
|
|
157
|
-
console.error('🛡️ Rohan Protocol MCP Server
|
|
148
|
+
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.0)...');
|
|
158
149
|
}
|
|
159
150
|
|
|
160
151
|
run().catch((error) => {
|
|
161
|
-
console.error('
|
|
152
|
+
console.error('Fatal MCP server error:', error);
|
|
162
153
|
process.exit(1);
|
|
163
154
|
});
|