frisk-mcp 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frisk-mcp",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "MCP server for Frisk: screen an x402 payment counterparty before an agent pays.",
5
5
  "mcpName": "dev.tryfrisk/frisk",
6
6
  "type": "module",
@@ -8,10 +8,11 @@
8
8
  "frisk-mcp": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist/index.js",
12
+ "THIRD_PARTY_NOTICES.md"
12
13
  ],
13
14
  "scripts": {
14
- "build": "tsup",
15
+ "build": "tsup && node scripts/notices.mjs",
15
16
  "test": "vitest run",
16
17
  "typecheck": "tsc --noEmit",
17
18
  "lint": "biome check .",
@@ -38,19 +39,17 @@
38
39
  "url": "https://github.com/Jiangw2718i/frisk/issues"
39
40
  },
40
41
  "engines": {
41
- "node": ">=18"
42
- },
43
- "dependencies": {
44
- "@modelcontextprotocol/server": "^2.3.1",
45
- "frisk-screen": "^0.0.2",
46
- "zod": "^4.2.0"
42
+ "node": ">=20"
47
43
  },
48
44
  "devDependencies": {
49
45
  "@biomejs/biome": "^2.5.13",
50
46
  "@modelcontextprotocol/client": "^2.3.1",
47
+ "@modelcontextprotocol/server": "^2.3.1",
51
48
  "@types/node": "^25.9.6",
49
+ "frisk-screen": "^0.0.2",
52
50
  "tsup": "^8.5.1",
53
51
  "typescript": "^6.0.3",
54
- "vitest": "^4.1.12"
52
+ "vitest": "^4.1.12",
53
+ "zod": "^4.2.0"
55
54
  }
56
55
  }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/server.ts"],"sourcesContent":["import { StdioServerTransport } from \"@modelcontextprotocol/server/stdio\";\nimport { createServer } from \"./server.js\";\n\nasync function main(): Promise<void> {\n const server = createServer({\n apiKey: process.env.FRISK_API_KEY,\n baseUrl: process.env.FRISK_BASE_URL,\n });\n await server.connect(new StdioServerTransport());\n}\n\nmain().catch((error) => {\n // stdout carries the protocol, so diagnostics go to stderr.\n console.error(error);\n process.exit(1);\n});\n","import { McpServer } from \"@modelcontextprotocol/server\";\nimport { Client, type ScreenResult } from \"frisk-screen\";\nimport { z } from \"zod\";\n\nexport interface ServerOptions {\n /** Hosted API key. Without one the server screens entirely offline. */\n apiKey?: string;\n /** Override the hosted base URL. Only used when an API key is supplied. */\n baseUrl?: string;\n}\n\nconst inputSchema = z.object({\n counterparty: z\n .string()\n .describe(\"The address the agent intends to pay, e.g. an 0x EVM address.\"),\n endpoint: z\n .string()\n .optional()\n .describe(\"URL that quoted the payment. Used to check transport safety.\"),\n amount: z.number().optional().describe(\"Amount the agent is about to pay.\"),\n asset: z.string().optional().describe(\"Asset symbol, e.g. USDC.\"),\n observedPayTo: z\n .string()\n .optional()\n .describe(\n \"The payTo address the endpoint actually returned for this request. If it differs from the counterparty, that is the dynamic-payTo swap.\",\n ),\n strictness: z\n .number()\n .min(0)\n .max(1)\n .optional()\n .describe(\"0 is permissive, 1 is paranoid. Defaults to 0.3.\"),\n maxPerCall: z\n .number()\n .optional()\n .describe(\"Spending ceiling for a single call.\"),\n allowedAssets: z\n .array(z.string())\n .optional()\n .describe(\"Assets the agent is permitted to pay in.\"),\n});\n\n/**\n * The verdict is advisory. Frisk returns a recommendation and the caller\n * decides; it never holds funds and cannot stop a payment by itself.\n */\nfunction describeResult(result: ScreenResult): string {\n const lines = [\n `verdict: ${result.verdict}`,\n `trust score: ${result.trustScore}`,\n `confidence: ${result.confidence}`,\n `source: ${result.source}`,\n ];\n if (result.reasons.length > 0) {\n lines.push(`reasons: ${result.reasons.join(\"; \")}`);\n }\n if (result.policyHits.length > 0) {\n lines.push(`policy hits: ${result.policyHits.join(\"; \")}`);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Build the Frisk MCP server.\n *\n * One tool, deliberately. `screen_payment` is the whole deterministic floor:\n * counterparty sanity, dynamic-payTo comparison, transport check, and the\n * caller's own spending policy. With an API key the same call is answered by\n * the hosted service, which adds reputation signals.\n *\n * Note on where this belongs: an MCP tool runs when a model decides to call it,\n * so it is a weaker guarantee than calling `screen()` on the code path that\n * actually signs the payment. Use this for inspection and for agents that\n * cannot import the library; use the library where the money moves.\n */\nexport function createServer(options: ServerOptions = {}): McpServer {\n const client = new Client({\n apiKey: options.apiKey,\n baseUrl: options.baseUrl,\n });\n\n const server = new McpServer({\n name: \"frisk\",\n version: \"0.0.2\",\n });\n\n server.registerTool(\n \"screen_payment\",\n {\n title: \"Screen a payment before paying\",\n description:\n client.mode === \"hosted\"\n ? \"Screen a counterparty an agent is about to pay. Runs the local deterministic checks and the hosted reputation graph, and returns allow / review / block with reasons. Advisory: the caller decides.\"\n : \"Screen a counterparty an agent is about to pay. Runs entirely offline: address sanity, dynamic-payTo comparison, transport check, and your spending policy. Returns allow / review / block with reasons. Advisory: the caller decides. Set FRISK_API_KEY to add hosted reputation signals.\",\n inputSchema,\n annotations: {\n readOnlyHint: true,\n openWorldHint: client.mode === \"hosted\",\n },\n },\n async ({ counterparty, maxPerCall, allowedAssets, ...rest }) => {\n const policy =\n maxPerCall === undefined && allowedAssets === undefined\n ? undefined\n : { maxPerCall, allowedAssets };\n try {\n const result = await client.screen(counterparty, { ...rest, policy });\n return {\n content: [{ type: \"text\" as const, text: describeResult(result) }],\n structuredContent: { ...result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: `screening failed: ${message}`,\n },\n ],\n };\n }\n },\n );\n\n return server;\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACArC,SAAS,iBAAiB;AAC1B,SAAS,cAAiC;AAC1C,SAAS,SAAS;AASlB,IAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,cAAc,EACX,OAAO,EACP,SAAS,+DAA+D;AAAA,EAC3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