crispparse-mcp 1.0.3 → 1.0.5

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/.mcp.json ADDED
@@ -0,0 +1 @@
1
+ {"mcpServers":{"crispparse":{"command":"npx","args":["-y","crispparse-mcp"]}}}
package/README.md CHANGED
@@ -1,57 +1,77 @@
1
+ [![Listed on mcpservers.org](https://mcpservers.org/badge.svg)](https://mcpservers.org/servers/goldmarklabs/crispparse-mcp) [![CrispParse MCP on mcprush](https://mcprush.com/badge/crispparse-mcp/score.svg)](https://mcprush.com/to/crispparse-mcp?ref=badge)
2
+
1
3
  # CrispParse MCP Server
2
4
 
3
5
  [![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
6
 
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).
7
+ 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
8
 
7
9
  ## How It Works
8
10
 
9
11
  This repository implements a local MCP `stdio` server (`index.js`) using `StdioServerTransport`:
10
12
  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`.
13
+ 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.
14
+ 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
15
 
14
16
  ## Available Tools
15
17
 
16
18
  ### `crispparse_extract`
17
- Extracts clean, LLM-ready Markdown or structured JSON from any public webpage URL.
19
+ 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
20
 
19
21
  * **`url`** (`string`, required): The full `http://` or `https://` URL to extract.
20
- * **`mode`** (`string`, optional, default `"markdown"`): Output format (`"markdown"` or `"json"`).
21
-
22
- ## Installation & Local Execution
22
+ * **`mode`** (`string`, optional, default `"markdown"`): Output format (`"markdown"`, `"json"`, or `"hybrid"`).
23
+ * **`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.
24
+ * **`bypass_cache`** (`boolean`, optional, default `false`): Set `true` to bypass edge cache and force a fresh live extraction.
25
+ * **`api_key`** (`string`, optional): CrispParse Macaroon bearer token (overrides `CRISPPARSE_API_KEY`).
26
+ * **`payment_signature`** (`string`, optional): `x402` v2 `PAYMENT-SIGNATURE` Base USDC proof header (overrides `CRISPPARSE_PAYMENT_SIGNATURE`).
23
27
 
24
- ### Run with Node.js (v18+)
28
+ ### `crispparse_claim_trial`
29
+ Claims or retrieves a cached zero-config CrispParse trial Macaroon token (50 credits, 14-day TTL) for immediate extraction without manual signup.
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
+ * **`force_refresh`** (`boolean`, optional, default `false`): Request a fresh trial token instead of returning the cached token.
30
32
 
31
- ### Run with Docker
33
+ ### `crispparse_verify`
34
+ Cryptographically verifies a detached C2PA v2.4 provenance manifest returned by `crispparse_extract` against `https://api.crispparse.com/v1/verify`.
32
35
 
33
- docker build -t crispparse-mcp .
34
- docker run -i --rm -e CRISPPARSE_API_KEY="your_api_key" crispparse-mcp
36
+ * **`provenance`** (`object`, required): The `provenance` object from a CrispParse extraction response.
35
37
 
36
38
  ## MCP Client Configuration
37
39
 
40
+ ### Zero-Install via `npx` (Recommended)
38
41
  Add the server to your Claude Desktop (`claude_desktop_config.json`) or Cursor MCP configuration:
39
42
 
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
- }
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "crispparse": {
47
+ "command": "npx",
48
+ "args": ["-y", "crispparse-mcp@1.0.3"]
50
49
  }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### Run from Local Clone (Node.js v18+)
55
+
56
+ ```bash
57
+ git clone https://github.com/goldmarklabs/crispparse-mcp.git
58
+ cd crispparse-mcp
59
+ npm install
60
+ CRISPPARSE_API_KEY="your_api_key" node index.js
61
+ ```
62
+
63
+ ### Run with Docker
64
+
65
+ ```bash
66
+ docker build -t crispparse-mcp .
67
+ docker run -i --rm -e CRISPPARSE_API_KEY="your_api_key" crispparse-mcp
68
+ ```
51
69
 
52
70
  ## Environment Variables
53
71
 
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).
72
+ * `CRISPPARSE_API_KEY`: Optional Bearer Macaroon API key from [crispparse.com](https://crispparse.com).
73
+ * `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).
74
+ * `CRISPPARSE_PAYMENT_SIGNATURE`: Optional default `x402` v2 `PAYMENT-SIGNATURE` Base USDC proof header.
55
75
  * `CRISPPARSE_API_URL`: Optional upstream endpoint override (defaults to `https://api.crispparse.com/v1/extract`).
56
76
 
57
77
  ## License
@@ -0,0 +1,2 @@
1
+ # CrispParse MCP
2
+ Run `npx -y crispparse-mcp` over stdio. `CRISPPARSE_API_KEY` is optional (auto-claims 50 free credits).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crispparse-mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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",
@@ -17,5 +17,19 @@
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/sdk": "^1.12.0"
20
- }
20
+ },
21
+ "mcpName": "io.github.goldmarklabs/crispparse-mcp",
22
+ "homepage": "https://crispparse.com",
23
+ "keywords": [
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "web-scraping",
27
+ "markdown",
28
+ "rag",
29
+ "c2pa",
30
+ "x402",
31
+ "usdc",
32
+ "ai-agent",
33
+ "crispparse"
34
+ ]
21
35
  }
package/plugin.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"crispparse","description":"Deterministic web extraction and C2PA provenance verification.","version":"1.0.4","mcpServers":"./.mcp.json"}
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.5",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "crispparse-mcp",
14
+ "version": "1.0.5",
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
+ }
package/smithery.yaml ADDED
@@ -0,0 +1,15 @@
1
+ startCommand:
2
+ type: stdio
3
+ configSchema:
4
+ type: object
5
+ properties:
6
+ crispparseApiKey:
7
+ type: string
8
+ title: CrispParse API Key
9
+ description: Optional Macaroon key (auto-claims 50 free credits if omitted)
10
+ commandFunction: |-
11
+ (config) => ({
12
+ command: 'npx',
13
+ args: ['-y', 'crispparse-mcp'],
14
+ env: config.crispparseApiKey ? { CRISPPARSE_API_KEY: config.crispparseApiKey } : {}
15
+ })
@@ -1,197 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "node:fs";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
- import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
8
-
9
- const API_URL = process.env.CRISPPARSE_API_URL || "https://api.crispparse.com/v1/extract";
10
- const TRIAL_URL = process.env.CRISPPARSE_TRIAL_URL || API_URL.replace(/\/v1\/extract\/?$/, "/v1/trial/claim");
11
- const DEFAULT_API_KEY = process.env.CRISPPARSE_API_KEY || "";
12
- const DEFAULT_PAYMENT_SIGNATURE = process.env.CRISPPARSE_PAYMENT_SIGNATURE || "";
13
- const AUTO_CLAIM_TRIAL = process.env.CRISPPARSE_AUTO_CLAIM_TRIAL !== "false";
14
- const CACHE_FILE = path.join(os.homedir(), ".crispparse", "trial_token.json");
15
-
16
- function safeJson(text) {
17
- try {
18
- return JSON.parse(text);
19
- } catch {
20
- return text;
21
- }
22
- }
23
-
24
- function readCachedTrialToken() {
25
- try {
26
- const raw = fs.readFileSync(CACHE_FILE, "utf8");
27
- const parsed = JSON.parse(raw);
28
- if (parsed && typeof parsed.token === "string" && parsed.token.length > 0) {
29
- return parsed.token;
30
- }
31
- } catch {}
32
- return "";
33
- }
34
-
35
- function writeCachedTrialToken(token) {
36
- try {
37
- fs.mkdirSync(path.dirname(CACHE_FILE), { recursive: true, mode: 0o700 });
38
- fs.writeFileSync(CACHE_FILE, JSON.stringify({ token, claimed_at: new Date().toISOString() }, null, 2), { mode: 0o600 });
39
- } catch {}
40
- }
41
-
42
- function clearCachedTrialToken() {
43
- try {
44
- fs.unlinkSync(CACHE_FILE);
45
- } catch {}
46
- }
47
-
48
- async function claimTrialToken(forceRefresh = false) {
49
- if (!forceRefresh) {
50
- const cached = readCachedTrialToken();
51
- if (cached) return { token: cached, source: "cache" };
52
- }
53
- const res = await fetch(TRIAL_URL, { method: "POST" });
54
- const text = await res.text();
55
- const data = safeJson(text);
56
- if (!res.ok || !data || typeof data.macaroon_token !== "string") {
57
- throw new Error(typeof data === "object" && data?.detail ? data.detail : `Trial claim failed (${res.status}): ${text}`);
58
- }
59
- writeCachedTrialToken(data.macaroon_token);
60
- return { token: data.macaroon_token, source: "claimed", details: data };
61
- }
62
-
63
- const server = new Server(
64
- { name: "crispparse-mcp-server", version: "1.0.2" },
65
- { capabilities: { tools: {} } }
66
- );
67
-
68
- server.setRequestHandler(ListToolsRequestSchema, async () => ({
69
- tools: [
70
- {
71
- 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
- inputSchema: {
74
- type: "object",
75
- properties: {
76
- 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
- api_key: { type: "string", description: "Optional CrispParse Macaroon bearer token (overrides CRISPPARSE_API_KEY)." },
79
- payment_signature: { type: "string", description: "Optional x402 v2 PAYMENT-SIGNATURE Base USDC proof header (overrides CRISPPARSE_PAYMENT_SIGNATURE)." }
80
- },
81
- required: ["url"]
82
- }
83
- },
84
- {
85
- name: "crispparse_claim_trial",
86
- description: "Claim or retrieve a cached zero-config CrispParse trial Macaroon token (50 credits, 14-day TTL) for immediate extraction without manual signup.",
87
- inputSchema: {
88
- type: "object",
89
- properties: {
90
- force_refresh: { type: "boolean", description: "Request a fresh trial token instead of returning the cached token." }
91
- }
92
- }
93
- }
94
- ]
95
- }));
96
-
97
- server.setRequestHandler(CallToolRequestSchema, async ({ params }) => {
98
- if (params.name === "crispparse_claim_trial") {
99
- try {
100
- const result = await claimTrialToken(Boolean(params.arguments?.force_refresh));
101
- return {
102
- isError: false,
103
- content: [{ type: "text", text: JSON.stringify({ status: "ok", source: result.source, macaroon_token: result.token, cache_path: CACHE_FILE }) }]
104
- };
105
- } catch (error) {
106
- return {
107
- isError: true,
108
- content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }]
109
- };
110
- }
111
- }
112
-
113
- if (params.name !== "crispparse_extract") {
114
- return { isError: true, content: [{ type: "text", text: `Unknown tool: ${params.name}` }] };
115
- }
116
-
117
- const targetUrl = params.arguments?.url;
118
- const mode = params.arguments?.mode === "json" ? "json" : "markdown";
119
- let apiKey = (typeof params.arguments?.api_key === "string" && params.arguments.api_key) || DEFAULT_API_KEY;
120
- const paymentSignature = (typeof params.arguments?.payment_signature === "string" && params.arguments.payment_signature) || DEFAULT_PAYMENT_SIGNATURE;
121
-
122
- if (!targetUrl || typeof targetUrl !== "string") {
123
- return { isError: true, content: [{ type: "text", text: "Missing required parameter: url" }] };
124
- }
125
-
126
- let usedTrialCache = false;
127
- if (!apiKey && !paymentSignature && AUTO_CLAIM_TRIAL) {
128
- try {
129
- const trial = await claimTrialToken(false);
130
- apiKey = trial.token;
131
- usedTrialCache = true;
132
- } catch {
133
- // Fall through to unauthenticated request so the agent still receives the x402 402 payment challenge
134
- }
135
- }
136
-
137
- try {
138
- const headers = {
139
- "Content-Type": "application/json",
140
- ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
141
- ...(paymentSignature ? { "PAYMENT-SIGNATURE": paymentSignature } : {})
142
- };
143
-
144
- const response = await fetch(API_URL, {
145
- method: "POST",
146
- headers,
147
- body: JSON.stringify({ url: targetUrl, mode })
148
- });
149
-
150
- const bodyText = await response.text();
151
-
152
- if ((response.status === 401 || response.status === 402) && usedTrialCache) {
153
- clearCachedTrialToken();
154
- }
155
-
156
- if (response.status === 402) {
157
- return {
158
- isError: true,
159
- content: [
160
- {
161
- type: "text",
162
- text: JSON.stringify({
163
- status: 402,
164
- paymentRequired: response.headers.get("payment-required"),
165
- body: safeJson(bodyText)
166
- })
167
- }
168
- ]
169
- };
170
- }
171
-
172
- const paymentResponse = response.headers.get("payment-response");
173
- if (response.ok && paymentResponse) {
174
- return {
175
- isError: false,
176
- content: [
177
- {
178
- type: "text",
179
- text: JSON.stringify({
180
- paymentResponse,
181
- result: safeJson(bodyText)
182
- })
183
- }
184
- ]
185
- };
186
- }
187
-
188
- return { isError: !response.ok, content: [{ type: "text", text: bodyText }] };
189
- } catch (error) {
190
- return {
191
- isError: true,
192
- content: [{ type: "text", text: `CrispParse request failed: ${error instanceof Error ? error.message : String(error)}` }]
193
- };
194
- }
195
- });
196
-
197
- await server.connect(new StdioServerTransport());
@@ -1,21 +0,0 @@
1
- {
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.",
5
- "type": "module",
6
- "main": "index.js",
7
- "bin": {
8
- "crispparse-mcp": "./index.js"
9
- },
10
- "scripts": {
11
- "start": "node index.js"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/goldmarklabs/crispparse-mcp.git"
16
- },
17
- "license": "MIT",
18
- "dependencies": {
19
- "@modelcontextprotocol/sdk": "^1.12.0"
20
- }
21
- }