@rohan-protocol/mcp 0.6.0 → 0.6.1
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/LICENSE +21 -0
- package/dist/server.d.ts +30 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +46 -61
- package/dist/server.js.map +1 -1
- package/package.json +30 -20
- package/server.json +25 -24
- package/src/server.ts +59 -73
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rohan Protocol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export {
|
|
2
|
+
export declare const ROHAN_TOOL_SCHEMA: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
agentId: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
actionSummary: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
confidentialPayload: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
counterpartyId: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
intent: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
3
32
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAmCA,eAAO,MAAM,iBAAiB;IAC5B,IAAI;IACJ,WAAW;IAEX,WAAW;QACT,IAAI;QACJ,UAAU;YACR,OAAO;gBACL,IAAI;gBACJ,WAAW;;YAEb,aAAa;gBACX,IAAI;gBACJ,WAAW;;YAEb,mBAAmB;gBACjB,IAAI;gBACJ,WAAW;;YAEb,cAAc;gBACZ,IAAI;gBACJ,WAAW;;YAEb,MAAM;gBACJ,IAAI;gBACJ,WAAW;;;QAGf,QAAQ;;CAEX,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -3,63 +3,65 @@ 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 '@rohan-protocol/sdk';
|
|
6
|
+
import { RohanClient, sealActionIntent } from '@rohan-protocol/sdk';
|
|
7
7
|
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e';
|
|
8
|
-
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || '
|
|
8
|
+
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || 'https://api.rohanprotocol.network/api/v1/handshake';
|
|
9
9
|
const API_KEY = process.env.ROHAN_API_KEY || '';
|
|
10
10
|
const rohanClient = new RohanClient({
|
|
11
11
|
contractAddress: CONTRACT_ADDRESS,
|
|
12
12
|
relayerUrl: RELAYER_URL,
|
|
13
13
|
apiKey: API_KEY,
|
|
14
14
|
});
|
|
15
|
-
/**
|
|
16
|
-
* ROHAN PROTOCOL MCP SERVER
|
|
17
|
-
* Empowers autonomous LLM agents with native Zero-Knowledge Handshakes via Model Context Protocol.
|
|
18
|
-
*/
|
|
19
15
|
const server = new Server({
|
|
20
16
|
name: 'rohan-protocol-mcp',
|
|
21
|
-
version: '0.6.
|
|
17
|
+
version: '0.6.1',
|
|
22
18
|
}, {
|
|
23
19
|
capabilities: {
|
|
24
20
|
tools: {},
|
|
25
21
|
},
|
|
26
22
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
counterpartyId: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Optional identifier of counterparty agent',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
required: ['agentId', 'intent'],
|
|
51
|
-
},
|
|
23
|
+
export const ROHAN_TOOL_SCHEMA = {
|
|
24
|
+
name: 'rohan_zk_handshake',
|
|
25
|
+
description: 'Executes a confidential zero-knowledge state transition on Midnight Blockchain. Confidential parameters are automatically canonicalized (RFC 8785) and hashed in client RAM—never exposed on-chain or in model logs.',
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
agentId: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Decentralized Identifier (DID) of the initiating agent',
|
|
32
|
+
},
|
|
33
|
+
actionSummary: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: "Public high-level action label (e.g. 'Vendor Agreement Execution', 'Database Audit Anchor')",
|
|
36
|
+
},
|
|
37
|
+
confidentialPayload: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
description: 'OPTIONAL confidential parameters (budgets, deals, PII). Automatically canonicalized via RFC 8785 and hashed in local memory.',
|
|
52
40
|
},
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
counterpartyId: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Optional counterparty agent identifier',
|
|
44
|
+
},
|
|
45
|
+
intent: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Legacy fallback for actionSummary',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ['agentId'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
54
|
+
return { tools: [ROHAN_TOOL_SCHEMA] };
|
|
55
55
|
});
|
|
56
|
-
// 2. Execute tool invocation
|
|
57
56
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
58
57
|
if (request.params.name !== 'rohan_zk_handshake') {
|
|
59
58
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
60
59
|
}
|
|
61
60
|
const args = request.params.arguments;
|
|
62
|
-
|
|
61
|
+
const actionLabel = args.actionSummary || args.intent;
|
|
62
|
+
if (!actionLabel) {
|
|
63
|
+
throw new Error('Invalid arguments: Either actionSummary or intent is required.');
|
|
64
|
+
}
|
|
63
65
|
const isValid = SemanticFirewall.validate({
|
|
64
66
|
agentId: args.agentId,
|
|
65
67
|
action: 'rohan_zk_handshake',
|
|
@@ -67,49 +69,32 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
67
69
|
});
|
|
68
70
|
if (!isValid) {
|
|
69
71
|
return {
|
|
70
|
-
content: [
|
|
71
|
-
{
|
|
72
|
-
type: 'text',
|
|
73
|
-
text: JSON.stringify({
|
|
74
|
-
success: false,
|
|
75
|
-
error: 'Security Violation: Intent rejected by Semantic Firewall (V-01)',
|
|
76
|
-
}),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
72
|
+
content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Security Violation: Intent rejected by Semantic Firewall (V-01)' }) }],
|
|
79
73
|
isError: true,
|
|
80
74
|
};
|
|
81
75
|
}
|
|
82
76
|
try {
|
|
83
|
-
//
|
|
77
|
+
// Elegant & DRY: SDK handles RFC 8785 canonicalization and RAM hashing
|
|
78
|
+
const finalIntent = sealActionIntent(actionLabel, args.confidentialPayload);
|
|
84
79
|
const receipt = await rohanClient.submitHandshake({
|
|
85
80
|
agentId: args.agentId,
|
|
86
|
-
intent:
|
|
81
|
+
intent: finalIntent,
|
|
87
82
|
counterpartyId: args.counterpartyId,
|
|
88
83
|
});
|
|
89
84
|
return {
|
|
90
|
-
content: [
|
|
91
|
-
{
|
|
85
|
+
content: [{
|
|
92
86
|
type: 'text',
|
|
93
87
|
text: JSON.stringify({
|
|
94
88
|
status: 'success',
|
|
95
89
|
message: 'Zero-Knowledge Handshake successfully settled on Midnight Blockchain.',
|
|
96
90
|
receipt,
|
|
97
91
|
}, null, 2),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
92
|
+
}],
|
|
100
93
|
};
|
|
101
94
|
}
|
|
102
95
|
catch (err) {
|
|
103
96
|
return {
|
|
104
|
-
content: [
|
|
105
|
-
{
|
|
106
|
-
type: 'text',
|
|
107
|
-
text: JSON.stringify({
|
|
108
|
-
success: false,
|
|
109
|
-
error: err.message || 'Handshake execution failed',
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
],
|
|
97
|
+
content: [{ type: 'text', text: JSON.stringify({ success: false, error: err.message || 'Handshake execution failed' }) }],
|
|
113
98
|
isError: true,
|
|
114
99
|
};
|
|
115
100
|
}
|
|
@@ -117,7 +102,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
117
102
|
async function run() {
|
|
118
103
|
const transport = new StdioServerTransport();
|
|
119
104
|
await server.connect(transport);
|
|
120
|
-
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.
|
|
105
|
+
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.1)...');
|
|
121
106
|
}
|
|
122
107
|
run().catch((error) => {
|
|
123
108
|
console.error('Fatal MCP server error:', error);
|
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,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAo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.6.
|
|
4
|
-
"description": "Model Context Protocol (MCP) Gateway for Rohan Protocol ZK-Handshakes",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@rohan-protocol/mcp",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Model Context Protocol (MCP) Gateway for Rohan Protocol ZK-Handshakes",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"mcp",
|
|
10
|
+
"mcp-server",
|
|
11
|
+
"model-context-protocol",
|
|
12
|
+
"zero-knowledge",
|
|
13
|
+
"ai-agents",
|
|
14
|
+
"midnight-network",
|
|
15
|
+
"zk-handshake",
|
|
16
|
+
"semantic-firewall"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"start": "node dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
24
|
+
"@rohan-protocol/sdk": "^0.6.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "*",
|
|
28
|
+
"typescript": "^7.0.2"
|
|
29
|
+
},
|
|
30
|
+
"bin": "./dist/server.js"
|
|
21
31
|
}
|
package/server.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://static.modelcontextprotocol.io/
|
|
3
|
-
"name": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
"version": "0.5.1",
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schema/server.json",
|
|
3
|
+
"name": "rohan-protocol/mcp",
|
|
4
|
+
"version": "0.6.0",
|
|
5
|
+
"description": "Stateless zero-knowledge trust gateway and WebMCP shield for AI agents on Midnight.",
|
|
7
6
|
"repository": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/rohan-protocol/sdk.git"
|
|
10
9
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
"homepage": "https://rohanprotocol.network",
|
|
11
|
+
"bugs": "https://github.com/rohan-protocol/sdk/issues",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"runtime": "node",
|
|
14
|
+
"entrypoint": "packages/mcp/dist/server.js",
|
|
15
|
+
"transport": "stdio",
|
|
16
|
+
"tags": [
|
|
17
|
+
"zero-knowledge",
|
|
18
|
+
"privacy",
|
|
19
|
+
"security",
|
|
20
|
+
"midnight-network",
|
|
21
|
+
"handshake",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"webmcp",
|
|
24
|
+
"firewall"
|
|
22
25
|
],
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
]
|
|
26
|
+
"environment": {
|
|
27
|
+
"ROHAN_CONTRACT_ADDRESS": "585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e",
|
|
28
|
+
"ROHAN_RELAYER_URL": "https://api.rohanprotocol.network/api/v1/handshake"
|
|
29
|
+
}
|
|
29
30
|
}
|
package/src/server.ts
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
10
10
|
|
|
11
11
|
import { SemanticFirewall } from './firewall.js';
|
|
12
|
-
import { RohanClient } from '@rohan-protocol/sdk';
|
|
12
|
+
import { RohanClient, sealActionIntent } from '@rohan-protocol/sdk';
|
|
13
13
|
|
|
14
14
|
const CONTRACT_ADDRESS = process.env.ROHAN_CONTRACT_ADDRESS || '585ac0c4448257507d8ffa2a89e2aa00abd86ec9e94bdb6f553bc83e05f4dd0e';
|
|
15
|
-
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || '
|
|
15
|
+
const RELAYER_URL = process.env.ROHAN_RELAYER_URL || 'https://api.rohanprotocol.network/api/v1/handshake';
|
|
16
16
|
const API_KEY = process.env.ROHAN_API_KEY || '';
|
|
17
17
|
|
|
18
18
|
const rohanClient = new RohanClient({
|
|
@@ -21,14 +21,10 @@ const rohanClient = new RohanClient({
|
|
|
21
21
|
apiKey: API_KEY,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* ROHAN PROTOCOL MCP SERVER
|
|
26
|
-
* Empowers autonomous LLM agents with native Zero-Knowledge Handshakes via Model Context Protocol.
|
|
27
|
-
*/
|
|
28
24
|
const server = new Server(
|
|
29
25
|
{
|
|
30
26
|
name: 'rohan-protocol-mcp',
|
|
31
|
-
version: '0.6.
|
|
27
|
+
version: '0.6.1',
|
|
32
28
|
},
|
|
33
29
|
{
|
|
34
30
|
capabilities: {
|
|
@@ -37,38 +33,42 @@ const server = new Server(
|
|
|
37
33
|
}
|
|
38
34
|
);
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
properties: {
|
|
51
|
-
agentId: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: 'Decentralized Identifier (DID) or identifier of the initiating agent',
|
|
54
|
-
},
|
|
55
|
-
intent: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
description: 'Semantic action plan, payload, or agreement terms to be cryptographically committed',
|
|
58
|
-
},
|
|
59
|
-
counterpartyId: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
description: 'Optional identifier of counterparty agent',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
required: ['agentId', 'intent'],
|
|
65
|
-
},
|
|
36
|
+
export const ROHAN_TOOL_SCHEMA = {
|
|
37
|
+
name: 'rohan_zk_handshake',
|
|
38
|
+
description:
|
|
39
|
+
'Executes a confidential zero-knowledge state transition on Midnight Blockchain. Confidential parameters are automatically canonicalized (RFC 8785) and hashed in client RAM—never exposed on-chain or in model logs.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
agentId: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Decentralized Identifier (DID) of the initiating agent',
|
|
66
46
|
},
|
|
67
|
-
|
|
68
|
-
|
|
47
|
+
actionSummary: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: "Public high-level action label (e.g. 'Vendor Agreement Execution', 'Database Audit Anchor')",
|
|
50
|
+
},
|
|
51
|
+
confidentialPayload: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
description: 'OPTIONAL confidential parameters (budgets, deals, PII). Automatically canonicalized via RFC 8785 and hashed in local memory.',
|
|
54
|
+
},
|
|
55
|
+
counterpartyId: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Optional counterparty agent identifier',
|
|
58
|
+
},
|
|
59
|
+
intent: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'Legacy fallback for actionSummary',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
required: ['agentId'],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
69
|
+
return { tools: [ROHAN_TOOL_SCHEMA] };
|
|
69
70
|
});
|
|
70
71
|
|
|
71
|
-
// 2. Execute tool invocation
|
|
72
72
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
73
73
|
if (request.params.name !== 'rohan_zk_handshake') {
|
|
74
74
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
@@ -76,11 +76,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
76
76
|
|
|
77
77
|
const args = request.params.arguments as {
|
|
78
78
|
agentId: string;
|
|
79
|
-
|
|
79
|
+
actionSummary?: string;
|
|
80
|
+
confidentialPayload?: Record<string, unknown>;
|
|
80
81
|
counterpartyId?: string;
|
|
82
|
+
intent?: string;
|
|
81
83
|
};
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
const actionLabel = args.actionSummary || args.intent;
|
|
86
|
+
if (!actionLabel) {
|
|
87
|
+
throw new Error('Invalid arguments: Either actionSummary or intent is required.');
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
const isValid = SemanticFirewall.validate({
|
|
85
91
|
agentId: args.agentId,
|
|
86
92
|
action: 'rohan_zk_handshake',
|
|
@@ -89,54 +95,34 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
89
95
|
|
|
90
96
|
if (!isValid) {
|
|
91
97
|
return {
|
|
92
|
-
content: [
|
|
93
|
-
{
|
|
94
|
-
type: 'text',
|
|
95
|
-
text: JSON.stringify({
|
|
96
|
-
success: false,
|
|
97
|
-
error: 'Security Violation: Intent rejected by Semantic Firewall (V-01)',
|
|
98
|
-
}),
|
|
99
|
-
},
|
|
100
|
-
],
|
|
98
|
+
content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Security Violation: Intent rejected by Semantic Firewall (V-01)' }) }],
|
|
101
99
|
isError: true,
|
|
102
100
|
};
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
try {
|
|
106
|
-
//
|
|
104
|
+
// Elegant & DRY: SDK handles RFC 8785 canonicalization and RAM hashing
|
|
105
|
+
const finalIntent = sealActionIntent(actionLabel, args.confidentialPayload);
|
|
106
|
+
|
|
107
107
|
const receipt = await rohanClient.submitHandshake({
|
|
108
108
|
agentId: args.agentId,
|
|
109
|
-
intent:
|
|
109
|
+
intent: finalIntent,
|
|
110
110
|
counterpartyId: args.counterpartyId,
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
return {
|
|
114
|
-
content: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
null,
|
|
124
|
-
2
|
|
125
|
-
),
|
|
126
|
-
},
|
|
127
|
-
],
|
|
114
|
+
content: [{
|
|
115
|
+
type: 'text',
|
|
116
|
+
text: JSON.stringify({
|
|
117
|
+
status: 'success',
|
|
118
|
+
message: 'Zero-Knowledge Handshake successfully settled on Midnight Blockchain.',
|
|
119
|
+
receipt,
|
|
120
|
+
}, null, 2),
|
|
121
|
+
}],
|
|
128
122
|
};
|
|
129
123
|
} catch (err: any) {
|
|
130
124
|
return {
|
|
131
|
-
content: [
|
|
132
|
-
{
|
|
133
|
-
type: 'text',
|
|
134
|
-
text: JSON.stringify({
|
|
135
|
-
success: false,
|
|
136
|
-
error: err.message || 'Handshake execution failed',
|
|
137
|
-
}),
|
|
138
|
-
},
|
|
139
|
-
],
|
|
125
|
+
content: [{ type: 'text', text: JSON.stringify({ success: false, error: err.message || 'Handshake execution failed' }) }],
|
|
140
126
|
isError: true,
|
|
141
127
|
};
|
|
142
128
|
}
|
|
@@ -145,7 +131,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
145
131
|
async function run() {
|
|
146
132
|
const transport = new StdioServerTransport();
|
|
147
133
|
await server.connect(transport);
|
|
148
|
-
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.
|
|
134
|
+
console.error('🛡️ Rohan Protocol MCP Server running via stdio (v0.6.1)...');
|
|
149
135
|
}
|
|
150
136
|
|
|
151
137
|
run().catch((error) => {
|