@kolmopdf/mcp-server 1.0.0 → 1.0.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 (66) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +37 -63
  3. package/dist/index.cjs.map +1 -0
  4. package/{packages/mcp-server/dist → dist}/index.js +0 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +58 -30
  7. package/.claude-plugin/marketplace.json +0 -25
  8. package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -75
  9. package/.github/workflows/ci.yml +0 -98
  10. package/.github/workflows/release.yml +0 -52
  11. package/CHANGELOG.md +0 -12
  12. package/biome.json +0 -33
  13. package/codex-skill/kolmopdf/SKILL.md +0 -108
  14. package/codex-skill/kolmopdf/references/chain-recipes.md +0 -35
  15. package/codex-skill/kolmopdf/references/parameter-glossary.md +0 -72
  16. package/doc/apidocs/Format_Conversion_API_Guide.md +0 -117
  17. package/doc/apidocs/PDF_Layout_Translation_API_Guide.md +0 -138
  18. package/doc/apidocs/PDF_Parsing_API_Guide.md +0 -364
  19. package/doc/plan/DEVELOPMENT.md +0 -896
  20. package/doc/plan/DISTRIBUTION.md +0 -377
  21. package/doc/plan/TESTING_AND_USAGE.md +0 -370
  22. package/packages/mcp-server/LICENSE +0 -21
  23. package/packages/mcp-server/README.md +0 -37
  24. package/packages/mcp-server/dist/index.cjs.map +0 -1
  25. package/packages/mcp-server/dist/index.js.map +0 -1
  26. package/packages/mcp-server/package.json +0 -54
  27. package/packages/mcp-server/src/client.ts +0 -235
  28. package/packages/mcp-server/src/config.ts +0 -62
  29. package/packages/mcp-server/src/context.ts +0 -27
  30. package/packages/mcp-server/src/errors.ts +0 -271
  31. package/packages/mcp-server/src/extract.ts +0 -102
  32. package/packages/mcp-server/src/index.ts +0 -142
  33. package/packages/mcp-server/src/pages.ts +0 -16
  34. package/packages/mcp-server/src/polling.ts +0 -84
  35. package/packages/mcp-server/src/progress.ts +0 -48
  36. package/packages/mcp-server/src/tools/check-balance.ts +0 -33
  37. package/packages/mcp-server/src/tools/convert.ts +0 -130
  38. package/packages/mcp-server/src/tools/estimate-cost.ts +0 -82
  39. package/packages/mcp-server/src/tools/get-task-status.ts +0 -24
  40. package/packages/mcp-server/src/tools/parse-pdf.ts +0 -147
  41. package/packages/mcp-server/src/tools/translate-pdf.ts +0 -110
  42. package/packages/mcp-server/tests/integration/smoke.test.ts +0 -33
  43. package/packages/mcp-server/tests/unit/config.test.ts +0 -49
  44. package/packages/mcp-server/tests/unit/convert.test.ts +0 -28
  45. package/packages/mcp-server/tests/unit/errors.test.ts +0 -112
  46. package/packages/mcp-server/tests/unit/estimate-cost.test.ts +0 -28
  47. package/packages/mcp-server/tests/unit/polling.test.ts +0 -24
  48. package/packages/mcp-server/tsconfig.json +0 -9
  49. package/packages/mcp-server/tsup.config.ts +0 -13
  50. package/packages/mcp-server/vitest.config.ts +0 -13
  51. package/plugins/kolmopdf/.claude-plugin/plugin.json +0 -16
  52. package/plugins/kolmopdf/.mcp.json +0 -11
  53. package/plugins/kolmopdf/README.md +0 -28
  54. package/plugins/kolmopdf/commands/balance.md +0 -6
  55. package/plugins/kolmopdf/commands/convert.md +0 -14
  56. package/plugins/kolmopdf/commands/parse.md +0 -14
  57. package/plugins/kolmopdf/commands/translate.md +0 -14
  58. package/plugins/kolmopdf/skills/kolmopdf/SKILL.md +0 -108
  59. package/plugins/kolmopdf/skills/kolmopdf/references/chain-recipes.md +0 -35
  60. package/plugins/kolmopdf/skills/kolmopdf/references/parameter-glossary.md +0 -72
  61. package/pnpm-workspace.yaml +0 -2
  62. package/smithery.yaml +0 -21
  63. package/tsconfig.base.json +0 -21
  64. /package/{packages/mcp-server/dist → dist}/index.cjs +0 -0
  65. /package/{packages/mcp-server/dist → dist}/index.d.cts +0 -0
  66. /package/{packages/mcp-server/dist → dist}/index.d.ts +0 -0
@@ -1,138 +0,0 @@
1
- # PDF Layout Translation API Guide
2
-
3
- ## Basic Information
4
-
5
- ### Base URL
6
-
7
- Use the following base URL for all API requests:
8
-
9
- `https://www.kolmopdf.com`
10
-
11
- ### General Notes
12
-
13
- 1. **Async workflow:** Upload the PDF first, poll task status, then download the translated PDF.
14
- 2. **Data retention:** Download results as soon as possible. Result files are retained for 7 days.
15
- 3. **File limits:**
16
- - Maximum file size: **300 MB**
17
- - Maximum page count per PDF: **800 pages**
18
- 4. **Points:** PDF layout translation costs **2 points/page**.
19
- 5. **Concurrency:** Each API Key can process up to **3 tasks concurrently**. Extra tasks are queued automatically.
20
-
21
- ---
22
-
23
- ## Authentication
24
-
25
- Send your API Key in one of these ways:
26
-
27
- | Method | Example |
28
- | :--- | :--- |
29
- | URL parameter | `?api_key=sk-xxx` |
30
- | Header | `X-API-Key: sk-xxx` |
31
- | Authorization | `Authorization: Bearer sk-xxx` |
32
-
33
- ---
34
-
35
- ## Async Processing Flow
36
-
37
- **upload and translate** -> **poll status** -> **download result**
38
-
39
- ### 1. Upload and Translate
40
-
41
- **POST /api/pdf-to-markdown-proxy/translate-pdf**
42
-
43
- #### Request Parameters
44
-
45
- | Name | Location | Type | Required | Description |
46
- | :--- | :--- | :--- | :--- | :--- |
47
- | `file` | FormData | `file` | Yes | PDF file in binary format. |
48
- | `sourceLanguage` / `source_language` | FormData | `string` | No | Source language. Default: `en`. |
49
- | `targetLanguage` / `target_language` | FormData | `string` | No | Target language. Default: `zh`. |
50
- | `layoutModes` / `output_modes` / `outputModes` | FormData | `string` | No | Output mode list. Supported: `translated_only`, `side_by_side`. Comma-separated string or JSON array. |
51
- | `enable_image_translation` / `enableImageTranslation` | FormData | `string` | No | Whether to translate image text. `true` or `false`. |
52
- | `enable_table_translation` / `enableTableTranslation` | FormData | `string` | No | Whether to translate tables. `true` or `false`. |
53
-
54
- #### Request Example
55
-
56
- ```bash
57
- curl -X POST 'https://www.kolmopdf.com/api/pdf-to-markdown-proxy/translate-pdf?api_key=sk-xxx' \
58
- -F "file=@document.pdf" \
59
- -F "sourceLanguage=en" \
60
- -F "targetLanguage=zh" \
61
- -F "layoutModes=translated_only"
62
- ```
63
-
64
- #### Success Example: Processing Started
65
-
66
- ```json
67
- {
68
- "success": true,
69
- "task_id": "12345",
70
- "status": "processing",
71
- "message": "PDF layout-preserving translation task started",
72
- "points_deducted": 20,
73
- "remaining_points": 80
74
- }
75
- ```
76
-
77
- #### Success Example: Waiting in Queue
78
-
79
- ```json
80
- {
81
- "success": true,
82
- "task_id": "12345",
83
- "status": "waiting",
84
- "message": "Task queued and waiting for processing",
85
- "points_deducted": 20,
86
- "remaining_points": 80,
87
- "queue_info": {
88
- "position": 1,
89
- "ahead_tasks": 3
90
- }
91
- }
92
- ```
93
-
94
- ---
95
-
96
- ### 2. Query Task Status
97
-
98
- **GET /api/pdf-to-markdown-proxy/status/{task_id}**
99
-
100
- ```bash
101
- curl "https://www.kolmopdf.com/api/pdf-to-markdown-proxy/status/12345?api_key=sk-xxx"
102
- ```
103
-
104
- #### Completed
105
-
106
- ```json
107
- {
108
- "success": true,
109
- "status": "completed",
110
- "message": "Processing completed",
111
- "result": {
112
- "task_id": "12345",
113
- "download_url": "/api/pdf-to-markdown-proxy/download/12345"
114
- }
115
- }
116
- ```
117
-
118
- ---
119
-
120
- ### 3. Download Result
121
-
122
- **GET /api/pdf-to-markdown-proxy/download/{task_id}**
123
-
124
- ```bash
125
- curl -L "https://www.kolmopdf.com/api/pdf-to-markdown-proxy/download/12345?api_key=sk-xxx" \
126
- -o translated.pdf
127
- ```
128
-
129
- ---
130
-
131
- ### 4. Query Balance
132
-
133
- **GET /api/pdf-to-markdown-proxy/balance**
134
-
135
- ```bash
136
- curl "https://www.kolmopdf.com/api/pdf-to-markdown-proxy/balance?api_key=sk-xxx"
137
- ```
138
-
@@ -1,364 +0,0 @@
1
- # PDF Parsing API Guide
2
-
3
- ## Basic Information
4
-
5
- ### Base URL
6
-
7
- Use the following base URL for all API requests:
8
-
9
- `https://www.kolmopdf.com`
10
-
11
- ### General Notes
12
-
13
- 1. **Network access:** Connect to the API directly. Outside mainland China, temporary network instability may interrupt uploads.
14
- 2. **Data retention:** After you receive the result from the status endpoint, download it as soon as possible. Result files are kept on the server for 7 days only.
15
- - **Image URL retention:** When `images_as_url=true` is enabled, generated image URLs are cached for **30 days** and will be cleaned up after expiration.
16
- 3. **File limits:**
17
- - Maximum file size: **300 MB**
18
- - Maximum page count per PDF: **800 pages**
19
-
20
- ---
21
-
22
- ## Authentication
23
-
24
- ### Getting an API Key
25
-
26
- You can now apply for and manage API keys directly on the KolmoPDF website from the [PDF Parsing API](/api-keys) page.
27
-
28
- 1. **Advanced plan members:** May create 1 API key. API usage consumes the same point balance as the web account.
29
- 2. **Team plan members:** May create up to 10 API keys. Each key can have its own usage limit, which makes it easier to allocate quotas to subprojects or partners.
30
-
31
- **Point limit logic**
32
-
33
- The actual usable balance for a key is the lower of:
34
-
35
- - your account's remaining total balance
36
- - the remaining limit configured for that key
37
-
38
- ### Request Headers
39
-
40
- Include either a Bearer token in the `Authorization` header or send the key with `X-API-Key`.
41
-
42
- | Name | Example | Description |
43
- | :--- | :--- | :--- |
44
- | `Authorization` | `Bearer sk-xxx` | Replace `sk-xxx` with your real API key. |
45
- | `X-API-Key` | `sk-xxx` | Replace `sk-xxx` with your real API key. |
46
-
47
- You can also pass the key as a URL parameter:
48
-
49
- | Parameter | Example | Description |
50
- | :--- | :--- | :--- |
51
- | `api_key` | `sk-xxx` | Replace `sk-xxx` with your real API key. |
52
-
53
- ---
54
-
55
- ## Async Processing Flow
56
-
57
- KolmoPDF uses a three-step async workflow:
58
-
59
- **upload and parse** -> **poll status** -> **download result**
60
-
61
- ### 1. Upload and Parse
62
-
63
- **POST /api/pdf-to-markdown-proxy/parse**
64
-
65
- Upload a PDF file and create a parsing task.
66
-
67
- #### Request Parameters
68
-
69
- | Name | Location | Type | Required | Description |
70
- | :--- | :--- | :--- | :--- | :--- |
71
- | `file` | FormData | `file` | Yes | PDF file in binary format. |
72
- | `table_mode` | FormData | `string` | No | Table output mode. `markdown` converts tables into Markdown tables. `image` keeps them as images. Default: `markdown`. |
73
- | `formula_format` | FormData | `string` | No | Math delimiter mode. `dollar` keeps `$...$` and `$$...$$`. `bracket` converts them to `\\(...\\)` and `\\[...\\]`. Default: `dollar`. Escaped `\\$` is ignored. |
74
- | `enable_translation` | FormData | `string` | No | Whether translation is enabled. `true` or `false`. Default: `false`. |
75
- | `images_as_url` | FormData | `string` | No | Whether image references should be returned as public URLs. `true` or `false`. Default: `false`. When `true`, the final output is a Markdown file instead of a ZIP archive. |
76
- | `target_language` | FormData | `string` | No | Target language code. Only valid when `enable_translation=true`. Supported: `zh`, `en`, `ja`, `ko`, `fr`, `de`, `es`, `ru`. Default: `zh`. |
77
- | `output_options` | FormData | `string` | No | Translation output mode. Available: `original`, `translated`, `bilingual`. Multiple values can be joined with commas. Default: `original`. |
78
- | `skip_rotation_detection` | FormData | `string` | No | Skip auto-rotation detection. `true` or `false`. Default: `false`. |
79
- | `enable_cross_page_merge` | FormData | `string` | No | Enable smart cross-page table merging for up to three consecutive pages. `true` or `false`. Default: `false`. |
80
-
81
- #### Request Examples
82
-
83
- **Windows (CMD / PowerShell):**
84
-
85
- ```cmd
86
- curl -X POST "https://www.kolmopdf.com/api/pdf-to-markdown-proxy/parse?api_key=sk-xxx" ^
87
- -F "file=@document.pdf" ^
88
- -F "table_mode=markdown" ^
89
- -F "formula_format=dollar" ^
90
- -F "enable_translation=false" ^
91
- -F "skip_rotation_detection=false" ^
92
- -F "enable_cross_page_merge=true"
93
- ```
94
-
95
- **Linux / macOS:**
96
-
97
- ```bash
98
- curl -X POST 'https://www.kolmopdf.com/api/pdf-to-markdown-proxy/parse?api_key=sk-xxx' \
99
- -F "file=@document.pdf" \
100
- -F "table_mode=markdown" \
101
- -F "formula_format=dollar" \
102
- -F "enable_translation=false" \
103
- -F "skip_rotation_detection=false" \
104
- -F "enable_cross_page_merge=true"
105
- ```
106
-
107
- #### Success Example: Processing Started
108
-
109
- ```json
110
- {
111
- "success": true,
112
- "task_id": "12345",
113
- "status": "processing",
114
- "message": "Task created successfully",
115
- "points_deducted": 20,
116
- "remaining_points": 80
117
- }
118
- ```
119
-
120
- #### Success Example: Waiting in Queue
121
-
122
- ```json
123
- {
124
- "success": true,
125
- "task_id": "12345",
126
- "status": "waiting",
127
- "message": "Task queued and waiting for processing",
128
- "points_deducted": 20,
129
- "remaining_points": 80,
130
- "queue_info": {
131
- "position": 1,
132
- "ahead_tasks": 3
133
- }
134
- }
135
- ```
136
-
137
- #### Failure Example: Insufficient Points
138
-
139
- ```json
140
- {
141
- "success": false,
142
- "message": "Insufficient points",
143
- "error_code": "insufficient_points",
144
- "points_required": 20,
145
- "current_points": 15
146
- }
147
- ```
148
-
149
- #### Failure Example: Invalid File Type
150
-
151
- ```json
152
- {
153
- "success": false,
154
- "message": "File is not a PDF file",
155
- "error_code": "parse_file_not_pdf"
156
- }
157
- ```
158
-
159
- #### Failure Example: File Too Large
160
-
161
- ```json
162
- {
163
- "success": false,
164
- "message": "File size exceeds limit (300MB)",
165
- "error_code": "parse_file_too_large",
166
- "file_size": 314572800,
167
- "max_size": 314572800
168
- }
169
- ```
170
-
171
- #### Failure Example: Page Limit Exceeded
172
-
173
- ```json
174
- {
175
- "success": false,
176
- "message": "Page count exceeds limit (800 pages)",
177
- "error_code": "parse_page_limit_exceeded",
178
- "page_count": 1000,
179
- "max_pages": 800
180
- }
181
- ```
182
-
183
- #### Point Consumption Rules
184
-
185
- | Service | Cost |
186
- | :--- | :--- |
187
- | Parsing only | 2 points per page |
188
- | Parsing + translation | 3 points per page |
189
-
190
- ---
191
-
192
- ### 2. Check Task Status
193
-
194
- **GET /api/pdf-to-markdown-proxy/status/{task_id}**
195
-
196
- Poll the task status. A polling interval of 1 to 3 seconds is recommended.
197
-
198
- #### Success Example
199
-
200
- ```json
201
- {
202
- "success": true,
203
- "status": "completed",
204
- "message": "Processing completed",
205
- "result": {
206
- "task_id": "01920000-0000-0000-0000-000000000000",
207
- "download_url": "/api/pdf-to-markdown-proxy/download/01920000-0000-0000-0000-000000000000"
208
- }
209
- }
210
- ```
211
-
212
- #### Processing Example
213
-
214
- ```json
215
- {
216
- "success": true,
217
- "status": "processing",
218
- "message": "Processing"
219
- }
220
- ```
221
-
222
- #### Waiting Example
223
-
224
- ```json
225
- {
226
- "success": true,
227
- "status": "waiting",
228
- "message": "Waiting in queue (3 tasks ahead)",
229
- "queue_info": {
230
- "position": 1,
231
- "ahead_tasks": 3
232
- }
233
- }
234
- ```
235
-
236
- #### Failure Example
237
-
238
- ```json
239
- {
240
- "success": false,
241
- "status": "failed",
242
- "message": "Parsing error",
243
- "error_code": "parse_error"
244
- }
245
- ```
246
-
247
- If a task fails after it was created successfully, deducted points are automatically refunded.
248
-
249
- ---
250
-
251
- ### 3. Download Result
252
-
253
- **GET /api/pdf-to-markdown-proxy/download/{task_id}**
254
-
255
- Download the finished result file.
256
-
257
- By default, successful requests return a ZIP archive containing the Markdown file and related assets. If the original parse request used `images_as_url=true`, this endpoint returns a Markdown file instead, and image references point to public URLs.
258
-
259
- ---
260
-
261
- ## Check Point Balance
262
-
263
- **GET /api/pdf-to-markdown-proxy/balance**
264
-
265
- Returns the current point balance for the API key.
266
-
267
- #### Success Example
268
-
269
- ```json
270
- {
271
- "success": true,
272
- "points": 98,
273
- "api_key": "sk-xxxx..."
274
- }
275
- ```
276
-
277
- #### Invalid Key Example
278
-
279
- ```json
280
- {
281
- "success": false,
282
- "message": "Invalid API key"
283
- }
284
- ```
285
-
286
- ---
287
-
288
- ## Error Codes
289
-
290
- ### HTTP Status Codes
291
-
292
- | Status | Meaning | Description |
293
- | :--- | :--- | :--- |
294
- | `401` | Unauthorized | API key is missing or invalid. |
295
- | `402` | Insufficient points | Not enough balance to complete the operation. |
296
- | `429` | Rate limit / queue limit | Too many active tasks are already running for this key. |
297
- | `500` | Server error | Internal server error. See the response body for details. |
298
-
299
- ### Business Error Codes
300
-
301
- | Error Code | Meaning | Suggested Action | Points Deducted |
302
- | :--- | :--- | :--- | :--- |
303
- | `invalid_api_key` | API key is invalid or does not exist. | Check the key and try again. | No |
304
- | `insufficient_points` | Not enough available points. | Add more points to the account. | No |
305
- | `no_file_found` | No file was included in the request. | Make sure FormData contains the `file` field. | No |
306
- | `parse_file_too_large` | File size exceeds the limit. | Split the PDF into smaller parts. | No |
307
- | `parse_page_limit_exceeded` | PDF page count exceeds the limit. | Split the PDF into smaller parts. | No |
308
- | `parse_file_not_pdf` | Uploaded file is not a PDF. | Upload a valid `.pdf` file. | No |
309
- | `file_upload_failed` | Upload to storage failed. | Check the network and retry. | No |
310
- | `points_deduction_failed` | Point deduction failed. | Contact support. | No |
311
- | `task_creation_failed` | Task creation failed. | Contact support. Refunded automatically if needed. | Refunded |
312
- | `parse_error` | Parsing failed. | Retry later. If the issue persists, contact support. | Refunded |
313
- | `parse_file_invalid` | The PDF is malformed or invalid. | Try a different export or re-save the PDF. | Refunded |
314
- | `parse_timeout` | Processing timed out. | Split the PDF and try again. | Refunded |
315
-
316
- ---
317
-
318
- ## Parameter Notes
319
-
320
- ### `table_mode`
321
-
322
- | Value | Meaning |
323
- | :--- | :--- |
324
- | `markdown` | Convert tables into editable Markdown tables. |
325
- | `image` | Keep tables as images to preserve layout. |
326
-
327
- ### `target_language`
328
-
329
- Supported language codes:
330
-
331
- | Code | Language |
332
- | :--- | :--- |
333
- | `zh` | Chinese |
334
- | `en` | English |
335
- | `ja` | Japanese |
336
- | `ko` | Korean |
337
- | `fr` | French |
338
- | `de` | German |
339
- | `es` | Spanish |
340
- | `ru` | Russian |
341
-
342
- ### `output_options`
343
-
344
- | Value | Meaning |
345
- | :--- | :--- |
346
- | `original` | Output the original Markdown only. |
347
- | `translated` | Output the translated Markdown only. |
348
- | `bilingual` | Output a bilingual version with original and translation. |
349
-
350
- ### `formula_format`
351
-
352
- | Value | Meaning |
353
- | :--- | :--- |
354
- | `dollar` | Default. Keeps `$...$` for inline math and `$$...$$` for display math. |
355
- | `bracket` | Converts inline math to `\\(...\\)` and display math to `\\[...\\]`. Escaped `\\$` is left unchanged. |
356
-
357
- ---
358
-
359
- ## Recommended Workflow
360
-
361
- 1. Upload the PDF with `/parse`
362
- 2. Poll `/status/{task_id}` until the task is complete
363
- 3. Download the final file with `/download/{task_id}`
364
- 4. Save the result locally before the retention window expires