veritaszk-mcp 0.1.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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ const EXPLORER = 'https://api.explorer.provable.com/v1/testnet';
6
+ const CORE = 'veritaszk_core.aleo';
7
+ const AUDIT = 'veritaszk_audit.aleo';
8
+ const REGISTRY = 'veritaszk_registry.aleo';
9
+ async function q(program, mapping, key) {
10
+ const res = await fetch(`${EXPLORER}/program/${program}/mapping/${mapping}/${key}`);
11
+ if (!res.ok)
12
+ return null;
13
+ try {
14
+ return await res.json();
15
+ }
16
+ catch {
17
+ return null;
18
+ }
19
+ }
20
+ const server = new Server({ name: 'veritaszk-mcp', version: '0.1.0' }, { capabilities: { tools: {} } });
21
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
22
+ tools: [
23
+ {
24
+ name: 'check_solvency',
25
+ description: 'Check if an organization has a valid zero-knowledge solvency proof on Aleo via VeritasZK',
26
+ inputSchema: { type: 'object',
27
+ properties: { org_commitment: { type: 'string',
28
+ description: 'Organization commitment field' } },
29
+ required: ['org_commitment'] },
30
+ },
31
+ {
32
+ name: 'get_proof_details',
33
+ description: 'Get full solvency proof metadata including timestamp, expiry, threshold level, verification count',
34
+ inputSchema: { type: 'object',
35
+ properties: { org_commitment: { type: 'string' } },
36
+ required: ['org_commitment'] },
37
+ },
38
+ {
39
+ name: 'get_audit_trail',
40
+ description: 'Get proof event audit trail for an organization from the VeritasZK audit program',
41
+ inputSchema: { type: 'object',
42
+ properties: { org_commitment: { type: 'string' } },
43
+ required: ['org_commitment'] },
44
+ },
45
+ {
46
+ name: 'list_verified_orgs',
47
+ description: 'Get VeritasZK protocol info and how to find verified organizations on the public dashboard',
48
+ inputSchema: { type: 'object',
49
+ properties: { limit: { type: 'number' } } },
50
+ },
51
+ {
52
+ name: 'request_verification',
53
+ description: 'Get the command to trigger on-chain verification count increment for an organization',
54
+ inputSchema: { type: 'object',
55
+ properties: { org_commitment: { type: 'string' } },
56
+ required: ['org_commitment'] },
57
+ },
58
+ ],
59
+ }));
60
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
61
+ const { name, arguments: args } = request.params;
62
+ if (name === 'check_solvency') {
63
+ const c = args?.org_commitment;
64
+ const [solvent, expiry, count] = await Promise.all([
65
+ q(CORE, 'solvency_proofs', c),
66
+ q(CORE, 'proof_expiry', c),
67
+ q(CORE, 'verification_counts', c),
68
+ ]);
69
+ const isSolvent = solvent === true || solvent === 'true';
70
+ const expiryBlock = expiry
71
+ ? Number(String(expiry).replace('u32', '')) : null;
72
+ const verCount = count
73
+ ? Number(String(count).replace('u32', '')) : 0;
74
+ return { content: [{ type: 'text', text: [
75
+ 'VeritasZK Solvency Check',
76
+ `Organization: ${c}`,
77
+ `Status: ${isSolvent ? '✓ SOLVENT' : '✗ NOT SOLVENT'}`,
78
+ `Verified by: ${verCount} parties`,
79
+ `Expires at: block ${expiryBlock ?? 'no expiry set'}`,
80
+ 'Network: Aleo Testnet',
81
+ ].join('\n') }] };
82
+ }
83
+ if (name === 'get_proof_details') {
84
+ const c = args?.org_commitment;
85
+ const [solvent, timestamp, expiry, count, threshold] = await Promise.all([
86
+ q(CORE, 'solvency_proofs', c),
87
+ q(CORE, 'proof_timestamps', c),
88
+ q(CORE, 'proof_expiry', c),
89
+ q(CORE, 'verification_counts', c),
90
+ q(CORE, 'threshold_proofs', c),
91
+ ]);
92
+ return { content: [{ type: 'text',
93
+ text: JSON.stringify({ org_commitment: c,
94
+ is_solvent: solvent === true || solvent === 'true',
95
+ proof_timestamp_block: timestamp, expiry_block: expiry,
96
+ verification_count: count, threshold_level: threshold,
97
+ network: 'testnet' }, null, 2) }] };
98
+ }
99
+ if (name === 'get_audit_trail') {
100
+ const c = args?.org_commitment;
101
+ const [count, lastBlock, expired] = await Promise.all([
102
+ q(AUDIT, 'event_count', c),
103
+ q(AUDIT, 'last_proof_block', c),
104
+ q(AUDIT, 'expired_proofs', c),
105
+ ]);
106
+ return { content: [{ type: 'text',
107
+ text: JSON.stringify({ org_commitment: c,
108
+ total_proof_events: count, last_proof_block: lastBlock,
109
+ is_expired: expired, audit_program: AUDIT }, null, 2) }] };
110
+ }
111
+ if (name === 'list_verified_orgs') {
112
+ return { content: [{ type: 'text', text: [
113
+ 'VeritasZK — Zero-Knowledge Solvency Proofs on Aleo',
114
+ '',
115
+ 'Public dashboard: https://veritaszk.vercel.app',
116
+ '',
117
+ 'Deployed programs (Aleo Testnet):',
118
+ ` Registry: ${REGISTRY}`,
119
+ ` Core: ${CORE}`,
120
+ ` Audit: ${AUDIT}`,
121
+ '',
122
+ 'Use check_solvency with an org_commitment to verify',
123
+ 'any organization in real time.',
124
+ ].join('\n') }] };
125
+ }
126
+ if (name === 'request_verification') {
127
+ const c = args?.org_commitment;
128
+ return { content: [{ type: 'text', text: [
129
+ 'To trigger on-chain verification, run:',
130
+ '',
131
+ `leo execute verify_solvency ${c} \\`,
132
+ ' --network testnet \\',
133
+ ' --private-key YOUR_PRIVATE_KEY \\',
134
+ ' --broadcast',
135
+ '',
136
+ `Program: ${CORE}`,
137
+ 'This increments the on-chain verification count.',
138
+ ].join('\n') }] };
139
+ }
140
+ throw new Error(`Unknown tool: ${name}`);
141
+ });
142
+ const transport = new StdioServerTransport();
143
+ await server.connect(transport);
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "veritaszk-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for VeritasZK zero-knowledge solvency proofs on Aleo",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": { "veritaszk-mcp": "dist/index.js" },
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "start": "node dist/index.js",
11
+ "prepublishOnly": "npm run build"
12
+ },
13
+ "keywords": ["mcp", "aleo", "zero-knowledge", "solvency", "zk"],
14
+ "license": "MIT",
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.0.0",
17
+ "zod": "^3.22.0"
18
+ },
19
+ "devDependencies": {
20
+ "typescript": "^5.4.0",
21
+ "@types/node": "^20.0.0"
22
+ }
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js'
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
4
+ import {
5
+ CallToolRequestSchema,
6
+ ListToolsRequestSchema,
7
+ } from '@modelcontextprotocol/sdk/types.js'
8
+
9
+ const EXPLORER = 'https://api.explorer.provable.com/v1/testnet'
10
+ const CORE = 'veritaszk_core.aleo'
11
+ const AUDIT = 'veritaszk_audit.aleo'
12
+ const REGISTRY = 'veritaszk_registry.aleo'
13
+
14
+ async function q(program: string, mapping: string, key: string) {
15
+ const res = await fetch(
16
+ `${EXPLORER}/program/${program}/mapping/${mapping}/${key}`
17
+ )
18
+ if (!res.ok) return null
19
+ try { return await res.json() } catch { return null }
20
+ }
21
+
22
+ const server = new Server(
23
+ { name: 'veritaszk-mcp', version: '0.1.0' },
24
+ { capabilities: { tools: {} } }
25
+ )
26
+
27
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
28
+ tools: [
29
+ {
30
+ name: 'check_solvency',
31
+ description: 'Check if an organization has a valid zero-knowledge solvency proof on Aleo via VeritasZK',
32
+ inputSchema: { type: 'object',
33
+ properties: { org_commitment: { type: 'string',
34
+ description: 'Organization commitment field' } },
35
+ required: ['org_commitment'] },
36
+ },
37
+ {
38
+ name: 'get_proof_details',
39
+ description: 'Get full solvency proof metadata including timestamp, expiry, threshold level, verification count',
40
+ inputSchema: { type: 'object',
41
+ properties: { org_commitment: { type: 'string' } },
42
+ required: ['org_commitment'] },
43
+ },
44
+ {
45
+ name: 'get_audit_trail',
46
+ description: 'Get proof event audit trail for an organization from the VeritasZK audit program',
47
+ inputSchema: { type: 'object',
48
+ properties: { org_commitment: { type: 'string' } },
49
+ required: ['org_commitment'] },
50
+ },
51
+ {
52
+ name: 'list_verified_orgs',
53
+ description: 'Get VeritasZK protocol info and how to find verified organizations on the public dashboard',
54
+ inputSchema: { type: 'object',
55
+ properties: { limit: { type: 'number' } } },
56
+ },
57
+ {
58
+ name: 'request_verification',
59
+ description: 'Get the command to trigger on-chain verification count increment for an organization',
60
+ inputSchema: { type: 'object',
61
+ properties: { org_commitment: { type: 'string' } },
62
+ required: ['org_commitment'] },
63
+ },
64
+ ],
65
+ }))
66
+
67
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
68
+ const { name, arguments: args } = request.params
69
+
70
+ if (name === 'check_solvency') {
71
+ const c = args?.org_commitment as string
72
+ const [solvent, expiry, count] = await Promise.all([
73
+ q(CORE, 'solvency_proofs', c),
74
+ q(CORE, 'proof_expiry', c),
75
+ q(CORE, 'verification_counts', c),
76
+ ])
77
+ const isSolvent = solvent === true || solvent === 'true'
78
+ const expiryBlock = expiry
79
+ ? Number(String(expiry).replace('u32', '')) : null
80
+ const verCount = count
81
+ ? Number(String(count).replace('u32', '')) : 0
82
+ return { content: [{ type: 'text', text: [
83
+ 'VeritasZK Solvency Check',
84
+ `Organization: ${c}`,
85
+ `Status: ${isSolvent ? '✓ SOLVENT' : '✗ NOT SOLVENT'}`,
86
+ `Verified by: ${verCount} parties`,
87
+ `Expires at: block ${expiryBlock ?? 'no expiry set'}`,
88
+ 'Network: Aleo Testnet',
89
+ ].join('\n') }] }
90
+ }
91
+
92
+ if (name === 'get_proof_details') {
93
+ const c = args?.org_commitment as string
94
+ const [solvent, timestamp, expiry, count, threshold] =
95
+ await Promise.all([
96
+ q(CORE, 'solvency_proofs', c),
97
+ q(CORE, 'proof_timestamps', c),
98
+ q(CORE, 'proof_expiry', c),
99
+ q(CORE, 'verification_counts', c),
100
+ q(CORE, 'threshold_proofs', c),
101
+ ])
102
+ return { content: [{ type: 'text',
103
+ text: JSON.stringify({ org_commitment: c,
104
+ is_solvent: solvent === true || solvent === 'true',
105
+ proof_timestamp_block: timestamp, expiry_block: expiry,
106
+ verification_count: count, threshold_level: threshold,
107
+ network: 'testnet' }, null, 2) }] }
108
+ }
109
+
110
+ if (name === 'get_audit_trail') {
111
+ const c = args?.org_commitment as string
112
+ const [count, lastBlock, expired] = await Promise.all([
113
+ q(AUDIT, 'event_count', c),
114
+ q(AUDIT, 'last_proof_block', c),
115
+ q(AUDIT, 'expired_proofs', c),
116
+ ])
117
+ return { content: [{ type: 'text',
118
+ text: JSON.stringify({ org_commitment: c,
119
+ total_proof_events: count, last_proof_block: lastBlock,
120
+ is_expired: expired, audit_program: AUDIT }, null, 2) }] }
121
+ }
122
+
123
+ if (name === 'list_verified_orgs') {
124
+ return { content: [{ type: 'text', text: [
125
+ 'VeritasZK — Zero-Knowledge Solvency Proofs on Aleo',
126
+ '',
127
+ 'Public dashboard: https://veritaszk.vercel.app',
128
+ '',
129
+ 'Deployed programs (Aleo Testnet):',
130
+ ` Registry: ${REGISTRY}`,
131
+ ` Core: ${CORE}`,
132
+ ` Audit: ${AUDIT}`,
133
+ '',
134
+ 'Use check_solvency with an org_commitment to verify',
135
+ 'any organization in real time.',
136
+ ].join('\n') }] }
137
+ }
138
+
139
+ if (name === 'request_verification') {
140
+ const c = args?.org_commitment as string
141
+ return { content: [{ type: 'text', text: [
142
+ 'To trigger on-chain verification, run:',
143
+ '',
144
+ `leo execute verify_solvency ${c} \\`,
145
+ ' --network testnet \\',
146
+ ' --private-key YOUR_PRIVATE_KEY \\',
147
+ ' --broadcast',
148
+ '',
149
+ `Program: ${CORE}`,
150
+ 'This increments the on-chain verification count.',
151
+ ].join('\n') }] }
152
+ }
153
+
154
+ throw new Error(`Unknown tool: ${name}`)
155
+ })
156
+
157
+ const transport = new StdioServerTransport()
158
+ await server.connect(transport)
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "outDir": "dist",
7
+ "declaration": true,
8
+ "strict": true,
9
+ "esModuleInterop": true
10
+ },
11
+ "include": ["src/**/*"]
12
+ }