differino-mcp 0.1.0 → 0.4.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.
package/.next/trace ADDED
@@ -0,0 +1 @@
1
+ [{"name":"generate-buildid","duration":115,"timestamp":148958595929,"id":4,"parentId":1,"tags":{},"startTime":1774429523967,"traceId":"be39ecf3904fcb99"},{"name":"load-custom-routes","duration":119,"timestamp":148958596120,"id":5,"parentId":1,"tags":{},"startTime":1774429523967,"traceId":"be39ecf3904fcb99"},{"name":"next-build","duration":82517,"timestamp":148958517288,"id":1,"tags":{"buildMode":"default","isTurboBuild":"false","version":"14.1.0","isTurbopack":false},"startTime":1774429523888,"traceId":"be39ecf3904fcb99"}]
package/README.md CHANGED
@@ -1,41 +1,20 @@
1
1
  # differino-mcp
2
2
 
3
- MCP (Model Context Protocol) server for [Differino](https://differino.com) -- compare PDF, DOCX, and TXT documents from any AI agent.
3
+ MCP (Model Context Protocol) server for [Differino](https://www.differino.com) -- compare PDF, DOCX, and TXT documents from any AI agent.
4
4
 
5
5
  ## Setup
6
6
 
7
7
  ### 1. Install
8
8
 
9
9
  ```bash
10
- cd mcp
11
- npm install
12
- npm run build
10
+ pnpm add -g differino-mcp
13
11
  ```
14
12
 
15
- Or install globally:
13
+ ### 2. Get an API Key
16
14
 
17
- ```bash
18
- npm install -g differino-mcp
19
- ```
20
-
21
- ### 2. Configure
22
-
23
- Set environment variables:
24
-
25
- ```bash
26
- export DIFFERINO_EMAIL="your@email.com"
27
- export DIFFERINO_PASSWORD="your-password"
28
- export SUPABASE_URL="https://your-project.supabase.co"
29
- export SUPABASE_ANON_KEY="your-anon-key"
30
- ```
31
-
32
- | Variable | Required | Description |
33
- |----------|----------|-------------|
34
- | `DIFFERINO_EMAIL` | Yes | Your Differino account email |
35
- | `DIFFERINO_PASSWORD` | Yes | Your Differino account password |
36
- | `SUPABASE_URL` | Yes | Supabase project URL (also accepts `DIFFERINO_SUPABASE_URL`) |
37
- | `SUPABASE_ANON_KEY` | Yes | Supabase anon/public key (also accepts `DIFFERINO_SUPABASE_ANON_KEY`) |
38
- | `DIFFERINO_URL` | No | Base URL for the web app (default: `https://differino.com`) |
15
+ 1. Sign up at [differino.com](https://www.differino.com/signup)
16
+ 2. Go to **Settings → API Key**
17
+ 3. Click **Generate Key** and copy it
39
18
 
40
19
  ### 3. Add to Claude Desktop
41
20
 
@@ -45,68 +24,207 @@ Add to your `claude_desktop_config.json`:
45
24
  {
46
25
  "mcpServers": {
47
26
  "differino": {
48
- "command": "node",
49
- "args": ["/path/to/comparadocs/mcp/dist/index.js"],
27
+ "command": "pnpm",
28
+ "args": ["dlx", "differino-mcp"],
50
29
  "env": {
51
- "DIFFERINO_EMAIL": "your@email.com",
52
- "DIFFERINO_PASSWORD": "your-password",
53
- "SUPABASE_URL": "https://your-project.supabase.co",
54
- "SUPABASE_ANON_KEY": "your-anon-key"
30
+ "DIFFERINO_API_KEY": "dfn_your_api_key_here"
55
31
  }
56
32
  }
57
33
  }
58
34
  }
59
35
  ```
60
36
 
61
- Or if installed globally via npm:
37
+ ### Local development
62
38
 
63
- ```json
64
- {
65
- "mcpServers": {
66
- "differino": {
67
- "command": "npx",
68
- "args": ["differino-mcp"],
69
- "env": {
70
- "DIFFERINO_EMAIL": "your@email.com",
71
- "DIFFERINO_PASSWORD": "your-password",
72
- "SUPABASE_URL": "https://your-project.supabase.co",
73
- "SUPABASE_ANON_KEY": "your-anon-key"
74
- }
75
- }
76
- }
77
- }
39
+ From the repository root:
40
+
41
+ ```bash
42
+ pnpm install
43
+ pnpm --dir mcp build
78
44
  ```
79
45
 
46
+ | Variable | Required | Description |
47
+ |----------|----------|-------------|
48
+ | `DIFFERINO_API_KEY` | Yes | Your API key -- generate at Settings → API Key |
49
+ | `DIFFERINO_URL` | No | Base URL (default: `https://www.differino.com`) |
50
+
80
51
  ## Tools
81
52
 
82
53
  ### compare_documents
83
54
 
84
- Compare two local files and get a diff summary.
55
+ Compare two local files and get a diff summary plus the visual document-review manifest when available. This is the only tool that consumes a comparison (your free comparison or 1 credit).
85
56
 
86
57
  **Parameters:**
87
58
  - `file_a_path` (required) -- Absolute path to the original document
88
59
  - `file_b_path` (required) -- Absolute path to the modified document
89
- - `accuracy_mode` (optional) -- `fast`, `balanced` (default), or `thorough`
60
+ - `comparison_mode` (optional) -- `visual` for full document review, or `text` for fast text-only comparison (default: `visual`)
61
+
62
+ The tool uploads both files, waits for extraction and comparison, and returns a summary with added/removed/modified block counts plus a link to the full comparison. If the server is still working when the internal wait expires, the response has `status: "processing"`; poll `get_comparison` with the returned `id` until `status` is `ready`.
63
+
64
+ Responses include visual artifact metadata when available:
90
65
 
91
- The tool uploads both files, waits for text extraction and diff computation, and returns a summary with added/removed/modified block counts plus a link to the full visual comparison.
66
+ - `comparisonMode`: `visual` or `text`
67
+ - `visual.status`: `ready`, `pending`, `missing`, or `disabled`
68
+ - `visual.manifest`: the document-review contract when `visual.status` is `ready`
69
+ - `pages[]`: side-by-side page pairs with image URLs and dimensions
70
+ - `pages[].regions[]`: red/green-ready change regions with `leftBox`, `rightBox`, snippets, change type, salience metadata, and a stable `groupId`
71
+ - `regions[].groupId`: shared identity for paired change fragments, including changes that cross page boundaries
72
+ - `regions[].salience`: `subtle`, `visible`, `structural`, or `technical`, plus `salienceReason` when available
73
+ - `totalChanges` and `changedPageCount`: summary fields for compact controls and optional review navigation; paired fragments with the same `groupId` count as one change
74
+ - `visual.diffUrl`: signed URL for the visual diff JSON when available
92
75
 
93
- Files under 4 MB are uploaded directly. Larger files use a signed-URL flow that bypasses Vercel's body size limit.
76
+ Agents should treat `visual.manifest` as the primary surface for professional document review: render the two documents continuously, draw exact inline highlights when coordinates are present, use `groupId` for selection and synchronized scrolling, and derive center-gutter/minimap markers from the region coordinates. If `visual.status` is not `ready`, agents should use the text diff summary and comparison URL instead of assuming there are no visual changes.
77
+
78
+ Example:
79
+
80
+ ```json
81
+ {
82
+ "name": "compare_documents",
83
+ "arguments": {
84
+ "file_a_path": "/docs/contract_v1.pdf",
85
+ "file_b_path": "/docs/contract_v2.pdf",
86
+ "comparison_mode": "visual"
87
+ }
88
+ }
89
+ ```
94
90
 
95
91
  ### get_comparison
96
92
 
97
- Check the status and results of a comparison by its UUID.
93
+ Check the status and results of a comparison by its UUID. Returns the same visual artifact contract as `compare_documents`, with fresh signed URLs. Use it to poll comparisons that returned `status: "processing"`. Free (does not consume credits).
94
+
95
+ **Parameters:**
96
+ - `comparison_id` (required) -- The comparison UUID
98
97
 
99
98
  ### list_comparisons
100
99
 
101
- List recent comparisons in your workspace (default: 10).
100
+ List recent comparisons in your workspace, newest first. Returns `id`, `status`, `comparisonMode`, `file_a`/`file_b` name and type, `summary` counters, `created_at`, and `completed_at` for each comparison. Useful to recover a comparison id or check recent activity. Free.
101
+
102
+ **Parameters:**
103
+ - `limit` (optional) -- Maximum results, 1 to 50 (default: 10)
104
+ - `status` (optional) -- Filter by `pending`, `processing`, `ready`, or `failed`
105
+
106
+ Example:
107
+
108
+ ```json
109
+ {
110
+ "name": "list_comparisons",
111
+ "arguments": { "limit": 5, "status": "ready" }
112
+ }
113
+ ```
114
+
115
+ ### export_comparison_pdf
116
+
117
+ Export a finished comparison as a PDF report and get a temporary download URL (valid for about 5 minutes). With `wait: true` (default) the tool polls the export job every 2 seconds for up to 3 minutes and returns the `downloadUrl`. Free workspaces get a watermarked PDF; workspaces with credits export without watermark. Free (exports do not consume credits).
118
+
119
+ **Parameters:**
120
+ - `comparison_id` (required) -- The comparison UUID (must have `status: "ready"`)
121
+ - `include_unchanged` (optional) -- Include unchanged content in the report (default: `false`)
122
+ - `locale` (optional) -- Report language: `en`, `es`, `zh`, `fr`, `de`, or `hi` (default: `en`)
123
+ - `wait` (optional) -- Poll until the export completes (default: `true`)
124
+
125
+ Example:
126
+
127
+ ```json
128
+ {
129
+ "name": "export_comparison_pdf",
130
+ "arguments": {
131
+ "comparison_id": "8f14e45f-...",
132
+ "locale": "es",
133
+ "include_unchanged": false
134
+ }
135
+ }
136
+ ```
137
+
138
+ ### summarize_visual_diff
139
+
140
+ Compact, page-by-page summary of the visual diff: one entry per change group (fragments that share a `groupId` are deduplicated), with change type, title, salience, and optional text snippets. No image URLs and no pixel coordinates, so it is the cheapest way for an agent to understand what changed and where. Requires a visual comparison with `visual.status: "ready"`. Free.
141
+
142
+ **Parameters:**
143
+ - `comparison_id` (required) -- The comparison UUID
144
+ - `min_salience` (optional) -- Only include changes at or above this prominence level; order is `technical` < `subtle` < `visible` < `structural`
145
+ - `include_snippets` (optional) -- Include `snippetA`/`snippetB` excerpts (default: `true`)
146
+ - `max_changes_per_page` (optional) -- Cap per page, extra changes are counted as omitted (default: 20)
147
+
148
+ Example:
149
+
150
+ ```json
151
+ {
152
+ "name": "summarize_visual_diff",
153
+ "arguments": {
154
+ "comparison_id": "8f14e45f-...",
155
+ "min_salience": "visible",
156
+ "max_changes_per_page": 10
157
+ }
158
+ }
159
+ ```
160
+
161
+ ### get_text_diff
162
+
163
+ Fetch the block-level text diff of a finished comparison. Returns the diff summary counters plus the diff blocks: `added` and `removed` blocks carry the affected text, `modified` blocks also carry word-level `spans` marking exactly which words changed. By default only changed blocks are returned. Best when you need to quote exact text changes. Free.
164
+
165
+ **Parameters:**
166
+ - `comparison_id` (required) -- The comparison UUID (must have `status: "ready"`)
167
+ - `only_changed` (optional) -- Skip `equal` blocks (default: `true`)
168
+ - `max_blocks` (optional) -- Maximum blocks returned (default: 100)
169
+
170
+ Example:
171
+
172
+ ```json
173
+ {
174
+ "name": "get_text_diff",
175
+ "arguments": { "comparison_id": "8f14e45f-...", "max_blocks": 50 }
176
+ }
177
+ ```
178
+
179
+ ## REST API
180
+
181
+ The MCP server uses the Differino REST API under the hood. You can also call it directly:
182
+
183
+ ```bash
184
+ # Compare two files
185
+ curl -X POST https://www.differino.com/api/v1/compare \
186
+ -H "Authorization: Bearer dfn_your_api_key" \
187
+ -F "file_a=@original.pdf" \
188
+ -F "file_b=@modified.pdf" \
189
+ -F "comparison_mode=visual" \
190
+ -F "accuracy_mode=balanced"
191
+
192
+ # Check comparison status
193
+ curl https://www.differino.com/api/v1/comparisons/{id} \
194
+ -H "Authorization: Bearer dfn_your_api_key"
195
+
196
+ # List recent comparisons
197
+ curl "https://www.differino.com/api/v1/comparisons?limit=10&status=ready" \
198
+ -H "Authorization: Bearer dfn_your_api_key"
199
+
200
+ # Export a comparison as PDF, then poll for the download URL
201
+ curl -X POST https://www.differino.com/api/v1/comparisons/{id}/export \
202
+ -H "Authorization: Bearer dfn_your_api_key" \
203
+ -H "Content-Type: application/json" \
204
+ -d '{"format": "pdf", "includeUnchanged": false, "locale": "en"}'
205
+
206
+ curl "https://www.differino.com/api/v1/comparisons/{id}/export?jobId={jobId}" \
207
+ -H "Authorization: Bearer dfn_your_api_key"
208
+ ```
209
+
210
+ ### accuracy_mode
211
+
212
+ `POST /api/v1/compare` accepts an optional `accuracy_mode` form field:
102
213
 
103
- ### list_documents
214
+ - `fast` -- quickest results, best for plain text and simple layouts (default for `comparison_mode=text`)
215
+ - `balanced` -- good accuracy/speed trade-off (default for `comparison_mode=visual`)
216
+ - `thorough` -- maximum accuracy for complex layouts, slower
104
217
 
105
- List documents in your Differino library (default: 20).
218
+ ### Error codes
106
219
 
107
- ### get_credits
220
+ | HTTP | `code` | Meaning |
221
+ |------|--------|---------|
222
+ | 400 | | Invalid request: missing files, unsupported file type, file too large, or invalid parameters |
223
+ | 401 | | Missing or invalid API key |
224
+ | 402 | `NO_CREDITS` | No free comparison left and no credits remaining; buy a pack at [differino.com/pricing](https://www.differino.com/pricing) |
225
+ | 404 | | Comparison or export job not found in your workspace |
108
226
 
109
- Check your credit balance, current plan, and free comparison usage for the month.
227
+ When present, the `code` field is machine-readable; the MCP server prefixes it to error messages (for example `[NO_CREDITS] No credits remaining...`).
110
228
 
111
229
  ## Supported Formats
112
230
 
@@ -116,5 +234,5 @@ Check your credit balance, current plan, and free comparison usage for the month
116
234
 
117
235
  ## Credits
118
236
 
119
- 3 free comparisons per month. After that, each comparison costs 1 credit.
120
- Buy credit packs at [differino.com/pricing](https://differino.com/pricing).
237
+ Every account gets 1 free comparison (lifetime, not monthly). After that, each comparison costs 1 credit. Checking results, listing comparisons, exporting PDFs, and reading diffs are always free.
238
+ Buy credit packs at [differino.com/pricing](https://www.differino.com/pricing).