pdfops-mcp 0.3.2 → 0.3.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/README.md +28 -0
- package/dist/index.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ Beside a local agent, tools operate on file paths, so PDF bytes never transit th
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
claude mcp add pdfops -- npx -y pdfops-mcp
|
|
13
|
+
# with a key:
|
|
14
|
+
claude mcp add pdfops -e PDFOPS_API_KEY=pdfops_live_… -- npx -y pdfops-mcp
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
**Claude Desktop** (`claude_desktop_config.json`) / **Cursor** (`.cursor/mcp.json`)
|
|
@@ -26,6 +28,23 @@ claude mcp add pdfops -- npx -y pdfops-mcp
|
|
|
26
28
|
}
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
**VS Code** (`.vscode/mcp.json`, note the `servers` key and `type`)
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"servers": {
|
|
36
|
+
"pdfops": {
|
|
37
|
+
"type": "stdio",
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "pdfops-mcp"],
|
|
40
|
+
"env": { "PDFOPS_API_KEY": "pdfops_live_…" }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Any other stdio client (Windsurf, Cline, Zed, your own agent): command `npx`, args `-y pdfops-mcp`. Per-client walkthrough and a real tool-call transcript: [pdfops.dev/mcp](https://pdfops.dev/mcp).
|
|
47
|
+
|
|
29
48
|
`PDFOPS_API_KEY` is optional — without it you get the keyless trial (100 requests/IP/month). A free key (250/month, no card) takes one field at [pdfops.dev/pricing](https://pdfops.dev/pricing).
|
|
30
49
|
|
|
31
50
|
## Tools
|
|
@@ -47,6 +66,15 @@ A hosted MCP runtime executes this server on a machine where your agent's file p
|
|
|
47
66
|
|
|
48
67
|
Locally, absolute paths keep working exactly as before and remain the recommended form — bytes stay off the model context.
|
|
49
68
|
|
|
69
|
+
## Example prompts
|
|
70
|
+
|
|
71
|
+
- *"What fields does ~/forms/fw9.pdf have?"* → `pdf_inspect`
|
|
72
|
+
- *"Fill ~/forms/fw9.pdf for Ada Lovelace, 12 Analytical Way, London; save it flattened as ~/out/w9-ada.pdf"* → `pdf_inspect`, then `pdf_fill` with `flatten: true`
|
|
73
|
+
- *"Fill the onboarding form once per row of contractors.csv into ~/out/"* → one `pdf_inspect`, then `pdf_fill` per row
|
|
74
|
+
- *"Merge ~/out/w9-ada.pdf, ~/docs/nda.pdf and ~/docs/cover.pdf into one packet, cover first"* → `pdf_merge`
|
|
75
|
+
- *"Invoice Globex for 3 days of consulting at $650, 8.5% tax, due in 30 days"* → `pdf_invoice`
|
|
76
|
+
- *"How many PDFops requests do I have left this month?"* → `pdfops_usage`
|
|
77
|
+
|
|
50
78
|
## Example agent flow
|
|
51
79
|
|
|
52
80
|
> "Fill the W-9 template at ~/docs/w9.pdf for Ada Lovelace and merge it with ~/docs/cover.pdf"
|
package/dist/index.js
CHANGED
|
@@ -26,12 +26,25 @@ import { describeSource, pdfResult, resolveSource } from './source.js';
|
|
|
26
26
|
// Version comes from package.json so the string MCP clients display can no
|
|
27
27
|
// longer drift from the published one (0.2.0 shipped reporting 0.1.1).
|
|
28
28
|
const { version } = createRequire(import.meta.url)('../package.json');
|
|
29
|
+
const server = new McpServer({ name: 'pdfops', version });
|
|
30
|
+
// Source attribution: every API call carries this server's version and the
|
|
31
|
+
// MCP host app ("claude-ai/0.1.0", "cursor-vscode/1.0.0", …) taken from the
|
|
32
|
+
// initialize handshake's clientInfo. Added via a fetch wrapper rather than
|
|
33
|
+
// SDK options because clientInfo only exists after connect, and so this works
|
|
34
|
+
// against the already-published pdfops-sdk 0.4.0.
|
|
29
35
|
const client = new PdfOps({
|
|
30
36
|
apiKey: process.env.PDFOPS_API_KEY,
|
|
31
37
|
baseUrl: process.env.PDFOPS_BASE_URL,
|
|
32
38
|
clientTag: 'mcp',
|
|
39
|
+
fetch: (input, init) => {
|
|
40
|
+
const headers = new Headers(init?.headers);
|
|
41
|
+
headers.set('X-Pdfops-Client-Version', version);
|
|
42
|
+
const host = server.server.getClientVersion();
|
|
43
|
+
if (host)
|
|
44
|
+
headers.set('X-Pdfops-Client-Host', `${host.name}/${host.version}`);
|
|
45
|
+
return fetch(input, { ...init, headers });
|
|
46
|
+
},
|
|
33
47
|
});
|
|
34
|
-
const server = new McpServer({ name: 'pdfops', version });
|
|
35
48
|
const SOURCE_DOC = 'PDF source: an absolute file path, an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist.';
|
|
36
49
|
const OUTPUT_DOC = 'Absolute path to write the result. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save.';
|
|
37
50
|
const errText = (e) => e instanceof PdfOpsError
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfops-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"mcpName": "dev.pdfops/pdfops-mcp",
|
|
5
5
|
"description": "MCP server for the PDFops API — give AI agents deterministic PDF tools: inspect AcroForm fields, fill forms, merge PDFs, and generate invoices. Works with Claude Code, Claude Desktop, Cursor, and any MCP client.",
|
|
6
6
|
"keywords": [
|