@nullclear/mcp 1.0.0 → 1.1.2

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.
Files changed (3) hide show
  1. package/README.md +34 -28
  2. package/dist/index.js +262 -8
  3. package/package.json +19 -3
package/README.md CHANGED
@@ -1,28 +1,34 @@
1
- # @nullclear/mcp
2
-
3
- Model Context Protocol (MCP) server enabling autonomous AI agents (Claude Desktop, Cursor, Gemini, OpenAI Agents) to safely transact over HTTP 402 with NullClear deferred escrow and reputation scoring.
4
-
5
- ## Exposed Tools
6
-
7
- 1. `nullclear_check_reputation`: Query an agent's on-chain trust score, clearing reliability, and Sybil wash-trade penalty flags.
8
- 2. `nullclear_escrow_x402_call`: Perform an HTTP 402 call with deferred non-custodial schema escrow, guaranteeing $0 spent if the counterparty agent fails or returns malformed data.
9
- 3. `nullclear_verify_kya_mandate`: Verify an agent's legal corporate liability backing and per-transaction limits.
10
-
11
- ## Configuration
12
-
13
- Add to your MCP client config (e.g., `claude_desktop_config.json`):
14
-
15
- ```json
16
- {
17
- "mcpServers": {
18
- "nullclear": {
19
- "command": "node",
20
- "args": ["/path/to/nullclear/packages/mcp-server/dist/index.js"],
21
- "env": {
22
- "ARBITER_URL": "https://arbiter.nullclear.dev",
23
- "BUYER_PRIVATE_KEY": "0x..."
24
- }
25
- }
26
- }
27
- }
28
- ```
1
+ # @nullclear/mcp
2
+
3
+ <!-- mcp-name: io.github.Nullclear-Protocol/nullclear -->
4
+
5
+ [![Listed on mcpservers.org](https://mcpservers.org/badge.svg)](https://mcpservers.org/servers/nullclear-protocol/nullclear)
6
+ [![NullClear Arbiter MCP server – quality and maintenance score on Glama](https://glama.ai/mcp/servers/Nullclear-Protocol/nullclear/badges/score.svg)](https://glama.ai/mcp/servers/Nullclear-Protocol/nullclear)
7
+ [![NullClear Arbiter MCP server – quality and maintenance score on Glama](https://glama.ai/mcp/servers/Nullclear-Protocol/nullclear/badges/card.svg)](https://glama.ai/mcp/servers/Nullclear-Protocol/nullclear)
8
+
9
+ Model Context Protocol (MCP) server enabling autonomous AI agents (Claude Desktop, Cursor, Gemini, OpenAI Agents) to safely transact over HTTP 402 with NullClear deferred escrow and reputation scoring.
10
+
11
+ ## Exposed Tools
12
+
13
+ 1. `nullclear_check_reputation`: Query an agent's on-chain trust score, clearing reliability, and Sybil wash-trade penalty flags.
14
+ 2. `nullclear_escrow_x402_call`: Perform an HTTP 402 call with deferred non-custodial schema escrow, guaranteeing $0 spent if the counterparty agent fails or returns malformed data.
15
+ 3. `nullclear_verify_kya_mandate`: Verify an agent's legal corporate liability backing and per-transaction limits.
16
+
17
+ ## Configuration
18
+
19
+ Add to your MCP client config (e.g., `claude_desktop_config.json`):
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "nullclear": {
25
+ "command": "node",
26
+ "args": ["/path/to/nullclear/packages/mcp-server/dist/index.js"],
27
+ "env": {
28
+ "ARBITER_URL": "https://arbiter.nullclear.dev",
29
+ "BUYER_PRIVATE_KEY": "0x..."
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ```
package/dist/index.js CHANGED
@@ -5,20 +5,27 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
  import {
7
7
  CallToolRequestSchema,
8
- ListToolsRequestSchema
8
+ ListToolsRequestSchema,
9
+ ListPromptsRequestSchema,
10
+ GetPromptRequestSchema,
11
+ ListResourcesRequestSchema,
12
+ ReadResourceRequestSchema
9
13
  } from "@modelcontextprotocol/sdk/types.js";
10
14
  import { NullClearClient, createNullClearFetch, NullClearEscrowAbortedError } from "@nullclear/x402-arbiter";
11
- var ARBITER_URL = process.env.ARBITER_URL || "https://arbiter.nullclear.dev";
12
- var DEFAULT_BUYER_KEY = process.env.BUYER_PRIVATE_KEY || "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d";
15
+ var ARBITER_URL = process.env.ARBITER_URL || "https://api.nullclear.dev";
16
+ var SANDBOX_TEST_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
17
+ var DEFAULT_BUYER_KEY = process.env.BUYER_PRIVATE_KEY || SANDBOX_TEST_KEY;
13
18
  var client = new NullClearClient({ arbiterUrl: ARBITER_URL });
14
19
  var server = new Server(
15
20
  {
16
21
  name: "nullclear-mcp-server",
17
- version: "1.0.0"
22
+ version: "1.1.2"
18
23
  },
19
24
  {
20
25
  capabilities: {
21
- tools: {}
26
+ tools: {},
27
+ prompts: {},
28
+ resources: {}
22
29
  }
23
30
  }
24
31
  );
@@ -28,13 +35,20 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
28
35
  {
29
36
  name: "nullclear_check_reputation",
30
37
  description: "Inspect an AI agent's trust score (0-100), clearing reliability, Sybil wash-trade penalty flags, and corporate KYA backing on Base",
38
+ annotations: {
39
+ title: "Inspect AI Agent Trust & Sybil Score",
40
+ readOnlyHint: true,
41
+ destructiveHint: false,
42
+ idempotentHint: true,
43
+ openWorldHint: true
44
+ },
31
45
  inputSchema: {
32
46
  type: "object",
33
47
  required: ["agentId"],
34
48
  properties: {
35
49
  agentId: {
36
50
  type: "string",
37
- description: "The ERC-8004 agent token ID or registered identifier"
51
+ description: "The ERC-8004 agent token ID or registered identifier (e.g. '124595')"
38
52
  },
39
53
  chainId: {
40
54
  type: "number",
@@ -46,7 +60,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
46
60
  },
47
61
  {
48
62
  name: "nullclear_escrow_x402_call",
49
- description: "Execute an x402-gated HTTP API call through NullClear deferred schema escrow. The arbiter guarantees payment is only settled if upstream returns valid data matching your schema contract. If the seller hallucinates or crashes, $0 is spent.",
63
+ description: "Execute an x402-gated HTTP API call through NullClear deferred schema escrow. The arbiter guarantees payment is only settled if upstream returns valid data matching your schema contract. If the seller hallucinates or crashes, $0 is spent. Users can test immediately against https://api.nullclear.dev/v1/sandbox/market-feed (or fail over from https://api.nullclear.dev/v1/sandbox/hallucinating-seller to https://api.nullclear.dev/v1/sandbox/market-feed) with zero wallet setup.",
64
+ annotations: {
65
+ title: "Execute Escrowed x402 Call with Invariants",
66
+ readOnlyHint: false,
67
+ destructiveHint: false,
68
+ idempotentHint: false,
69
+ openWorldHint: true
70
+ },
50
71
  inputSchema: {
51
72
  type: "object",
52
73
  required: ["targetUrl"],
@@ -78,6 +99,55 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
78
99
  type: "object",
79
100
  description: "JSON Schema draft-07 contract that response must strictly satisfy"
80
101
  },
102
+ invariants: {
103
+ type: "array",
104
+ description: "Deep value invariants (numeric bounds, regex, forbidden substrings, timestamp freshness)",
105
+ items: {
106
+ type: "object",
107
+ required: ["path"],
108
+ properties: {
109
+ path: { type: "string", description: "Dot-notation property path" },
110
+ gt: { type: "number" },
111
+ gte: { type: "number" },
112
+ lt: { type: "number" },
113
+ lte: { type: "number" },
114
+ eq: {},
115
+ neq: {},
116
+ minLength: { type: "number" },
117
+ maxLength: { type: "number" },
118
+ pattern: { type: "string" },
119
+ notContains: { type: "array", items: { type: "string" } },
120
+ maxStalenessSeconds: { type: "number" }
121
+ }
122
+ }
123
+ },
124
+ rejectRefusals: {
125
+ type: "boolean",
126
+ description: "Reject canonical LLM refusal strings (default: true)",
127
+ default: true
128
+ },
129
+ fallbacks: {
130
+ type: "array",
131
+ description: "Ordered fallback candidates for autonomous multi-seller failover routing (max 3)",
132
+ items: {
133
+ type: "object",
134
+ required: ["targetUrl", "paymentSignatureHeader"],
135
+ properties: {
136
+ targetUrl: { type: "string" },
137
+ sellerAgentId: { type: "string" },
138
+ paymentSignatureHeader: { type: "string" },
139
+ headers: { type: "object" }
140
+ }
141
+ }
142
+ },
143
+ spendPolicy: {
144
+ type: "object",
145
+ description: "Outbound spend firewall limits (maxPerCallAtomic, maxDailyWalletAtomic)",
146
+ properties: {
147
+ maxPerCallAtomic: { type: "string", description: "Max atomic USDC spend allowed per call" },
148
+ maxDailyWalletAtomic: { type: "string", description: "Max rolling daily atomic USDC spend allowed" }
149
+ }
150
+ },
81
151
  buyerPrivateKey: {
82
152
  type: "string",
83
153
  description: "Optional buyer private key (defaults to BUYER_PRIVATE_KEY environment variable)"
@@ -88,6 +158,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
88
158
  {
89
159
  name: "nullclear_verify_kya_mandate",
90
160
  description: "Verify an agent's Know Your Agent (KYA) corporate liability mandate, active validity, and whether a proposed transaction amount is within corporate limits",
161
+ annotations: {
162
+ title: "Verify Corporate KYA Mandate & Limits",
163
+ readOnlyHint: true,
164
+ destructiveHint: false,
165
+ idempotentHint: true,
166
+ openWorldHint: true
167
+ },
91
168
  inputSchema: {
92
169
  type: "object",
93
170
  required: ["agentId", "transactionAmountUsd"],
@@ -111,6 +188,175 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
111
188
  ]
112
189
  };
113
190
  });
191
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
192
+ return {
193
+ prompts: [
194
+ {
195
+ name: "safe-x402-payment",
196
+ description: "Generate safety invariants and schema-escrow directives for an autonomous agent paying an upstream x402 seller.",
197
+ arguments: [
198
+ {
199
+ name: "targetUrl",
200
+ description: "Upstream API endpoint demanding x402 payment",
201
+ required: true
202
+ },
203
+ {
204
+ name: "sellerAgentId",
205
+ description: "Seller's ERC-8004 agent token ID to verify reputation",
206
+ required: false
207
+ },
208
+ {
209
+ name: "maxSpendAtomic",
210
+ description: "Maximum atomic USDC units authorized (default: 10000 = $0.01 USDC)",
211
+ required: false
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ name: "audit-erc8004-agent",
217
+ description: "Conduct an end-to-end trust audit on an ERC-8004 agent on Base including Sybil risk and corporate KYA backing.",
218
+ arguments: [
219
+ {
220
+ name: "agentId",
221
+ description: "ERC-8004 agent token ID (e.g. '124595')",
222
+ required: true
223
+ },
224
+ {
225
+ name: "chainId",
226
+ description: "Base chain ID (default: 8453)",
227
+ required: false
228
+ }
229
+ ]
230
+ }
231
+ ]
232
+ };
233
+ });
234
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
235
+ const { name, arguments: promptArgs } = request.params;
236
+ if (name === "safe-x402-payment") {
237
+ const targetUrl = promptArgs?.targetUrl || "https://api.nullclear.dev/v1/sandbox/market-feed";
238
+ const sellerAgentId = promptArgs?.sellerAgentId || "unknown";
239
+ const maxSpendAtomic = promptArgs?.maxSpendAtomic || "10000";
240
+ return {
241
+ description: "Safe x402 Escrow Clearing Directive",
242
+ messages: [
243
+ {
244
+ role: "user",
245
+ content: {
246
+ type: "text",
247
+ text: `You are preparing to execute an autonomous payment to an x402 service at ${targetUrl}.
248
+
249
+ Mandatory Safety Rules:
250
+ 1. NEVER send unconditional payments directly to unverified endpoints.
251
+ 2. Invoke the MCP tool 'nullclear_escrow_x402_call' with targetUrl="${targetUrl}", sellerAgentId="${sellerAgentId}", minTrustScore=50, and spendPolicy={ maxPerCallAtomic: "${maxSpendAtomic}" }.
252
+ 3. Supply an explicit JSON schema and deep numeric invariants to validate the seller's response before settlement.
253
+ 4. If the seller hallucinates, returns an LLM refusal, or crashes, the arbiter voids the payment automatically and $0.00 is charged.`
254
+ }
255
+ }
256
+ ]
257
+ };
258
+ }
259
+ if (name === "audit-erc8004-agent") {
260
+ const agentId = promptArgs?.agentId || "124595";
261
+ const chainId = promptArgs?.chainId || "8453";
262
+ return {
263
+ description: "ERC-8004 Agent Trust & Sybil Audit",
264
+ messages: [
265
+ {
266
+ role: "user",
267
+ content: {
268
+ type: "text",
269
+ text: `Perform a comprehensive security audit of ERC-8004 agent #${agentId} on chain ${chainId}.
270
+ 1. Run MCP tool 'nullclear_check_reputation' with agentId="${agentId}", chainId=${chainId}.
271
+ 2. Run MCP tool 'nullclear_verify_kya_mandate' with agentId="${agentId}", chainId=${chainId}, transactionAmountUsd=1.0.
272
+ 3. Analyze the composite trust score, letter grade (A-F), Sybil wash-trading risk flags, and corporate liability coverage.
273
+ 4. Provide a clear recommendation on whether this agent is safe for autonomous financial counterparty interactions.`
274
+ }
275
+ }
276
+ ]
277
+ };
278
+ }
279
+ throw new Error(`Unknown prompt: ${name}`);
280
+ });
281
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
282
+ return {
283
+ resources: [
284
+ {
285
+ uri: "nullclear://stats/live",
286
+ name: "NullClear Live Protocol Telemetry",
287
+ mimeType: "application/json",
288
+ description: "Live protocol metrics: total clearings, verified settlements, voided hallucinations, and indexed agents"
289
+ },
290
+ {
291
+ uri: "nullclear://docs/quickstart",
292
+ name: "NullClear Quickstart Guide",
293
+ mimeType: "text/markdown",
294
+ description: "Zero-loss x402 deferred schema escrow guide for autonomous AI agents on Base Mainnet"
295
+ }
296
+ ]
297
+ };
298
+ });
299
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
300
+ const { uri } = request.params;
301
+ if (uri === "nullclear://stats/live") {
302
+ try {
303
+ const res = await fetch(`${ARBITER_URL}/v1/stats`);
304
+ const data = await res.json();
305
+ return {
306
+ contents: [
307
+ {
308
+ uri,
309
+ mimeType: "application/json",
310
+ text: JSON.stringify(data, null, 2)
311
+ }
312
+ ]
313
+ };
314
+ } catch {
315
+ return {
316
+ contents: [
317
+ {
318
+ uri,
319
+ mimeType: "application/json",
320
+ text: JSON.stringify({
321
+ totalClearings: 0,
322
+ validSettlements: 0,
323
+ voidedHallucinations: 0,
324
+ totalAgentsIndexed: 1,
325
+ status: "active"
326
+ }, null, 2)
327
+ }
328
+ ]
329
+ };
330
+ }
331
+ }
332
+ if (uri === "nullclear://docs/quickstart") {
333
+ return {
334
+ contents: [
335
+ {
336
+ uri,
337
+ mimeType: "text/markdown",
338
+ text: `# NullClear Arbiter Quickstart
339
+
340
+ NullClear is the autonomous deferred clearing and reputation protocol for AI agent commerce on Base Mainnet.
341
+
342
+ ### Core Philosophy
343
+ Never sign away funds unconditionally. Using EIP-3009 signed authorizations and deterministic JSON schema validation, NullClear holds seller payments in deferred escrow and only settles if output adheres 100% to your contract.
344
+
345
+ ### Primary MCP Tools
346
+ - \`nullclear_escrow_x402_call\`: Execute deferred schema escrow with numeric bounds and LLM refusal guards.
347
+ - \`nullclear_check_reputation\`: Check an ERC-8004 agent's Sybil trust score (0-100) and wash-trading flags.
348
+ - \`nullclear_verify_kya_mandate\`: Verify an agent's corporate entity backing and spending limits.
349
+
350
+ ### Test Sandbox
351
+ - Market Feed (Success): \`https://api.nullclear.dev/v1/sandbox/market-feed\` ($0.01 USDC)
352
+ - Hallucinating Seller (Fails & Voids): \`https://api.nullclear.dev/v1/sandbox/hallucinating-seller\`
353
+ `
354
+ }
355
+ ]
356
+ };
357
+ }
358
+ throw new Error(`Resource not found: ${uri}`);
359
+ });
114
360
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
115
361
  const { name, arguments: args } = request.params;
116
362
  try {
@@ -148,6 +394,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
148
394
  const minTrustScore = args?.minTrustScore ? Number(args.minTrustScore) : 50;
149
395
  const requiredFields = args?.requiredFields || void 0;
150
396
  const jsonSchema = args?.jsonSchema || void 0;
397
+ const invariants = args?.invariants || void 0;
398
+ const rejectRefusals = args?.rejectRefusals !== void 0 ? Boolean(args.rejectRefusals) : true;
399
+ const fallbacks = args?.fallbacks || void 0;
400
+ const spendPolicy = args?.spendPolicy || void 0;
151
401
  const buyerPrivateKey = args?.buyerPrivateKey || DEFAULT_BUYER_KEY;
152
402
  const nullclearFetch = createNullClearFetch({
153
403
  accountOrPrivateKey: buyerPrivateKey,
@@ -162,7 +412,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
162
412
  sellerAgentId,
163
413
  minTrustScore,
164
414
  schema: jsonSchema,
165
- requiredFields
415
+ requiredFields,
416
+ invariants,
417
+ rejectRefusals,
418
+ fallbacks,
419
+ spendPolicy
166
420
  }
167
421
  });
168
422
  const responseText = await response.text();
package/package.json CHANGED
@@ -1,9 +1,25 @@
1
1
  {
2
2
  "name": "@nullclear/mcp",
3
- "version": "1.0.0",
3
+ "version": "1.1.2",
4
+ "mcpName": "io.github.Nullclear-Protocol/nullclear",
4
5
  "description": "Model Context Protocol server for autonomous agents using NullClear",
5
6
  "license": "MIT",
7
+ "author": "NullClear Protocol <contact@nullclear.dev>",
6
8
  "homepage": "https://nullclear.dev",
9
+ "keywords": [
10
+ "mcp",
11
+ "model-context-protocol",
12
+ "x402",
13
+ "erc-8004",
14
+ "agent-payments",
15
+ "escrow",
16
+ "reputation",
17
+ "base",
18
+ "smithery"
19
+ ],
20
+ "bugs": {
21
+ "url": "https://github.com/Nullclear-Protocol/nullclear/issues"
22
+ },
7
23
  "repository": {
8
24
  "type": "git",
9
25
  "url": "https://github.com/Nullclear-Protocol/nullclear.git"
@@ -23,8 +39,8 @@
23
39
  },
24
40
  "dependencies": {
25
41
  "@modelcontextprotocol/sdk": "^1.6.1",
26
- "@nullclear/shared": "1.0.0",
27
- "@nullclear/x402-arbiter": "1.0.0",
42
+ "@nullclear/shared": "1.1.2",
43
+ "@nullclear/x402-arbiter": "1.1.2",
28
44
  "viem": "^2.23.0",
29
45
  "zod": "^3.24.2"
30
46
  },