crispparse-mcp 1.0.2 → 1.0.4

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 CHANGED
@@ -2,56 +2,74 @@
2
2
 
3
3
  [![CrispParse MCP Server MCP server – quality and maintenance score on Glama](https://glama.ai/mcp/servers/goldmarklabs/crispparse-mcp/badges/card.svg)](https://glama.ai/mcp/servers/goldmarklabs/crispparse-mcp)
4
4
 
5
- A self-contained Model Context Protocol (`stdio`) server implementation built with `@modelcontextprotocol/sdk` that exposes deterministic web extraction tools to MCP-compatible AI agents and desktop clients (Claude Desktop, Cursor, Windsurf, and Cline).
5
+ A self-contained Model Context Protocol (`stdio`) server built with `@modelcontextprotocol/sdk` that exposes deterministic web extraction (Markdown, JSON, Hybrid, CSS selectors, Tier 2/3 stealth rendering) and C2PA v2.4 provenance verification to MCP-compatible AI agents and desktop clients (Claude Desktop, Cursor, Windsurf, and Cline).
6
6
 
7
7
  ## How It Works
8
8
 
9
9
  This repository implements a local MCP `stdio` server (`index.js`) using `StdioServerTransport`:
10
10
  1. Registers MCP `tools/list` and `tools/call` handlers via `@modelcontextprotocol/sdk`.
11
- 2. Exposes the `crispparse_extract` tool with JSON Schema input validation.
12
- 3. Executes upstream extraction requests against the CrispParse extraction engine (`https://api.crispparse.com/v1/extract`) and returns clean Markdown or JSON over `stdio`.
11
+ 2. Auto-provisions a free 50-credit trial Macaroon (`~/.crispparse/trial_token.json`) if no API key or `x402` Base USDC payment header is supplied.
12
+ 3. Executes upstream extraction requests against the CrispParse 3-tier waterfall engine (`https://api.crispparse.com/v1/extract`) with Zero Payload Retention (ZDR) and returns clean Markdown, structured JSON, and a signed C2PA provenance manifest.
13
13
 
14
14
  ## Available Tools
15
15
 
16
16
  ### `crispparse_extract`
17
- Extracts clean, LLM-ready Markdown or structured JSON from any public webpage URL.
17
+ Extracts clean, LLM-ready Markdown, structured JSON, or Hybrid output from any public webpage URL across CrispParse's 3-tier waterfall (static HTTP, headless JS rendering, and self-healing CSS selectors).
18
18
 
19
19
  * **`url`** (`string`, required): The full `http://` or `https://` URL to extract.
20
- * **`mode`** (`string`, optional, default `"markdown"`): Output format (`"markdown"` or `"json"`).
20
+ * **`mode`** (`string`, optional, default `"markdown"`): Output format (`"markdown"`, `"json"`, or `"hybrid"`).
21
+ * **`selectors`** (`object`, optional): Map of `field_name -> CSS selector` (up to 30 fields). Automatically triggers Tier 2 JS rendering and Tier 3 self-healing selector recovery if needed.
22
+ * **`bypass_cache`** (`boolean`, optional, default `false`): Set `true` to bypass edge cache and force a fresh live extraction.
23
+ * **`api_key`** (`string`, optional): CrispParse Macaroon bearer token (overrides `CRISPPARSE_API_KEY`).
24
+ * **`payment_signature`** (`string`, optional): `x402` v2 `PAYMENT-SIGNATURE` Base USDC proof header (overrides `CRISPPARSE_PAYMENT_SIGNATURE`).
21
25
 
22
- ## Installation & Local Execution
26
+ ### `crispparse_claim_trial`
27
+ Claims or retrieves a cached zero-config CrispParse trial Macaroon token (50 credits, 14-day TTL) for immediate extraction without manual signup.
23
28
 
24
- ### Run with Node.js (v18+)
29
+ * **`force_refresh`** (`boolean`, optional, default `false`): Request a fresh trial token instead of returning the cached token.
25
30
 
26
- git clone https://github.com/goldmarklabs/crispparse-mcp.git
27
- cd crispparse-mcp
28
- npm install
29
- CRISPPARSE_API_KEY="your_api_key" node index.js
31
+ ### `crispparse_verify`
32
+ Cryptographically verifies a detached C2PA v2.4 provenance manifest returned by `crispparse_extract` against `https://api.crispparse.com/v1/verify`.
30
33
 
31
- ### Run with Docker
32
-
33
- docker build -t crispparse-mcp .
34
- docker run -i --rm -e CRISPPARSE_API_KEY="your_api_key" crispparse-mcp
34
+ * **`provenance`** (`object`, required): The `provenance` object from a CrispParse extraction response.
35
35
 
36
36
  ## MCP Client Configuration
37
37
 
38
+ ### Zero-Install via `npx` (Recommended)
38
39
  Add the server to your Claude Desktop (`claude_desktop_config.json`) or Cursor MCP configuration:
39
40
 
40
- {
41
- "mcpServers": {
42
- "crispparse": {
43
- "command": "node",
44
- "args": ["/absolute/path/to/crispparse-mcp/index.js"],
45
- "env": {
46
- "CRISPPARSE_API_KEY": "your_api_key"
47
- }
48
- }
49
- }
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "crispparse": {
45
+ "command": "npx",
46
+ "args": ["-y", "crispparse-mcp@1.0.3"]
50
47
  }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Run from Local Clone (Node.js v18+)
53
+
54
+ ```bash
55
+ git clone https://github.com/goldmarklabs/crispparse-mcp.git
56
+ cd crispparse-mcp
57
+ npm install
58
+ CRISPPARSE_API_KEY="your_api_key" node index.js
59
+ ```
60
+
61
+ ### Run with Docker
62
+
63
+ ```bash
64
+ docker build -t crispparse-mcp .
65
+ docker run -i --rm -e CRISPPARSE_API_KEY="your_api_key" crispparse-mcp
66
+ ```
51
67
 
52
68
  ## Environment Variables
53
69
 
54
- * `CRISPPARSE_API_KEY`: Optional Bearer Macaroon API key from [crispparse.com](https://crispparse.com) (requests without a key receive an `x402` Base USDC payment challenge).
70
+ * `CRISPPARSE_API_KEY`: Optional Bearer Macaroon API key from [crispparse.com](https://crispparse.com).
71
+ * `CRISPPARSE_AUTO_CLAIM_TRIAL`: Set `"false"` to disable automatic trial token provisioning (defaults to `"true"`, falling back to an `x402` Base USDC payment challenge when unauthenticated).
72
+ * `CRISPPARSE_PAYMENT_SIGNATURE`: Optional default `x402` v2 `PAYMENT-SIGNATURE` Base USDC proof header.
55
73
  * `CRISPPARSE_API_URL`: Optional upstream endpoint override (defaults to `https://api.crispparse.com/v1/extract`).
56
74
 
57
75
  ## License
package/index.js CHANGED
@@ -8,6 +8,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
8
8
 
9
9
  const API_URL = process.env.CRISPPARSE_API_URL || "https://api.crispparse.com/v1/extract";
10
10
  const TRIAL_URL = process.env.CRISPPARSE_TRIAL_URL || API_URL.replace(/\/v1\/extract\/?$/, "/v1/trial/claim");
11
+ const VERIFY_URL = process.env.CRISPPARSE_VERIFY_URL || API_URL.replace(/\/v1\/extract\/?$/, "/v1/verify");
11
12
  const DEFAULT_API_KEY = process.env.CRISPPARSE_API_KEY || "";
12
13
  const DEFAULT_PAYMENT_SIGNATURE = process.env.CRISPPARSE_PAYMENT_SIGNATURE || "";
13
14
  const AUTO_CLAIM_TRIAL = process.env.CRISPPARSE_AUTO_CLAIM_TRIAL !== "false";
@@ -61,7 +62,7 @@ async function claimTrialToken(forceRefresh = false) {
61
62
  }
62
63
 
63
64
  const server = new Server(
64
- { name: "crispparse-mcp-server", version: "1.0.2" },
65
+ { name: "crispparse-mcp-server", version: "1.0.3" },
65
66
  { capabilities: { tools: {} } }
66
67
  );
67
68
 
@@ -69,12 +70,25 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
69
70
  tools: [
70
71
  {
71
72
  name: "crispparse_extract",
72
- description: "Extract clean, LLM-ready Markdown or structured JSON from any public URL using CrispParse (auto-provisions a free 50-credit trial Macaroon if no API key or x402 PAYMENT-SIGNATURE is configured).",
73
+ description: "Extract clean, LLM-ready Markdown, structured JSON, or Hybrid output from any public URL using CrispParse's deterministic 3-tier waterfall (static HTTP, headless JS render, and self-healing CSS selectors) with C2PA provenance.",
73
74
  inputSchema: {
74
75
  type: "object",
75
76
  properties: {
76
77
  url: { type: "string", description: "The full http:// or https:// URL to extract." },
77
- mode: { type: "string", enum: ["markdown", "json"], description: "Output format (defaults to markdown)." },
78
+ mode: {
79
+ type: "string",
80
+ enum: ["markdown", "json", "hybrid"],
81
+ description: "Output format: 'markdown' (default), 'json' (structured fields/JSON-LD), or 'hybrid' (both Markdown and structured data)."
82
+ },
83
+ selectors: {
84
+ type: "object",
85
+ additionalProperties: { type: "string" },
86
+ description: "Optional map of field_name -> CSS selector (up to 30 fields). Automatically triggers Tier 2 JS rendering and Tier 3 self-healing selector recovery if needed."
87
+ },
88
+ bypass_cache: {
89
+ type: "boolean",
90
+ description: "Set true to bypass edge cache and force a fresh live extraction (defaults to false)."
91
+ },
78
92
  api_key: { type: "string", description: "Optional CrispParse Macaroon bearer token (overrides CRISPPARSE_API_KEY)." },
79
93
  payment_signature: { type: "string", description: "Optional x402 v2 PAYMENT-SIGNATURE Base USDC proof header (overrides CRISPPARSE_PAYMENT_SIGNATURE)." }
80
94
  },
@@ -90,6 +104,20 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
90
104
  force_refresh: { type: "boolean", description: "Request a fresh trial token instead of returning the cached token." }
91
105
  }
92
106
  }
107
+ },
108
+ {
109
+ name: "crispparse_verify",
110
+ description: "Cryptographically verify a detached C2PA v2.4 provenance manifest returned by crispparse_extract.",
111
+ inputSchema: {
112
+ type: "object",
113
+ properties: {
114
+ provenance: {
115
+ type: "object",
116
+ description: "The 'provenance' object from a CrispParse extraction response."
117
+ }
118
+ },
119
+ required: ["provenance"]
120
+ }
93
121
  }
94
122
  ]
95
123
  }));
@@ -110,12 +138,40 @@ server.setRequestHandler(CallToolRequestSchema, async ({ params }) => {
110
138
  }
111
139
  }
112
140
 
141
+ if (params.name === "crispparse_verify") {
142
+ const provenance = params.arguments?.provenance;
143
+ if (!provenance || typeof provenance !== "object" || Array.isArray(provenance)) {
144
+ return { isError: true, content: [{ type: "text", text: "Missing or invalid parameter: provenance object" }] };
145
+ }
146
+ try {
147
+ const response = await fetch(VERIFY_URL, {
148
+ method: "POST",
149
+ headers: { "Content-Type": "application/json" },
150
+ body: JSON.stringify(provenance)
151
+ });
152
+ const bodyText = await response.text();
153
+ return { isError: !response.ok, content: [{ type: "text", text: bodyText }] };
154
+ } catch (error) {
155
+ return {
156
+ isError: true,
157
+ content: [{ type: "text", text: `CrispParse verify request failed: ${error instanceof Error ? error.message : String(error)}` }]
158
+ };
159
+ }
160
+ }
161
+
113
162
  if (params.name !== "crispparse_extract") {
114
163
  return { isError: true, content: [{ type: "text", text: `Unknown tool: ${params.name}` }] };
115
164
  }
116
165
 
117
166
  const targetUrl = params.arguments?.url;
118
- const mode = params.arguments?.mode === "json" ? "json" : "markdown";
167
+ const rawMode = params.arguments?.mode;
168
+ const mode = (rawMode === "json" || rawMode === "hybrid") ? rawMode : "markdown";
169
+ const rawSelectors = params.arguments?.selectors;
170
+ const selectors = (rawSelectors && typeof rawSelectors === "object" && !Array.isArray(rawSelectors) && Object.keys(rawSelectors).length > 0)
171
+ ? rawSelectors
172
+ : undefined;
173
+ const bypassCache = Boolean(params.arguments?.bypass_cache);
174
+
119
175
  let apiKey = (typeof params.arguments?.api_key === "string" && params.arguments.api_key) || DEFAULT_API_KEY;
120
176
  const paymentSignature = (typeof params.arguments?.payment_signature === "string" && params.arguments.payment_signature) || DEFAULT_PAYMENT_SIGNATURE;
121
177
 
@@ -141,10 +197,17 @@ server.setRequestHandler(CallToolRequestSchema, async ({ params }) => {
141
197
  ...(paymentSignature ? { "PAYMENT-SIGNATURE": paymentSignature } : {})
142
198
  };
143
199
 
200
+ const payload = {
201
+ url: targetUrl,
202
+ mode,
203
+ ...(selectors ? { selectors } : {}),
204
+ ...(bypassCache ? { bypass_cache: true } : {})
205
+ };
206
+
144
207
  const response = await fetch(API_URL, {
145
208
  method: "POST",
146
209
  headers,
147
- body: JSON.stringify({ url: targetUrl, mode })
210
+ body: JSON.stringify(payload)
148
211
  });
149
212
 
150
213
  const bodyText = await response.text();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "crispparse-mcp",
3
- "version": "1.0.2",
4
- "description": "Local stdio Model Context Protocol (MCP) server for deterministic web extraction to clean Markdown and JSON via CrispParse.",
3
+ "version": "1.0.4",
4
+ "description": "Local stdio Model Context Protocol (MCP) server for deterministic web extraction (Markdown, JSON, Hybrid, CSS selectors, Tier 2/3 stealth) and C2PA provenance verification via CrispParse.",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "bin": {
@@ -17,5 +17,6 @@
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/sdk": "^1.12.0"
20
- }
20
+ },
21
+ "mcpName": "io.github.goldmarklabs/crispparse-mcp"
21
22
  }
package/server.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.goldmarklabs/crispparse-mcp",
4
+ "description": "Deterministic web extraction (Markdown, JSON, CSS selectors) and C2PA v2.4 verification.",
5
+ "repository": {
6
+ "url": "https://github.com/goldmarklabs/crispparse-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "1.0.4",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "crispparse-mcp",
14
+ "version": "1.0.4",
15
+ "transport": {
16
+ "type": "stdio"
17
+ },
18
+ "environmentVariables": [
19
+ {
20
+ "name": "CRISPPARSE_API_KEY",
21
+ "description": "Optional CrispParse Macaroon API key (auto-claims a 50-credit free trial if omitted).",
22
+ "isRequired": false,
23
+ "isSecret": true
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }