pdfcrowd-mcp-pdf-export 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 +132 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +51 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +31 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/pdfcrowd-client.d.ts +30 -0
- package/dist/services/pdfcrowd-client.d.ts.map +1 -0
- package/dist/services/pdfcrowd-client.js +214 -0
- package/dist/services/pdfcrowd-client.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 PDFCrowd
|
|
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,132 @@
|
|
|
1
|
+
# PDF Export for AI Agents
|
|
2
|
+
|
|
3
|
+
MCP server for PDF export. Install locally, use from Claude Code, Codex, Gemini CLI, or any MCP-compatible client.
|
|
4
|
+
|
|
5
|
+
Reports, documentation, code reviews — anything your AI can describe, it can now export.
|
|
6
|
+
|
|
7
|
+
Powered by [PDFCrowd](https://pdfcrowd.com).
|
|
8
|
+
|
|
9
|
+
## What You Can Do
|
|
10
|
+
|
|
11
|
+
**The pattern:**
|
|
12
|
+
```
|
|
13
|
+
[Analyze/Read something] → [Create PDF with specific structure] → [Save to path]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Document your API from code:**
|
|
17
|
+
```
|
|
18
|
+
Read the route handlers in src/api/, generate API documentation
|
|
19
|
+
with endpoints, parameters, and examples. Save to docs/api.pdf
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Document your database schema:**
|
|
23
|
+
```
|
|
24
|
+
Explore the codebase and create a PDF documenting
|
|
25
|
+
all DB tables, relationships, column types, and indexes. Save to docs/schema.pdf
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Automate reports (non-interactive):**
|
|
29
|
+
```bash
|
|
30
|
+
claude -p "Analyze git commits from last week, create a sprint
|
|
31
|
+
summary PDF at reports/sprint.pdf" && \
|
|
32
|
+
mail -s "Sprint Report" team@company.com -A reports/sprint.pdf
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
[More example prompts →](SAMPLE_PROMPTS.md)
|
|
36
|
+
|
|
37
|
+
## Setup
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone <repo-url>
|
|
41
|
+
cd pdfcrowd-mcp-pdf-export
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
### Claude Code
|
|
49
|
+
|
|
50
|
+
Add to `~/.mcp.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"pdfcrowd-export-pdf": {
|
|
56
|
+
"command": "node",
|
|
57
|
+
"args": ["/FULL/PATH/TO/pdfcrowd-mcp-pdf-export/dist/index.js"],
|
|
58
|
+
"env": {
|
|
59
|
+
"PDFCROWD_USERNAME": "demo",
|
|
60
|
+
"PDFCROWD_API_KEY": "demo"
|
|
61
|
+
},
|
|
62
|
+
"timeout": 65000
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Codex CLI
|
|
69
|
+
|
|
70
|
+
Add to `~/.codex/config.toml`:
|
|
71
|
+
|
|
72
|
+
```toml
|
|
73
|
+
[mcp_servers.pdfcrowd-export-pdf]
|
|
74
|
+
command = "node"
|
|
75
|
+
args = ["/FULL/PATH/TO/pdfcrowd-mcp-pdf-export/dist/index.js"]
|
|
76
|
+
tool_timeout_sec = 65
|
|
77
|
+
|
|
78
|
+
[mcp_servers.pdfcrowd-export-pdf.env]
|
|
79
|
+
PDFCROWD_USERNAME = "demo"
|
|
80
|
+
PDFCROWD_API_KEY = "demo"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Gemini CLI
|
|
84
|
+
|
|
85
|
+
Add to `~/.gemini/settings.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"pdfcrowd-export-pdf": {
|
|
91
|
+
"command": "node",
|
|
92
|
+
"args": ["/FULL/PATH/TO/pdfcrowd-mcp-pdf-export/dist/index.js"],
|
|
93
|
+
"env": {
|
|
94
|
+
"PDFCROWD_USERNAME": "demo",
|
|
95
|
+
"PDFCROWD_API_KEY": "demo"
|
|
96
|
+
},
|
|
97
|
+
"timeout": 65000
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Notes
|
|
104
|
+
|
|
105
|
+
- Replace `/FULL/PATH/TO/` with the actual path to your installation
|
|
106
|
+
- Restart your CLI after configuration to load the server
|
|
107
|
+
- Timeout is set to 65 seconds because complex PDFs may take up to 60 seconds to generate
|
|
108
|
+
|
|
109
|
+
## Credentials
|
|
110
|
+
|
|
111
|
+
- Default: produces watermarked PDFs (no signup needed)
|
|
112
|
+
- Remove watermarks: get credentials at [pdfcrowd.com/pricing](https://pdfcrowd.com/pricing/)
|
|
113
|
+
|
|
114
|
+
## Privacy Notice
|
|
115
|
+
|
|
116
|
+
PDFs are generated remotely on PDFCrowd servers. When you use this tool:
|
|
117
|
+
|
|
118
|
+
- **Data transmitted**: Your content (HTML, URL, or file) is sent to PDFCrowd servers via HTTPS
|
|
119
|
+
- **Data retention**: Content is retained only during processing, then permanently deleted (typically within 30 minutes)
|
|
120
|
+
- **No copies**: No copies of your content are kept or shared
|
|
121
|
+
- **Location**: PDFCrowd is based in the Czech Republic (EU), GDPR applies
|
|
122
|
+
- **Privacy policy**: [pdfcrowd.com/privacy](https://pdfcrowd.com/privacy/)
|
|
123
|
+
|
|
124
|
+
For sensitive or confidential content, review PDFCrowd's privacy policy before use.
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
See [DEVELOPMENT.md](DEVELOPMENT.md) for build instructions, testing, and versioning.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
[MIT](LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PDFCrowd MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Export content as PDF using the PDFCrowd API.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { CreatePdfSchema } from "./schemas/index.js";
|
|
11
|
+
import { createPdf } from "./services/pdfcrowd-client.js";
|
|
12
|
+
import { VERSION } from "./version.js";
|
|
13
|
+
const server = new McpServer({
|
|
14
|
+
name: "PDF Export",
|
|
15
|
+
version: VERSION
|
|
16
|
+
});
|
|
17
|
+
// Register the main tool
|
|
18
|
+
server.registerTool("pdfcrowd_create_pdf", {
|
|
19
|
+
title: "Create PDF",
|
|
20
|
+
description: `Export any content (including charts) to PDF.
|
|
21
|
+
If input isn't HTML, create a well-designed layout first.
|
|
22
|
+
Check schema for valid parameters, output_path is required.
|
|
23
|
+
When creating HTML:
|
|
24
|
+
- No body background color
|
|
25
|
+
- Use 16px base font size
|
|
26
|
+
- Use block flow for main structure (sections stack vertically)
|
|
27
|
+
- Flex/grid only inside non-breaking units (cards, headers) - they break poorly across pages
|
|
28
|
+
- break-inside:avoid and break-before:page work on block elements only (div, section, figure, table)
|
|
29
|
+
- TOC: only if requested or appropriate; entries must link to section anchors
|
|
30
|
+
- Images: absolute URLs or inline data URIs; embed inline SVG for charts and infographics
|
|
31
|
+
|
|
32
|
+
On error: Read the error message carefully and follow its guidance. Report configuration issues to the user instead of trying other PDF tools.
|
|
33
|
+
`,
|
|
34
|
+
inputSchema: CreatePdfSchema,
|
|
35
|
+
annotations: {
|
|
36
|
+
readOnlyHint: false,
|
|
37
|
+
destructiveHint: false,
|
|
38
|
+
idempotentHint: true,
|
|
39
|
+
openWorldHint: true
|
|
40
|
+
}
|
|
41
|
+
}, async (params) => {
|
|
42
|
+
const result = await createPdf({
|
|
43
|
+
html: params.html,
|
|
44
|
+
url: params.url,
|
|
45
|
+
file: params.file,
|
|
46
|
+
outputPath: params.output_path,
|
|
47
|
+
pageSize: params.page_size,
|
|
48
|
+
orientation: params.orientation,
|
|
49
|
+
noMargins: params.no_margins,
|
|
50
|
+
title: params.title
|
|
51
|
+
});
|
|
52
|
+
if (!result.success) {
|
|
53
|
+
return {
|
|
54
|
+
content: [{ type: "text", text: `Error: ${result.error}` }],
|
|
55
|
+
isError: true
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const lines = [
|
|
59
|
+
`PDF saved to: ${result.outputPath}`,
|
|
60
|
+
`Size: ${(result.metadata.outputSize / 1024).toFixed(1)} KB`,
|
|
61
|
+
result.metadata.pageCount ? `Pages: ${result.metadata.pageCount}` : null,
|
|
62
|
+
result.isDemo ? `\nDemo mode (watermarked). Upgrade: pdfcrowd.com/pricing` : null
|
|
63
|
+
].filter(Boolean);
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: lines.join("\n") }]
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// Info tool for users
|
|
69
|
+
server.registerTool("pdfcrowd_info", {
|
|
70
|
+
title: "PDF Export Info",
|
|
71
|
+
description: "Get usage tips and upgrade info for PDF Export",
|
|
72
|
+
inputSchema: z.object({})
|
|
73
|
+
}, async () => {
|
|
74
|
+
const isDemo = process.env.PDFCROWD_USERNAME === "demo";
|
|
75
|
+
const lines = [
|
|
76
|
+
`PDF Export v${VERSION} | pdfcrowd.com`,
|
|
77
|
+
`Status: ${isDemo ? 'DEMO (watermarked)' : 'Licensed'}`,
|
|
78
|
+
isDemo ? 'Remove watermark: pdfcrowd.com/pricing' : null,
|
|
79
|
+
'',
|
|
80
|
+
'Prompt pattern: [Read/analyze content] → [Create PDF with structure] → [Save to path]',
|
|
81
|
+
'',
|
|
82
|
+
'Support: support@pdfcrowd.com'
|
|
83
|
+
].filter(line => line !== null);
|
|
84
|
+
return { content: [{ type: "text", text: lines.join('\n') }] };
|
|
85
|
+
});
|
|
86
|
+
// Main
|
|
87
|
+
async function main() {
|
|
88
|
+
const username = process.env.PDFCROWD_USERNAME;
|
|
89
|
+
const apiKey = process.env.PDFCROWD_API_KEY;
|
|
90
|
+
if (!username || !apiKey) {
|
|
91
|
+
console.error("ERROR: PDFCROWD_USERNAME and PDFCROWD_API_KEY required");
|
|
92
|
+
console.error(' export PDFCROWD_USERNAME="your_username"');
|
|
93
|
+
console.error(' export PDFCROWD_API_KEY="your_api_key"');
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const transport = new StdioServerTransport();
|
|
97
|
+
await server.connect(transport);
|
|
98
|
+
console.error("PDF Export MCP server running");
|
|
99
|
+
}
|
|
100
|
+
main().catch((error) => {
|
|
101
|
+
console.error("Server error:", error);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAuB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,yBAAyB;AACzB,MAAM,CAAC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AAC,CAAC;QAC5D,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACjD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PAGE_SIZES: readonly ["A3", "A4", "A5", "Letter"];
|
|
3
|
+
export declare const ORIENTATIONS: readonly ["portrait", "landscape"];
|
|
4
|
+
export declare const CreatePdfSchema: z.ZodEffects<z.ZodObject<{
|
|
5
|
+
html: z.ZodOptional<z.ZodString>;
|
|
6
|
+
url: z.ZodOptional<z.ZodString>;
|
|
7
|
+
file: z.ZodOptional<z.ZodString>;
|
|
8
|
+
output_path: z.ZodString;
|
|
9
|
+
page_size: z.ZodDefault<z.ZodEnum<["A3", "A4", "A5", "Letter"]>>;
|
|
10
|
+
orientation: z.ZodDefault<z.ZodEnum<["portrait", "landscape"]>>;
|
|
11
|
+
no_margins: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
title: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
output_path: string;
|
|
15
|
+
page_size: "A3" | "A4" | "A5" | "Letter";
|
|
16
|
+
orientation: "portrait" | "landscape";
|
|
17
|
+
no_margins: boolean;
|
|
18
|
+
html?: string | undefined;
|
|
19
|
+
url?: string | undefined;
|
|
20
|
+
file?: string | undefined;
|
|
21
|
+
title?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
output_path: string;
|
|
24
|
+
html?: string | undefined;
|
|
25
|
+
url?: string | undefined;
|
|
26
|
+
file?: string | undefined;
|
|
27
|
+
page_size?: "A3" | "A4" | "A5" | "Letter" | undefined;
|
|
28
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
29
|
+
no_margins?: boolean | undefined;
|
|
30
|
+
title?: string | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
output_path: string;
|
|
33
|
+
page_size: "A3" | "A4" | "A5" | "Letter";
|
|
34
|
+
orientation: "portrait" | "landscape";
|
|
35
|
+
no_margins: boolean;
|
|
36
|
+
html?: string | undefined;
|
|
37
|
+
url?: string | undefined;
|
|
38
|
+
file?: string | undefined;
|
|
39
|
+
title?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
output_path: string;
|
|
42
|
+
html?: string | undefined;
|
|
43
|
+
url?: string | undefined;
|
|
44
|
+
file?: string | undefined;
|
|
45
|
+
page_size?: "A3" | "A4" | "A5" | "Letter" | undefined;
|
|
46
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
47
|
+
no_margins?: boolean | undefined;
|
|
48
|
+
title?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export type CreatePdfInput = z.infer<typeof CreatePdfSchema>;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,uCAAwC,CAAC;AAChE,eAAO,MAAM,YAAY,oCAAqC,CAAC;AAE/D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const PAGE_SIZES = ["A3", "A4", "A5", "Letter"];
|
|
3
|
+
export const ORIENTATIONS = ["portrait", "landscape"];
|
|
4
|
+
export const CreatePdfSchema = z.object({
|
|
5
|
+
html: z.string()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe("HTML content to convert"),
|
|
8
|
+
url: z.string()
|
|
9
|
+
.url()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("URL to convert"),
|
|
12
|
+
file: z.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Path to local HTML file"),
|
|
15
|
+
output_path: z.string()
|
|
16
|
+
.min(1)
|
|
17
|
+
.describe("File path where the PDF will be saved"),
|
|
18
|
+
page_size: z.enum(PAGE_SIZES)
|
|
19
|
+
.default("A4")
|
|
20
|
+
.describe("Page size"),
|
|
21
|
+
orientation: z.enum(ORIENTATIONS)
|
|
22
|
+
.default("portrait")
|
|
23
|
+
.describe("Page orientation"),
|
|
24
|
+
no_margins: z.boolean()
|
|
25
|
+
.default(false)
|
|
26
|
+
.describe("Remove all margins"),
|
|
27
|
+
title: z.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("PDF title metadata")
|
|
30
|
+
}).strict().refine(data => [data.html, data.url, data.file].filter(Boolean).length === 1, { message: "Provide exactly one of: html, url, or file" });
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAU,CAAC;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,E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|
|
2
|
+
jobId: string;
|
|
3
|
+
remainingCredits: number;
|
|
4
|
+
consumedCredits: number;
|
|
5
|
+
pageCount?: number;
|
|
6
|
+
outputSize: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ConversionResult {
|
|
9
|
+
success: true;
|
|
10
|
+
outputPath: string;
|
|
11
|
+
metadata: ConversionMetadata;
|
|
12
|
+
isDemo: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ErrorResult {
|
|
15
|
+
success: false;
|
|
16
|
+
error: string;
|
|
17
|
+
httpCode?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CreatePdfOptions {
|
|
20
|
+
html?: string;
|
|
21
|
+
url?: string;
|
|
22
|
+
file?: string;
|
|
23
|
+
outputPath: string;
|
|
24
|
+
pageSize?: string;
|
|
25
|
+
orientation?: string;
|
|
26
|
+
noMargins?: boolean;
|
|
27
|
+
title?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function createPdf(options: CreatePdfOptions): Promise<ConversionResult | ErrorResult>;
|
|
30
|
+
//# sourceMappingURL=pdfcrowd-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfcrowd-client.d.ts","sourceRoot":"","sources":["../../src/services/pdfcrowd-client.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAuJD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkCD,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC,CAwDlG"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import FormData from "form-data";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { VERSION } from "../version.js";
|
|
6
|
+
const API_HOST = "api.pdfcrowd.com";
|
|
7
|
+
const API_VERSION = "24.04";
|
|
8
|
+
const API_BASE_URL = `https://${API_HOST}/convert/${API_VERSION}`;
|
|
9
|
+
const USER_AGENT = `pdfcrowd-mcp-pdf-export/${VERSION} (Node.js)`;
|
|
10
|
+
const MAX_RETRIES = 2;
|
|
11
|
+
const RETRY_DELAY_MS = 1000;
|
|
12
|
+
// PDFCrowd API times out after 60s; we use 120s to allow for retries and network latency
|
|
13
|
+
const REQUEST_TIMEOUT_MS = 120000;
|
|
14
|
+
function sleep(ms) {
|
|
15
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
16
|
+
}
|
|
17
|
+
function is5xxError(error) {
|
|
18
|
+
return error instanceof AxiosError &&
|
|
19
|
+
error.response !== undefined &&
|
|
20
|
+
error.response.status >= 500 &&
|
|
21
|
+
error.response.status < 600;
|
|
22
|
+
}
|
|
23
|
+
function getCredentials() {
|
|
24
|
+
const username = process.env.PDFCROWD_USERNAME;
|
|
25
|
+
const apiKey = process.env.PDFCROWD_API_KEY;
|
|
26
|
+
if (!username || !apiKey) {
|
|
27
|
+
throw new Error("Missing credentials. Set PDFCROWD_USERNAME and PDFCROWD_API_KEY.");
|
|
28
|
+
}
|
|
29
|
+
return { username, apiKey };
|
|
30
|
+
}
|
|
31
|
+
function isDemo(username) {
|
|
32
|
+
return username === "demo";
|
|
33
|
+
}
|
|
34
|
+
function parseMetadata(headers) {
|
|
35
|
+
return {
|
|
36
|
+
jobId: String(headers["x-pdfcrowd-job-id"] || ""),
|
|
37
|
+
remainingCredits: Number(headers["x-pdfcrowd-remaining-credits"] || 0),
|
|
38
|
+
consumedCredits: Number(headers["x-pdfcrowd-consumed-credits"] || 0),
|
|
39
|
+
pageCount: headers["x-pdfcrowd-pages"]
|
|
40
|
+
? Number(headers["x-pdfcrowd-pages"])
|
|
41
|
+
: undefined,
|
|
42
|
+
outputSize: Number(headers["x-pdfcrowd-output-size"] || 0)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function parseJsonError(data) {
|
|
46
|
+
try {
|
|
47
|
+
const str = Buffer.isBuffer(data) ? data.toString("utf-8") : data;
|
|
48
|
+
const parsed = JSON.parse(str);
|
|
49
|
+
if (typeof parsed.status_code === "number" &&
|
|
50
|
+
typeof parsed.reason_code === "number" &&
|
|
51
|
+
typeof parsed.message === "string") {
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// JSON parsing failed
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function getErrorGuidance(status, reasonCode) {
|
|
61
|
+
// User configuration issues - tell user, don't retry with other tools
|
|
62
|
+
if (status === 401) {
|
|
63
|
+
if (reasonCode === 103) {
|
|
64
|
+
return "Tell the user their PDFCrowd license has expired. Do not retry with other PDF tools.";
|
|
65
|
+
}
|
|
66
|
+
if (reasonCode === 106) {
|
|
67
|
+
return "Tell the user to check PDFCROWD_USERNAME and PDFCROWD_API_KEY in ~/.mcp.json. Do not retry with other PDF tools.";
|
|
68
|
+
}
|
|
69
|
+
return "Tell the user to check their PDFCrowd credentials in ~/.mcp.json. Do not retry with other PDF tools.";
|
|
70
|
+
}
|
|
71
|
+
if (status === 403 || reasonCode === 105) {
|
|
72
|
+
return "Tell the user they have no PDFCrowd credits remaining. Upgrade at pdfcrowd.com/pricing. Do not retry with other PDF tools.";
|
|
73
|
+
}
|
|
74
|
+
if (status === 413) {
|
|
75
|
+
return "The input is too large (max 300MB). Try with smaller content.";
|
|
76
|
+
}
|
|
77
|
+
if (status === 429 || reasonCode === 120) {
|
|
78
|
+
return "Rate limit exceeded. Tell the user to wait or upgrade their PDFCrowd plan. Do not retry with other PDF tools.";
|
|
79
|
+
}
|
|
80
|
+
if (status === 430 || reasonCode === 121) {
|
|
81
|
+
return "Too many concurrent requests. Wait and retry, or tell user to upgrade their plan.";
|
|
82
|
+
}
|
|
83
|
+
if (reasonCode === 122) {
|
|
84
|
+
return "Demo credits exhausted. Tell the user to get a PDFCrowd license at pdfcrowd.com/pricing. Do not retry with other PDF tools.";
|
|
85
|
+
}
|
|
86
|
+
// Request issues - Claude might fix by adjusting parameters
|
|
87
|
+
if (reasonCode === 320) {
|
|
88
|
+
return "The URL is invalid. Check the URL format and try again.";
|
|
89
|
+
}
|
|
90
|
+
if (reasonCode === 305 || reasonCode === 325) {
|
|
91
|
+
return "The HTML input is missing or invalid. Check your HTML content.";
|
|
92
|
+
}
|
|
93
|
+
if (reasonCode === 337) {
|
|
94
|
+
return "Invalid parameter value. Check the parameter format.";
|
|
95
|
+
}
|
|
96
|
+
if (reasonCode === 357) {
|
|
97
|
+
return "The input file is password-protected. Tell the user to provide an unprotected file.";
|
|
98
|
+
}
|
|
99
|
+
// Transient issues
|
|
100
|
+
if (reasonCode === 306) {
|
|
101
|
+
return "Input too complex or large. Try simplifying the HTML content.";
|
|
102
|
+
}
|
|
103
|
+
if (reasonCode === 323) {
|
|
104
|
+
return "Conversion timed out. Possible causes: complex layout, large content, or slow-loading resources (images, fonts). Simplify the HTML or use inline/smaller images.";
|
|
105
|
+
}
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
function handleApiError(error, attempts) {
|
|
109
|
+
const suffix = attempts && attempts > 1 ? ` (after ${attempts} attempts)` : "";
|
|
110
|
+
if (error instanceof AxiosError) {
|
|
111
|
+
if (error.response) {
|
|
112
|
+
const status = error.response.status;
|
|
113
|
+
const jsonError = parseJsonError(error.response.data);
|
|
114
|
+
if (jsonError) {
|
|
115
|
+
const guidance = getErrorGuidance(jsonError.status_code, jsonError.reason_code);
|
|
116
|
+
const guidanceSuffix = guidance ? ` ${guidance}` : "";
|
|
117
|
+
const msg = `PDFCrowd error ${jsonError.status_code} (reason ${jsonError.reason_code}): ${jsonError.message}${suffix}.${guidanceSuffix}`;
|
|
118
|
+
return { success: false, error: msg, httpCode: status };
|
|
119
|
+
}
|
|
120
|
+
// Fallback to string-based handling
|
|
121
|
+
const message = error.response.data?.toString() || error.message;
|
|
122
|
+
return { success: false, error: `PDFCrowd API error (${status}): ${message}${suffix}`, httpCode: status };
|
|
123
|
+
}
|
|
124
|
+
else if (error.code === "ECONNABORTED") {
|
|
125
|
+
return { success: false, error: `PDFCrowd request timed out.${suffix}` };
|
|
126
|
+
}
|
|
127
|
+
else if (error.code === "ENOTFOUND") {
|
|
128
|
+
return { success: false, error: `PDFCrowd API unreachable. Tell the user to check their internet connection.${suffix}` };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
error: `PDFCrowd unexpected error: ${error instanceof Error ? error.message : String(error)}${suffix}`
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function buildForm(options) {
|
|
137
|
+
const form = new FormData();
|
|
138
|
+
// Set input source
|
|
139
|
+
if (options.html) {
|
|
140
|
+
form.append("text", options.html);
|
|
141
|
+
}
|
|
142
|
+
else if (options.url) {
|
|
143
|
+
form.append("url", options.url);
|
|
144
|
+
}
|
|
145
|
+
else if (options.file) {
|
|
146
|
+
form.append("file", fs.createReadStream(options.file));
|
|
147
|
+
}
|
|
148
|
+
// Set options
|
|
149
|
+
if (options.pageSize) {
|
|
150
|
+
form.append("page_size", options.pageSize);
|
|
151
|
+
}
|
|
152
|
+
if (options.orientation) {
|
|
153
|
+
form.append("orientation", options.orientation);
|
|
154
|
+
}
|
|
155
|
+
if (options.noMargins) {
|
|
156
|
+
form.append("no_margins", "true");
|
|
157
|
+
}
|
|
158
|
+
if (options.title) {
|
|
159
|
+
form.append("title", options.title);
|
|
160
|
+
}
|
|
161
|
+
// Default options
|
|
162
|
+
//form.append("enable_pdf_forms", "on");
|
|
163
|
+
return form;
|
|
164
|
+
}
|
|
165
|
+
export async function createPdf(options) {
|
|
166
|
+
// Validate file exists before attempting
|
|
167
|
+
if (options.file && !fs.existsSync(options.file)) {
|
|
168
|
+
return { success: false, error: `File not found: ${options.file}` };
|
|
169
|
+
}
|
|
170
|
+
const { username, apiKey } = getCredentials();
|
|
171
|
+
let lastError;
|
|
172
|
+
let attempts = 0;
|
|
173
|
+
for (let attempt = 1; attempt <= MAX_RETRIES + 1; attempt++) {
|
|
174
|
+
attempts = attempt;
|
|
175
|
+
try {
|
|
176
|
+
const form = buildForm(options);
|
|
177
|
+
const response = await axios.post(`${API_BASE_URL}/?errfmt=json`, form, {
|
|
178
|
+
auth: { username, password: apiKey },
|
|
179
|
+
headers: {
|
|
180
|
+
...form.getHeaders(),
|
|
181
|
+
"User-Agent": USER_AGENT
|
|
182
|
+
},
|
|
183
|
+
responseType: "arraybuffer",
|
|
184
|
+
timeout: REQUEST_TIMEOUT_MS
|
|
185
|
+
});
|
|
186
|
+
// Ensure output directory exists
|
|
187
|
+
const dir = path.dirname(options.outputPath);
|
|
188
|
+
if (!fs.existsSync(dir)) {
|
|
189
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
190
|
+
}
|
|
191
|
+
fs.writeFileSync(options.outputPath, response.data);
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
outputPath: path.resolve(options.outputPath),
|
|
195
|
+
metadata: parseMetadata(response.headers),
|
|
196
|
+
isDemo: isDemo(username)
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
lastError = error;
|
|
201
|
+
// Retry on 5xx errors (except on last attempt)
|
|
202
|
+
if (is5xxError(error) && attempt <= MAX_RETRIES) {
|
|
203
|
+
if (attempt > 1) {
|
|
204
|
+
await sleep(RETRY_DELAY_MS);
|
|
205
|
+
}
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
// Non-retryable error or last attempt
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return handleApiError(lastError, attempts);
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=pdfcrowd-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfcrowd-client.js","sourceRoot":"","sources":["../../src/services/pdfcrowd-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,YAAY,GAAG,WAAW,QAAQ,YAAY,WAAW,EAAE,CAAC;AAClE,MAAM,UAAU,GAAG,2BAA2B,OAAO,YAAY,CAAC;AAElE,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,yFAAyF;AACzF,MAAM,kBAAkB,GAAG,MAAM,CAAC;A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C;YACf,SAAS,GAAG,KAAK,CAAC;YAElB,+CAA+C;YAC/C,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;gBAChD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;oBAChB,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC;gBAC9B,CAAC;gBACD,SAAS;YACX,CAAC;YAED,sCAAsC;YACtC,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,MAAoB,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAW,GAAG,CAAC,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pdfcrowd-mcp-pdf-export",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "PDF Export for AI agents - export any content to PDF with AI-powered formatting. Works with Claude Code, Codex CLI, and other MCP clients.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pdfcrowd-mcp-pdf-export": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node dist/index.js",
|
|
12
|
+
"dev": "tsx watch src/index.ts",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.6.1",
|
|
22
|
+
"axios": "^1.7.9",
|
|
23
|
+
"form-data": "^4.0.0",
|
|
24
|
+
"zod": "^3.23.8",
|
|
25
|
+
"zod-to-json-schema": "^3.25.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^22.10.0",
|
|
29
|
+
"tsx": "^4.19.2",
|
|
30
|
+
"typescript": "^5.7.2"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"mcp",
|
|
34
|
+
"model-context-protocol",
|
|
35
|
+
"pdf",
|
|
36
|
+
"pdf-export",
|
|
37
|
+
"pdfcrowd",
|
|
38
|
+
"claude",
|
|
39
|
+
"claude-code",
|
|
40
|
+
"codex",
|
|
41
|
+
"ai",
|
|
42
|
+
"llm",
|
|
43
|
+
"document-generation",
|
|
44
|
+
"report-generation",
|
|
45
|
+
"html-to-pdf"
|
|
46
|
+
],
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"author": "PDFCrowd <support@pdfcrowd.com> (https://pdfcrowd.com)",
|
|
49
|
+
"homepage": "https://github.com/pdfcrowd/pdfcrowd-mcp-pdf-export#readme",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/pdfcrowd/pdfcrowd-mcp-pdf-export.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/pdfcrowd/pdfcrowd-mcp-pdf-export/issues"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"README.md",
|
|
60
|
+
"LICENSE"
|
|
61
|
+
]
|
|
62
|
+
}
|