@pdfgate/mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +25 -0
- package/dist/client.js.map +1 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +45 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/compress-pdf.d.ts +3 -0
- package/dist/tools/compress-pdf.d.ts.map +1 -0
- package/dist/tools/compress-pdf.js +29 -0
- package/dist/tools/compress-pdf.js.map +1 -0
- package/dist/tools/create-envelope.d.ts +3 -0
- package/dist/tools/create-envelope.d.ts.map +1 -0
- package/dist/tools/create-envelope.js +33 -0
- package/dist/tools/create-envelope.js.map +1 -0
- package/dist/tools/create-webhook.d.ts +3 -0
- package/dist/tools/create-webhook.d.ts.map +1 -0
- package/dist/tools/create-webhook.js +29 -0
- package/dist/tools/create-webhook.js.map +1 -0
- package/dist/tools/delete-document.d.ts +3 -0
- package/dist/tools/delete-document.d.ts.map +1 -0
- package/dist/tools/delete-document.js +17 -0
- package/dist/tools/delete-document.js.map +1 -0
- package/dist/tools/delete-webhook.d.ts +3 -0
- package/dist/tools/delete-webhook.d.ts.map +1 -0
- package/dist/tools/delete-webhook.js +17 -0
- package/dist/tools/delete-webhook.js.map +1 -0
- package/dist/tools/extract-pdf-data.d.ts +3 -0
- package/dist/tools/extract-pdf-data.d.ts.map +1 -0
- package/dist/tools/extract-pdf-data.js +17 -0
- package/dist/tools/extract-pdf-data.js.map +1 -0
- package/dist/tools/flatten-pdf.d.ts +3 -0
- package/dist/tools/flatten-pdf.d.ts.map +1 -0
- package/dist/tools/flatten-pdf.js +25 -0
- package/dist/tools/flatten-pdf.js.map +1 -0
- package/dist/tools/generate-pdf.d.ts +3 -0
- package/dist/tools/generate-pdf.d.ts.map +1 -0
- package/dist/tools/generate-pdf.js +68 -0
- package/dist/tools/generate-pdf.js.map +1 -0
- package/dist/tools/get-document.d.ts +3 -0
- package/dist/tools/get-document.d.ts.map +1 -0
- package/dist/tools/get-document.js +24 -0
- package/dist/tools/get-document.js.map +1 -0
- package/dist/tools/get-envelope.d.ts +3 -0
- package/dist/tools/get-envelope.d.ts.map +1 -0
- package/dist/tools/get-envelope.js +17 -0
- package/dist/tools/get-envelope.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +31 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/protect-pdf.d.ts +3 -0
- package/dist/tools/protect-pdf.d.ts.map +1 -0
- package/dist/tools/protect-pdf.js +52 -0
- package/dist/tools/protect-pdf.js.map +1 -0
- package/dist/tools/send-envelope.d.ts +3 -0
- package/dist/tools/send-envelope.d.ts.map +1 -0
- package/dist/tools/send-envelope.js +17 -0
- package/dist/tools/send-envelope.js.map +1 -0
- package/dist/tools/upload-pdf.d.ts +3 -0
- package/dist/tools/upload-pdf.d.ts.map +1 -0
- package/dist/tools/upload-pdf.js +33 -0
- package/dist/tools/upload-pdf.js.map +1 -0
- package/dist/tools/watermark-pdf.d.ts +3 -0
- package/dist/tools/watermark-pdf.d.ts.map +1 -0
- package/dist/tools/watermark-pdf.js +81 -0
- package/dist/tools/watermark-pdf.js.map +1 -0
- package/dist/webhooks/secrets.d.ts +4 -0
- package/dist/webhooks/secrets.d.ts.map +1 -0
- package/dist/webhooks/secrets.js +19 -0
- package/dist/webhooks/secrets.js.map +1 -0
- package/dist/webhooks/server.d.ts +3 -0
- package/dist/webhooks/server.d.ts.map +1 -0
- package/dist/webhooks/server.js +42 -0
- package/dist/webhooks/server.js.map +1 -0
- package/dist/webhooks/store.d.ts +13 -0
- package/dist/webhooks/store.d.ts.map +1 -0
- package/dist/webhooks/store.js +11 -0
- package/dist/webhooks/store.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PDFGate
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# PDFGate MCP Server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for the [PDFGate](https://pdfgate.com) API. Enables AI assistants to generate PDFs, manage documents and handle e-signatures.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add the following to your MCP client configuration:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"pdfgate": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@pdfgate/mcp-server"],
|
|
15
|
+
"env": {
|
|
16
|
+
"PDFGATE_API_KEY": "your_api_key_here"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Getting an API key
|
|
24
|
+
|
|
25
|
+
Sign up at [pdfgate.com](https://pdfgate.com) to get your API key.
|
|
26
|
+
|
|
27
|
+
- Keys starting with `live_` connect to the production environment
|
|
28
|
+
- Keys starting with `test_` connect to the sandbox environment
|
|
29
|
+
|
|
30
|
+
## Tools
|
|
31
|
+
|
|
32
|
+
### PDF Operations
|
|
33
|
+
|
|
34
|
+
| Tool | Description |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `generate_pdf` | Generate a PDF from a URL or raw HTML |
|
|
37
|
+
| `upload_pdf` | Upload a local PDF file or from a URL |
|
|
38
|
+
| `get_document` | Retrieve document metadata and a fresh download URL |
|
|
39
|
+
| `delete_document` | Delete a document |
|
|
40
|
+
| `flatten_pdf` | Flatten an interactive PDF into a static, non-editable file |
|
|
41
|
+
| `extract_pdf_form_data` | Extract form field values from a fillable PDF |
|
|
42
|
+
| `compress_pdf` | Compress a PDF to reduce file size |
|
|
43
|
+
| `protect_pdf` | Encrypt a PDF with a password and permission restrictions |
|
|
44
|
+
| `watermark_pdf` | Apply a text or image watermark to a PDF |
|
|
45
|
+
|
|
46
|
+
### E-Signatures
|
|
47
|
+
|
|
48
|
+
| Tool | Description |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `create_envelope` | Create a signing envelope from one or more documents |
|
|
51
|
+
| `send_envelope` | Send a created envelope to recipients |
|
|
52
|
+
| `get_envelope` | Get the current status of an envelope |
|
|
53
|
+
|
|
54
|
+
### Webhook Management
|
|
55
|
+
|
|
56
|
+
| Tool | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `create_webhook` | Subscribe to PDFGate events |
|
|
59
|
+
| `delete_webhook` | Remove a webhook subscription |
|
|
60
|
+
|
|
61
|
+
## Webhook Triggers
|
|
62
|
+
|
|
63
|
+
The server listens for incoming PDFGate events on port `3599` by default. To receive events:
|
|
64
|
+
|
|
65
|
+
1. Expose port `3599` to the internet (e.g. via [ngrok](https://ngrok.com))
|
|
66
|
+
2. Use the `create_webhook` tool to register your public URL
|
|
67
|
+
|
|
68
|
+
Supported events:
|
|
69
|
+
|
|
70
|
+
| Event | Description |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `envelope.sent` | Signing request emails have been dispatched to recipients |
|
|
73
|
+
| `envelope.completed` | All documents in the envelope have been signed |
|
|
74
|
+
| `envelope.expired` | The envelope expired before all documents were signed |
|
|
75
|
+
| `envelope.document.completed` | A single document inside the envelope has been fully signed |
|
|
76
|
+
|
|
77
|
+
Received events are available via the `pdfgate://events` MCP resource and pushed to the client in real time.
|
|
78
|
+
|
|
79
|
+
## Environment variables
|
|
80
|
+
|
|
81
|
+
| Variable | Required | Default | Description |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| `PDFGATE_API_KEY` | Yes | — | Your PDFGate API key |
|
|
84
|
+
| `PDFGATE_WEBHOOK_PORT` | No | `3599` | Port for the webhook listener |
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,wBAAgB,SAAS,IAAI,OAAO,CAOnC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIjD"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import PdfGate from "pdfgate";
|
|
2
|
+
let _client = null;
|
|
3
|
+
export function getClient() {
|
|
4
|
+
if (!_client) {
|
|
5
|
+
const apiKey = process.env.PDFGATE_API_KEY;
|
|
6
|
+
if (!apiKey)
|
|
7
|
+
throw new Error("PDFGATE_API_KEY environment variable is required");
|
|
8
|
+
_client = new PdfGate(apiKey);
|
|
9
|
+
}
|
|
10
|
+
return _client;
|
|
11
|
+
}
|
|
12
|
+
export function getApiKey() {
|
|
13
|
+
const apiKey = process.env.PDFGATE_API_KEY;
|
|
14
|
+
if (!apiKey)
|
|
15
|
+
throw new Error("PDFGATE_API_KEY environment variable is required");
|
|
16
|
+
return apiKey;
|
|
17
|
+
}
|
|
18
|
+
export function getBaseUrl(apiKey) {
|
|
19
|
+
if (apiKey.startsWith("test_"))
|
|
20
|
+
return "https://api-sandbox.pdfgate.com";
|
|
21
|
+
if (apiKey.startsWith("live_"))
|
|
22
|
+
return "https://api.pdfgate.com";
|
|
23
|
+
throw new Error("Invalid API key format: must start with 'test_' or 'live_'");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,IAAI,OAAO,GAAmB,IAAI,CAAC;AAEnC,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC3C,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjF,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACjF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,iCAAiC,CAAC;IACzE,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,yBAAyB,CAAC;IACjE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB5D;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAqBzE"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getApiKey, getBaseUrl } from "./client.js";
|
|
2
|
+
export async function httpDelete(path) {
|
|
3
|
+
const apiKey = getApiKey();
|
|
4
|
+
const baseUrl = getBaseUrl(apiKey);
|
|
5
|
+
const res = await fetch(`${baseUrl}${path}`, {
|
|
6
|
+
method: "DELETE",
|
|
7
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
8
|
+
});
|
|
9
|
+
if (!res.ok) {
|
|
10
|
+
const body = await res.text().catch(() => "");
|
|
11
|
+
let message = res.statusText;
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(body);
|
|
14
|
+
if (parsed?.message)
|
|
15
|
+
message = parsed.message;
|
|
16
|
+
}
|
|
17
|
+
catch { }
|
|
18
|
+
throw new Error(`HTTP ${res.status}: ${message}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export async function httpPost(path, body) {
|
|
22
|
+
const apiKey = getApiKey();
|
|
23
|
+
const baseUrl = getBaseUrl(apiKey);
|
|
24
|
+
const res = await fetch(`${baseUrl}${path}`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${apiKey}`,
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify(body),
|
|
31
|
+
});
|
|
32
|
+
if (!res.ok) {
|
|
33
|
+
const text = await res.text().catch(() => "");
|
|
34
|
+
let message = res.statusText;
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(text);
|
|
37
|
+
if (parsed?.message)
|
|
38
|
+
message = parsed.message;
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
throw new Error(`HTTP ${res.status}: ${message}`);
|
|
42
|
+
}
|
|
43
|
+
return res.json();
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,EAAE;QAC3C,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE;KAC/C,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAA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C,QAAQ,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAC;AAClC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { registerTools } from "./tools/index.js";
|
|
5
|
+
import { startWebhookServer } from "./webhooks/server.js";
|
|
6
|
+
import { getEvents } from "./webhooks/store.js";
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "pdfgate",
|
|
9
|
+
version: "0.1.0",
|
|
10
|
+
});
|
|
11
|
+
registerTools(server);
|
|
12
|
+
server.resource("pdfgate-events", "pdfgate://events", { description: "Recent PDFGate webhook events (newest first, up to 100). Subscribe to this resource to receive push notifications when new events arrive." }, async () => ({
|
|
13
|
+
contents: [
|
|
14
|
+
{
|
|
15
|
+
uri: "pdfgate://events",
|
|
16
|
+
mimeType: "application/json",
|
|
17
|
+
text: JSON.stringify(getEvents(), null, 2),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
}));
|
|
21
|
+
startWebhookServer(server);
|
|
22
|
+
const transport = new StdioServerTransport();
|
|
23
|
+
await server.connect(transport);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtB,MAAM,CAAC,QAAQ,CACb,gBAAgB,EAChB,kBAAkB,EAClB,EAAE,WAAW,EAAE,2IAA2I,EAAE,EAC5J,KAAK,IAAI,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE;QACR;YACE,GAAG,EAAE,kBAAkB;YACvB,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;SAC3C;KACF;CACF,CAAC,CACH,CAAC;AAEF,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE3B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compress-pdf.d.ts","sourceRoot":"","sources":["../../src/tools/compress-pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6BhD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("compress_pdf", "Compress/optimise a PDF to reduce file size without changing visual content.", {
|
|
5
|
+
documentId: z.string().describe("The source document ID to compress"),
|
|
6
|
+
linearize: z
|
|
7
|
+
.boolean()
|
|
8
|
+
.optional()
|
|
9
|
+
.describe("Linearise the PDF to enable fast web view (first page renders sooner)"),
|
|
10
|
+
preSignedUrlExpiresIn: z
|
|
11
|
+
.number()
|
|
12
|
+
.int()
|
|
13
|
+
.min(60)
|
|
14
|
+
.max(86400)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Pre-signed download URL expiry in seconds (60–86400)"),
|
|
17
|
+
metadata: z.record(z.unknown()).optional().describe("Custom metadata to attach"),
|
|
18
|
+
}, async ({ documentId, linearize, preSignedUrlExpiresIn, metadata }) => {
|
|
19
|
+
try {
|
|
20
|
+
const result = await getClient().compressPdf({ documentId, linearize, preSignedUrlExpiresIn, metadata });
|
|
21
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
25
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=compress-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compress-pdf.js","sourceRoot":"","sources":["../../src/tools/compress-pdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,cAAc,EACd,8EAA8E,EAC9E;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QACrE,SAAS,EAAE,CAAC;aACT,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CAAC,uEAAuE,CAAC;QACpF,qBAAqB,EAAE,CAAC;aACrB,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,EAA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@@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
const recipientSchema = z.object({
|
|
4
|
+
email: z.string().email().describe("Recipient email address"),
|
|
5
|
+
name: z.string().describe("Recipient display name"),
|
|
6
|
+
role: z.string().optional().describe("Recipient role label"),
|
|
7
|
+
reminderIntervalDays: z.number().int().optional().describe("Days between reminder emails"),
|
|
8
|
+
reminderAttempts: z.number().int().optional().describe("Maximum number of reminder emails"),
|
|
9
|
+
});
|
|
10
|
+
const documentSchema = z.object({
|
|
11
|
+
sourceDocumentId: z
|
|
12
|
+
.string()
|
|
13
|
+
.describe("ID of the document previously generated or uploaded to PDFGate"),
|
|
14
|
+
name: z.string().describe("Display name for this document in the envelope"),
|
|
15
|
+
recipients: z.array(recipientSchema).min(1).describe("Recipients for this document"),
|
|
16
|
+
});
|
|
17
|
+
export function register(server) {
|
|
18
|
+
server.tool("create_envelope", "Create a signing envelope from one or more existing PDFGate documents. Returns an envelope in 'created' status; call send_envelope to dispatch signing emails.", {
|
|
19
|
+
documents: z.array(documentSchema).min(1).describe("Documents to include in the envelope"),
|
|
20
|
+
requesterName: z.string().describe("Name of the user or system creating the envelope"),
|
|
21
|
+
metadata: z.record(z.unknown()).optional().describe("Custom metadata to attach"),
|
|
22
|
+
}, async ({ documents, requesterName, metadata }) => {
|
|
23
|
+
try {
|
|
24
|
+
const result = await getClient().createEnvelope({ documents, requesterName, metadata });
|
|
25
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
29
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=create-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-envelope.js","sourceRoot":"","sources":["../../src/tools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
|
|
2
|
+
import { httpPost } from "../http.js";
|
|
3
|
+
import { addSecret } from "../webhooks/secrets.js";
|
|
4
|
+
export function register(server) {
|
|
5
|
+
server.tool("create_webhook", "Create a PDFGate webhook subscription. The response includes a signing secret — store it securely to verify incoming event signatures.", {
|
|
6
|
+
url: z.string().url().describe("The HTTPS endpoint that will receive webhook events"),
|
|
7
|
+
eventTypes: z
|
|
8
|
+
.array(z.enum([
|
|
9
|
+
"envelope.sent",
|
|
10
|
+
"envelope.completed",
|
|
11
|
+
"envelope.expired",
|
|
12
|
+
"envelope.document.completed",
|
|
13
|
+
]))
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe("Event types to subscribe to"),
|
|
16
|
+
description: z.string().optional().describe("Optional label to identify this webhook"),
|
|
17
|
+
}, async ({ url, eventTypes, description }) => {
|
|
18
|
+
try {
|
|
19
|
+
const result = await httpPost("/webhook", { url, eventTypes, description });
|
|
20
|
+
addSecret(result.secret);
|
|
21
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
25
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=create-webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-webhook.js","sourceRoot":"","sources":["../../src/tools/create-webhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAUnD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,wIAAwI,EACxI;QACE,GAAG,EAAE,CAAC,CAAC,MAAM,E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mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { httpDelete } from "../http.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("delete_document", "Delete a PDFGate document.", {
|
|
5
|
+
documentId: z.string().describe("The document ID to delete"),
|
|
6
|
+
}, async ({ documentId }) => {
|
|
7
|
+
try {
|
|
8
|
+
await httpDelete(`/document/${documentId}`);
|
|
9
|
+
return { content: [{ type: "text", text: `Document ${documentId} deleted successfully.` }] };
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
13
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=delete-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-document.js","sourceRoot":"","sources":["../../src/tools/delete-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,4BAA4B,EAC5B;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAC7D,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,aAAa,UAAU,EAAE,CAAC,CAAC;YAC5C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,UAAU,wBAAwB,EAAE,CAAC,EAAE,CAAC;QAC/F,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-webhook.d.ts","sourceRoot":"","sources":["../../src/tools/delete-webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { httpDelete } from "../http.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("delete_webhook", "Delete a PDFGate webhook subscription. Future events will no longer be delivered to the associated endpoint.", {
|
|
5
|
+
webhookId: z.string().describe("The webhook ID to delete"),
|
|
6
|
+
}, async ({ webhookId }) => {
|
|
7
|
+
try {
|
|
8
|
+
await httpDelete(`/webhook/${webhookId}`);
|
|
9
|
+
return { content: [{ type: "text", text: `Webhook ${webhookId} deleted successfully.` }] };
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
13
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=delete-webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-webhook.js","sourceRoot":"","sources":["../../src/tools/delete-webhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8GAA8G,EAC9G;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KAC3D,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,YAAY,SAAS,EAAE,CAAC,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,SAAS,wBAAwB,EAAE,CAAC,EAAE,CAAC;QAC7F,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-pdf-data.d.ts","sourceRoot":"","sources":["../../src/tools/extract-pdf-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("extract_pdf_form_data", "Extract form field values from a fillable PDF. Returns a JSON object mapping field names to their values.", {
|
|
5
|
+
documentId: z.string().describe("The document ID of the fillable PDF"),
|
|
6
|
+
}, async ({ documentId }) => {
|
|
7
|
+
try {
|
|
8
|
+
const result = await getClient().extractPdfFormData({ documentId });
|
|
9
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
13
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=extract-pdf-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-pdf-data.js","sourceRoot":"","sources":["../../src/tools/extract-pdf-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,2GAA2G,EAC3G;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACvE,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YACpE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-pdf.d.ts","sourceRoot":"","sources":["../../src/tools/flatten-pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyBhD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("flatten_pdf", "Flatten an interactive PDF into a static, non-editable PDF. Creates a new document; does not overwrite the original.", {
|
|
5
|
+
documentId: z.string().describe("The source document ID to flatten"),
|
|
6
|
+
preSignedUrlExpiresIn: z
|
|
7
|
+
.number()
|
|
8
|
+
.int()
|
|
9
|
+
.min(60)
|
|
10
|
+
.max(86400)
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Pre-signed download URL expiry in seconds (60–86400)"),
|
|
13
|
+
metadata: z.record(z.unknown()).optional().describe("Custom metadata to attach"),
|
|
14
|
+
}, async ({ documentId, preSignedUrlExpiresIn, metadata }) => {
|
|
15
|
+
try {
|
|
16
|
+
const result = await getClient().flattenPdf({ documentId, preSignedUrlExpiresIn, metadata });
|
|
17
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
21
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=flatten-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-pdf.js","sourceRoot":"","sources":["../../src/tools/flatten-pdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,aAAa,EACb,sHAAsH,EACtH;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;QACpE,qBAAqB,EAAE,CAAC;aACrB,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,EAAE,CAAC;aACP,GAAG,CAAC,KAAK,CAAC;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,sDAAsD,CAAC;QACnE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KACjF,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,QAAQ,EAAE,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC7F,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-pdf.d.ts","sourceRoot":"","sources":["../../src/tools/generate-pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyFhD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.tool("generate_pdf", "Generate a PDF from a URL or raw HTML. Provide either 'url' or 'html', not both.", {
|
|
5
|
+
url: z.string().url().optional().describe("Public URL to render as PDF"),
|
|
6
|
+
html: z.string().optional().describe("Raw HTML string to render as PDF"),
|
|
7
|
+
pageSizeType: z
|
|
8
|
+
.enum(["a0", "a1", "a2", "a3", "a4", "a5", "a6", "ledger", "tabloid", "legal", "letter"])
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Page size (default: a4)"),
|
|
11
|
+
orientation: z
|
|
12
|
+
.enum(["portrait", "landscape"])
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Page orientation (default: portrait)"),
|
|
15
|
+
marginTop: z.string().optional().describe("Top margin e.g. '10mm'"),
|
|
16
|
+
marginBottom: z.string().optional().describe("Bottom margin"),
|
|
17
|
+
marginLeft: z.string().optional().describe("Left margin"),
|
|
18
|
+
marginRight: z.string().optional().describe("Right margin"),
|
|
19
|
+
header: z.string().optional().describe("HTML string for the page header"),
|
|
20
|
+
footer: z.string().optional().describe("HTML string for the page footer"),
|
|
21
|
+
printBackground: z.boolean().optional().describe("Print background graphics (default: true)"),
|
|
22
|
+
waitForNetworkIdle: z.boolean().optional().describe("Wait for network idle before rendering"),
|
|
23
|
+
javascript: z.string().optional().describe("JavaScript to inject before rendering"),
|
|
24
|
+
css: z.string().optional().describe("CSS to inject before rendering"),
|
|
25
|
+
emulateMediaType: z.enum(["screen", "print"]).optional(),
|
|
26
|
+
enableFormFields: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Enable interactive PDF form fields from HTML"),
|
|
30
|
+
preSignedUrlExpiresIn: z
|
|
31
|
+
.number()
|
|
32
|
+
.int()
|
|
33
|
+
.min(60)
|
|
34
|
+
.max(86400)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Pre-signed download URL expiry in seconds (60–86400)"),
|
|
37
|
+
metadata: z.record(z.unknown()).optional().describe("Custom metadata to attach"),
|
|
38
|
+
}, async ({ url, html, pageSizeType, orientation, marginTop, marginBottom, marginLeft, marginRight, header, footer, printBackground, waitForNetworkIdle, javascript, css, emulateMediaType, enableFormFields, preSignedUrlExpiresIn, metadata, }) => {
|
|
39
|
+
try {
|
|
40
|
+
const margin = marginTop || marginBottom || marginLeft || marginRight
|
|
41
|
+
? { top: marginTop, bottom: marginBottom, left: marginLeft, right: marginRight }
|
|
42
|
+
: undefined;
|
|
43
|
+
const result = await getClient().generatePdf({
|
|
44
|
+
url,
|
|
45
|
+
html,
|
|
46
|
+
pageSizeType: pageSizeType,
|
|
47
|
+
orientation: orientation,
|
|
48
|
+
margin,
|
|
49
|
+
header,
|
|
50
|
+
footer,
|
|
51
|
+
printBackground,
|
|
52
|
+
waitForNetworkIdle,
|
|
53
|
+
javascript,
|
|
54
|
+
css,
|
|
55
|
+
emulateMediaType: emulateMediaType,
|
|
56
|
+
enableFormFields,
|
|
57
|
+
preSignedUrlExpiresIn,
|
|
58
|
+
metadata,
|
|
59
|
+
});
|
|
60
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
64
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=generate-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-pdf.js","sourceRoot":"","sources":["../../src/tools/generate-pdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,cAAc,EACd,kFAAkF,EAClF;QACE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QACxE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QACxE,YAAY,EAAE,CAAC;aACZ,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;aACxF,QAAQ,EAAE;aACV,QAAQ,CAAC,yBAAyB,CAAC;QACtC,WAAW,EAAE,CAAC;aACX,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;aAC/B,QAAQ,EAAE;aACV,QAAQ,CAAC,sCAAs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