snapforge-mcp 1.0.0 → 1.2.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.
Files changed (2) hide show
  1. package/index.js +32 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -55,7 +55,15 @@ server.registerTool(
55
55
  async (args) => {
56
56
  try {
57
57
  const { buf, contentType } = await render('/v1/screenshot', args);
58
- return { content: [{ type: 'image', data: buf.toString('base64'), mimeType: contentType }] };
58
+ const ext = contentType.includes('jpeg') ? 'jpg' : 'png';
59
+ const file = path.join(tmpdir(), `snapforge-${Date.now()}.${ext}`);
60
+ await writeFile(file, buf);
61
+ return {
62
+ content: [
63
+ { type: 'image', data: buf.toString('base64'), mimeType: contentType },
64
+ { type: 'text', text: `Saved to ${file} (${buf.length} bytes).` }
65
+ ]
66
+ };
59
67
  } catch (e) {
60
68
  return { isError: true, content: [{ type: 'text', text: String(e.message || e) }] };
61
69
  }
@@ -69,6 +77,7 @@ server.registerTool(
69
77
  description: 'Render a public URL or raw HTML to a PDF. The PDF is written to a temp file and its path is returned.',
70
78
  inputSchema: {
71
79
  ...common,
80
+ singlePage: z.boolean().optional().describe('One continuous page sized to the content height (no A4 pagination)'),
72
81
  pageFormat: z.enum(['Letter', 'Legal', 'Tabloid', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6']).optional(),
73
82
  landscape: z.boolean().optional(),
74
83
  printBackground: z.boolean().optional(),
@@ -87,5 +96,27 @@ server.registerTool(
87
96
  }
88
97
  );
89
98
 
99
+ server.registerTool(
100
+ 'snapforge_markdown',
101
+ {
102
+ title: 'SnapForge URL to Markdown',
103
+ description: 'Extract a clean Markdown version of a public URL or raw HTML (article extraction + HTML→Markdown). Returns the Markdown and saves a .md file.',
104
+ inputSchema: { ...common }
105
+ },
106
+ async (args) => {
107
+ try {
108
+ const { buf } = await render('/v1/markdown', args);
109
+ const file = path.join(tmpdir(), `snapforge-${Date.now()}.md`);
110
+ await writeFile(file, buf);
111
+ return { content: [
112
+ { type: 'text', text: buf.toString('utf8') },
113
+ { type: 'text', text: `Saved to ${file}` }
114
+ ] };
115
+ } catch (e) {
116
+ return { isError: true, content: [{ type: 'text', text: String(e.message || e) }] };
117
+ }
118
+ }
119
+ );
120
+
90
121
  const transport = new StdioServerTransport();
91
122
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snapforge-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for SnapForge — screenshot & HTML-to-PDF API as agent tools",
5
5
  "type": "module",
6
6
  "bin": { "snapforge-mcp": "index.js" },