mcp-server-templated 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/README.md ADDED
@@ -0,0 +1,185 @@
1
+ # Templated MCP Server
2
+
3
+ MCP (Model Context Protocol) server for [Templated](https://templated.io) - the API for automated image, video, and PDF generation.
4
+
5
+ This server enables AI assistants like Claude to interact with your Templated account to generate images, videos, and PDFs from templates.
6
+
7
+ ## Features
8
+
9
+ - **Render Generation**: Create images (JPG, PNG, WebP), videos (MP4), and PDFs from templates
10
+ - **Template Management**: List, create, update, clone, and delete templates
11
+ - **Layer Inspection**: Get template layers to understand what can be customized
12
+ - **Asset Management**: Upload and manage images, videos, and custom fonts
13
+ - **Folder Organization**: Create and manage folders for templates
14
+
15
+ ## Installation
16
+
17
+ ### Using npx (Recommended)
18
+
19
+ ```bash
20
+ npx mcp-server-templated
21
+ ```
22
+
23
+ ### Using npm
24
+
25
+ ```bash
26
+ npm install -g mcp-server-templated
27
+ ```
28
+
29
+ ## Configuration
30
+
31
+ ### Get Your API Key
32
+
33
+ 1. Sign up at [app.templated.io](https://app.templated.io)
34
+ 2. Go to your [API Key page](https://app.templated.io/api-key)
35
+ 3. Copy your API key
36
+
37
+ ### Claude Desktop
38
+
39
+ Add to your Claude Desktop configuration file:
40
+
41
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\
42
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "templated": {
48
+ "command": "npx",
49
+ "args": ["mcp-server-templated"],
50
+ "env": {
51
+ "TEMPLATED_API_KEY": "your-api-key-here"
52
+ }
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ### Cursor IDE
59
+
60
+ Add to your Cursor MCP settings:
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "templated": {
66
+ "command": "npx",
67
+ "args": ["mcp-server-templated"],
68
+ "env": {
69
+ "TEMPLATED_API_KEY": "your-api-key-here"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## Available Tools
77
+
78
+ ### Render Operations
79
+
80
+ | Tool | Description |
81
+ |------|-------------|
82
+ | `create_render` | Create an image, video, or PDF from a template |
83
+ | `get_render` | Get details of a specific render |
84
+ | `list_renders` | List all renders in your account |
85
+ | `delete_render` | Delete a render |
86
+ | `merge_renders` | Merge multiple PDF renders into one |
87
+
88
+ ### Template Operations
89
+
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `list_templates` | List all templates (with search/filter) |
93
+ | `get_template` | Get template details |
94
+ | `get_template_layers` | Get all layers of a template |
95
+ | `get_template_pages` | Get pages of a multi-page template |
96
+ | `create_template` | Create a new template |
97
+ | `update_template` | Update an existing template |
98
+ | `clone_template` | Clone a template |
99
+ | `delete_template` | Delete a template |
100
+ | `list_template_renders` | List renders from a template |
101
+
102
+ ### Folder Operations
103
+
104
+ | Tool | Description |
105
+ |------|-------------|
106
+ | `list_folders` | List all folders |
107
+ | `create_folder` | Create a new folder |
108
+ | `update_folder` | Rename a folder |
109
+ | `delete_folder` | Delete a folder |
110
+
111
+ ### Asset Operations
112
+
113
+ | Tool | Description |
114
+ |------|-------------|
115
+ | `list_uploads` | List uploaded assets |
116
+ | `create_upload` | Upload a file from URL |
117
+ | `delete_upload` | Delete an upload |
118
+ | `list_fonts` | List custom fonts |
119
+ | `upload_font` | Upload a custom font |
120
+ | `delete_font` | Delete a font |
121
+
122
+ ### Account
123
+
124
+ | Tool | Description |
125
+ |------|-------------|
126
+ | `get_account` | Get account info and API usage |
127
+
128
+ ## Example Usage
129
+
130
+ Once configured, you can ask Claude to:
131
+
132
+ - "List my templates and show me what's available"
133
+ - "Create a social media post using template [ID] with the text 'Hello World'"
134
+ - "Generate a PDF certificate with the name 'John Doe'"
135
+ - "What layers does template [ID] have?"
136
+ - "Clone my Instagram template and name it 'Instagram Post v2'"
137
+
138
+ ### Creating a Render
139
+
140
+ ```
141
+ "Create a render using template abc-123 with these changes:
142
+ - Set the 'title' layer text to 'Welcome!'
143
+ - Set the 'photo' layer image to https://example.com/photo.jpg
144
+ - Output as PNG with transparent background"
145
+ ```
146
+
147
+ Claude will use the `create_render` tool with:
148
+ ```json
149
+ {
150
+ "template": "abc-123",
151
+ "format": "png",
152
+ "transparent": true,
153
+ "layers": {
154
+ "title": { "text": "Welcome!" },
155
+ "photo": { "image_url": "https://example.com/photo.jpg" }
156
+ }
157
+ }
158
+ ```
159
+
160
+ ## Development
161
+
162
+ ```bash
163
+ # Clone the repository
164
+ git clone https://github.com/templated-io/mcp-server-templated.git
165
+ cd mcp-server-templated
166
+
167
+ # Install dependencies
168
+ npm install
169
+
170
+ # Build
171
+ npm run build
172
+
173
+ # Run locally
174
+ TEMPLATED_API_KEY=your-key node dist/index.js
175
+ ```
176
+
177
+ ## Resources
178
+
179
+ - [Templated Documentation](https://templated.io/docs)
180
+ - [MCP Documentation](https://modelcontextprotocol.io)
181
+ - [Template Gallery](https://templated.io/templates)
182
+
183
+ ## License
184
+
185
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,792 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ // API Configuration
6
+ const API_BASE_URL = "https://api.templated.io";
7
+ // Get API key from environment
8
+ function getApiKey() {
9
+ const apiKey = process.env.TEMPLATED_API_KEY;
10
+ if (!apiKey) {
11
+ throw new Error("TEMPLATED_API_KEY environment variable is required");
12
+ }
13
+ return apiKey;
14
+ }
15
+ // API request helper
16
+ async function apiRequest(method, path, body, queryParams) {
17
+ const apiKey = getApiKey();
18
+ let url = `${API_BASE_URL}${path}`;
19
+ if (queryParams && Object.keys(queryParams).length > 0) {
20
+ const params = new URLSearchParams(queryParams);
21
+ url += `?${params.toString()}`;
22
+ }
23
+ const options = {
24
+ method,
25
+ headers: {
26
+ "Authorization": `Bearer ${apiKey}`,
27
+ "Content-Type": "application/json",
28
+ },
29
+ };
30
+ if (body && (method === "POST" || method === "PUT" || method === "PATCH")) {
31
+ options.body = JSON.stringify(body);
32
+ }
33
+ const response = await fetch(url, options);
34
+ if (!response.ok) {
35
+ const errorText = await response.text();
36
+ throw new Error(`API error (${response.status}): ${errorText}`);
37
+ }
38
+ // Handle empty responses
39
+ const text = await response.text();
40
+ if (!text) {
41
+ return { success: true };
42
+ }
43
+ return JSON.parse(text);
44
+ }
45
+ // =============================================================================
46
+ // TOOL DEFINITIONS
47
+ // =============================================================================
48
+ const tools = [
49
+ // ---------------------------------------------------------------------------
50
+ // RENDER TOOLS
51
+ // ---------------------------------------------------------------------------
52
+ {
53
+ name: "create_render",
54
+ description: "Create a render (image, video, or PDF) from a template. This is the main tool for generating content. Supports formats: jpg, png, webp, pdf, mp4.",
55
+ inputSchema: {
56
+ type: "object",
57
+ properties: {
58
+ template: {
59
+ type: "string",
60
+ description: "The template ID to render",
61
+ },
62
+ format: {
63
+ type: "string",
64
+ enum: ["jpg", "png", "webp", "pdf", "mp4"],
65
+ description: "Output format. Default: jpg",
66
+ },
67
+ layers: {
68
+ type: "object",
69
+ description: "Layer modifications. Keys are layer names, values are objects with properties like: text, image_url, color, background, hide, etc.",
70
+ additionalProperties: {
71
+ type: "object",
72
+ },
73
+ },
74
+ transparent: {
75
+ type: "boolean",
76
+ description: "Make background transparent (PNG only)",
77
+ },
78
+ duration: {
79
+ type: "number",
80
+ description: "Video duration in milliseconds (MP4 only, max 90000)",
81
+ },
82
+ fps: {
83
+ type: "number",
84
+ description: "Frames per second (MP4 only, 1-60)",
85
+ },
86
+ flatten: {
87
+ type: "boolean",
88
+ description: "Flatten PDF for print-ready documents",
89
+ },
90
+ cmyk: {
91
+ type: "boolean",
92
+ description: "Use CMYK color mode (PDF only)",
93
+ },
94
+ width: {
95
+ type: "number",
96
+ description: "Custom width in pixels (100-5000)",
97
+ },
98
+ height: {
99
+ type: "number",
100
+ description: "Custom height in pixels (100-5000)",
101
+ },
102
+ scale: {
103
+ type: "number",
104
+ description: "Scale factor (0.1-2.0)",
105
+ },
106
+ name: {
107
+ type: "string",
108
+ description: "Custom name for the render",
109
+ },
110
+ background: {
111
+ type: "string",
112
+ description: "Background color in hex format (e.g., #FF0000)",
113
+ },
114
+ },
115
+ required: ["template"],
116
+ },
117
+ },
118
+ {
119
+ name: "get_render",
120
+ description: "Retrieve a specific render by its ID to get the status and file URL",
121
+ inputSchema: {
122
+ type: "object",
123
+ properties: {
124
+ render_id: {
125
+ type: "string",
126
+ description: "The render ID",
127
+ },
128
+ },
129
+ required: ["render_id"],
130
+ },
131
+ },
132
+ {
133
+ name: "list_renders",
134
+ description: "List all renders in the account",
135
+ inputSchema: {
136
+ type: "object",
137
+ properties: {
138
+ page: {
139
+ type: "number",
140
+ description: "Page number (default: 0)",
141
+ },
142
+ limit: {
143
+ type: "number",
144
+ description: "Results per page (default: 25)",
145
+ },
146
+ },
147
+ },
148
+ },
149
+ {
150
+ name: "delete_render",
151
+ description: "Delete a specific render",
152
+ inputSchema: {
153
+ type: "object",
154
+ properties: {
155
+ render_id: {
156
+ type: "string",
157
+ description: "The render ID to delete",
158
+ },
159
+ },
160
+ required: ["render_id"],
161
+ },
162
+ },
163
+ {
164
+ name: "merge_renders",
165
+ description: "Merge multiple PDF renders into a single PDF document",
166
+ inputSchema: {
167
+ type: "object",
168
+ properties: {
169
+ render_ids: {
170
+ type: "array",
171
+ items: { type: "string" },
172
+ description: "Array of render IDs to merge",
173
+ },
174
+ host: {
175
+ type: "boolean",
176
+ description: "If true, returns a hosted URL. If false, returns the file directly",
177
+ },
178
+ },
179
+ required: ["render_ids"],
180
+ },
181
+ },
182
+ // ---------------------------------------------------------------------------
183
+ // TEMPLATE TOOLS
184
+ // ---------------------------------------------------------------------------
185
+ {
186
+ name: "list_templates",
187
+ description: "List all templates in the account. Use this to find template IDs for rendering.",
188
+ inputSchema: {
189
+ type: "object",
190
+ properties: {
191
+ query: {
192
+ type: "string",
193
+ description: "Search query to filter templates by name",
194
+ },
195
+ page: {
196
+ type: "number",
197
+ description: "Page number (default: 0)",
198
+ },
199
+ limit: {
200
+ type: "number",
201
+ description: "Results per page (default: 25)",
202
+ },
203
+ width: {
204
+ type: "number",
205
+ description: "Filter by template width",
206
+ },
207
+ height: {
208
+ type: "number",
209
+ description: "Filter by template height",
210
+ },
211
+ tags: {
212
+ type: "string",
213
+ description: "Filter by tags (comma-separated)",
214
+ },
215
+ includeLayers: {
216
+ type: "boolean",
217
+ description: "Include layer information in response",
218
+ },
219
+ },
220
+ },
221
+ },
222
+ {
223
+ name: "get_template",
224
+ description: "Retrieve a specific template by ID",
225
+ inputSchema: {
226
+ type: "object",
227
+ properties: {
228
+ template_id: {
229
+ type: "string",
230
+ description: "The template ID",
231
+ },
232
+ },
233
+ required: ["template_id"],
234
+ },
235
+ },
236
+ {
237
+ name: "get_template_layers",
238
+ description: "Get all layers of a template. Use this to understand what layers can be modified when creating a render.",
239
+ inputSchema: {
240
+ type: "object",
241
+ properties: {
242
+ template_id: {
243
+ type: "string",
244
+ description: "The template ID",
245
+ },
246
+ },
247
+ required: ["template_id"],
248
+ },
249
+ },
250
+ {
251
+ name: "get_template_pages",
252
+ description: "Get all pages of a multi-page template",
253
+ inputSchema: {
254
+ type: "object",
255
+ properties: {
256
+ template_id: {
257
+ type: "string",
258
+ description: "The template ID",
259
+ },
260
+ },
261
+ required: ["template_id"],
262
+ },
263
+ },
264
+ {
265
+ name: "create_template",
266
+ description: "Create a new template programmatically",
267
+ inputSchema: {
268
+ type: "object",
269
+ properties: {
270
+ name: {
271
+ type: "string",
272
+ description: "Template name",
273
+ },
274
+ width: {
275
+ type: "number",
276
+ description: "Template width in pixels",
277
+ },
278
+ height: {
279
+ type: "number",
280
+ description: "Template height in pixels",
281
+ },
282
+ layers: {
283
+ type: "array",
284
+ description: "Array of layer objects defining the template structure",
285
+ },
286
+ },
287
+ required: ["name", "width", "height"],
288
+ },
289
+ },
290
+ {
291
+ name: "update_template",
292
+ description: "Update an existing template",
293
+ inputSchema: {
294
+ type: "object",
295
+ properties: {
296
+ template_id: {
297
+ type: "string",
298
+ description: "The template ID to update",
299
+ },
300
+ name: {
301
+ type: "string",
302
+ description: "New template name",
303
+ },
304
+ description: {
305
+ type: "string",
306
+ description: "New template description",
307
+ },
308
+ width: {
309
+ type: "number",
310
+ description: "New width in pixels",
311
+ },
312
+ height: {
313
+ type: "number",
314
+ description: "New height in pixels",
315
+ },
316
+ layers: {
317
+ type: "array",
318
+ description: "Updated layer definitions",
319
+ },
320
+ replaceLayers: {
321
+ type: "boolean",
322
+ description: "If true, replaces all layers. If false, merges with existing",
323
+ },
324
+ },
325
+ required: ["template_id"],
326
+ },
327
+ },
328
+ {
329
+ name: "clone_template",
330
+ description: "Create a copy of an existing template",
331
+ inputSchema: {
332
+ type: "object",
333
+ properties: {
334
+ template_id: {
335
+ type: "string",
336
+ description: "The template ID to clone",
337
+ },
338
+ name: {
339
+ type: "string",
340
+ description: "Name for the cloned template",
341
+ },
342
+ },
343
+ required: ["template_id"],
344
+ },
345
+ },
346
+ {
347
+ name: "delete_template",
348
+ description: "Delete a template",
349
+ inputSchema: {
350
+ type: "object",
351
+ properties: {
352
+ template_id: {
353
+ type: "string",
354
+ description: "The template ID to delete",
355
+ },
356
+ },
357
+ required: ["template_id"],
358
+ },
359
+ },
360
+ {
361
+ name: "list_template_renders",
362
+ description: "List all renders created from a specific template",
363
+ inputSchema: {
364
+ type: "object",
365
+ properties: {
366
+ template_id: {
367
+ type: "string",
368
+ description: "The template ID",
369
+ },
370
+ page: {
371
+ type: "number",
372
+ description: "Page number",
373
+ },
374
+ limit: {
375
+ type: "number",
376
+ description: "Results per page",
377
+ },
378
+ },
379
+ required: ["template_id"],
380
+ },
381
+ },
382
+ // ---------------------------------------------------------------------------
383
+ // FOLDER TOOLS
384
+ // ---------------------------------------------------------------------------
385
+ {
386
+ name: "list_folders",
387
+ description: "List all folders in the account",
388
+ inputSchema: {
389
+ type: "object",
390
+ properties: {
391
+ page: {
392
+ type: "number",
393
+ description: "Page number",
394
+ },
395
+ limit: {
396
+ type: "number",
397
+ description: "Results per page",
398
+ },
399
+ },
400
+ },
401
+ },
402
+ {
403
+ name: "create_folder",
404
+ description: "Create a new folder to organize templates",
405
+ inputSchema: {
406
+ type: "object",
407
+ properties: {
408
+ name: {
409
+ type: "string",
410
+ description: "Folder name",
411
+ },
412
+ },
413
+ required: ["name"],
414
+ },
415
+ },
416
+ {
417
+ name: "update_folder",
418
+ description: "Update a folder's name",
419
+ inputSchema: {
420
+ type: "object",
421
+ properties: {
422
+ folder_id: {
423
+ type: "string",
424
+ description: "The folder ID",
425
+ },
426
+ name: {
427
+ type: "string",
428
+ description: "New folder name",
429
+ },
430
+ },
431
+ required: ["folder_id", "name"],
432
+ },
433
+ },
434
+ {
435
+ name: "delete_folder",
436
+ description: "Delete a folder",
437
+ inputSchema: {
438
+ type: "object",
439
+ properties: {
440
+ folder_id: {
441
+ type: "string",
442
+ description: "The folder ID to delete",
443
+ },
444
+ },
445
+ required: ["folder_id"],
446
+ },
447
+ },
448
+ // ---------------------------------------------------------------------------
449
+ // UPLOAD TOOLS
450
+ // ---------------------------------------------------------------------------
451
+ {
452
+ name: "list_uploads",
453
+ description: "List all uploaded assets (images, videos)",
454
+ inputSchema: {
455
+ type: "object",
456
+ properties: {
457
+ page: {
458
+ type: "number",
459
+ description: "Page number",
460
+ },
461
+ limit: {
462
+ type: "number",
463
+ description: "Results per page",
464
+ },
465
+ },
466
+ },
467
+ },
468
+ {
469
+ name: "create_upload",
470
+ description: "Upload a file from a URL",
471
+ inputSchema: {
472
+ type: "object",
473
+ properties: {
474
+ url: {
475
+ type: "string",
476
+ description: "URL of the file to upload",
477
+ },
478
+ name: {
479
+ type: "string",
480
+ description: "Optional name for the upload",
481
+ },
482
+ },
483
+ required: ["url"],
484
+ },
485
+ },
486
+ {
487
+ name: "delete_upload",
488
+ description: "Delete an uploaded asset",
489
+ inputSchema: {
490
+ type: "object",
491
+ properties: {
492
+ upload_id: {
493
+ type: "string",
494
+ description: "The upload ID to delete",
495
+ },
496
+ },
497
+ required: ["upload_id"],
498
+ },
499
+ },
500
+ // ---------------------------------------------------------------------------
501
+ // FONT TOOLS
502
+ // ---------------------------------------------------------------------------
503
+ {
504
+ name: "list_fonts",
505
+ description: "List all custom fonts uploaded to the account",
506
+ inputSchema: {
507
+ type: "object",
508
+ properties: {
509
+ page: {
510
+ type: "number",
511
+ description: "Page number",
512
+ },
513
+ limit: {
514
+ type: "number",
515
+ description: "Results per page",
516
+ },
517
+ },
518
+ },
519
+ },
520
+ {
521
+ name: "upload_font",
522
+ description: "Upload a custom font from a URL",
523
+ inputSchema: {
524
+ type: "object",
525
+ properties: {
526
+ url: {
527
+ type: "string",
528
+ description: "URL of the font file (TTF, OTF, WOFF, WOFF2)",
529
+ },
530
+ name: {
531
+ type: "string",
532
+ description: "Font family name",
533
+ },
534
+ },
535
+ required: ["url", "name"],
536
+ },
537
+ },
538
+ {
539
+ name: "delete_font",
540
+ description: "Delete a custom font",
541
+ inputSchema: {
542
+ type: "object",
543
+ properties: {
544
+ font_id: {
545
+ type: "string",
546
+ description: "The font ID to delete",
547
+ },
548
+ },
549
+ required: ["font_id"],
550
+ },
551
+ },
552
+ // ---------------------------------------------------------------------------
553
+ // ACCOUNT TOOLS
554
+ // ---------------------------------------------------------------------------
555
+ {
556
+ name: "get_account",
557
+ description: "Get account information including API usage and quota",
558
+ inputSchema: {
559
+ type: "object",
560
+ properties: {},
561
+ },
562
+ },
563
+ ];
564
+ // =============================================================================
565
+ // TOOL HANDLERS
566
+ // =============================================================================
567
+ async function handleToolCall(name, args) {
568
+ switch (name) {
569
+ // RENDER HANDLERS
570
+ case "create_render": {
571
+ const body = {
572
+ template: args.template,
573
+ };
574
+ if (args.format)
575
+ body.format = args.format;
576
+ if (args.layers)
577
+ body.layers = args.layers;
578
+ if (args.transparent)
579
+ body.transparent = args.transparent;
580
+ if (args.duration)
581
+ body.duration = args.duration;
582
+ if (args.fps)
583
+ body.fps = args.fps;
584
+ if (args.flatten)
585
+ body.flatten = args.flatten;
586
+ if (args.cmyk)
587
+ body.cmyk = args.cmyk;
588
+ if (args.width)
589
+ body.width = args.width;
590
+ if (args.height)
591
+ body.height = args.height;
592
+ if (args.scale)
593
+ body.scale = args.scale;
594
+ if (args.name)
595
+ body.name = args.name;
596
+ if (args.background)
597
+ body.background = args.background;
598
+ return apiRequest("POST", "/v1/render", body);
599
+ }
600
+ case "get_render":
601
+ return apiRequest("GET", `/v1/render/${args.render_id}`);
602
+ case "list_renders": {
603
+ const params = {};
604
+ if (args.page !== undefined)
605
+ params.page = String(args.page);
606
+ if (args.limit !== undefined)
607
+ params.limit = String(args.limit);
608
+ return apiRequest("GET", "/v1/renders", undefined, params);
609
+ }
610
+ case "delete_render":
611
+ return apiRequest("DELETE", `/v1/render/${args.render_id}`);
612
+ case "merge_renders":
613
+ return apiRequest("POST", "/v1/renders/merge", {
614
+ ids: args.render_ids,
615
+ host: args.host ?? true,
616
+ });
617
+ // TEMPLATE HANDLERS
618
+ case "list_templates": {
619
+ const params = {};
620
+ if (args.query)
621
+ params.query = String(args.query);
622
+ if (args.page !== undefined)
623
+ params.page = String(args.page);
624
+ if (args.limit !== undefined)
625
+ params.limit = String(args.limit);
626
+ if (args.width !== undefined)
627
+ params.width = String(args.width);
628
+ if (args.height !== undefined)
629
+ params.height = String(args.height);
630
+ if (args.tags)
631
+ params.tags = String(args.tags);
632
+ if (args.includeLayers)
633
+ params.includeLayers = "true";
634
+ return apiRequest("GET", "/v1/templates", undefined, params);
635
+ }
636
+ case "get_template":
637
+ return apiRequest("GET", `/v1/template/${args.template_id}`);
638
+ case "get_template_layers":
639
+ return apiRequest("GET", `/v1/template/${args.template_id}/layers`);
640
+ case "get_template_pages":
641
+ return apiRequest("GET", `/v1/template/${args.template_id}/pages`);
642
+ case "create_template": {
643
+ const body = {
644
+ name: args.name,
645
+ width: args.width,
646
+ height: args.height,
647
+ };
648
+ if (args.layers)
649
+ body.layers = args.layers;
650
+ return apiRequest("POST", "/v1/template", body);
651
+ }
652
+ case "update_template": {
653
+ const body = {};
654
+ if (args.name)
655
+ body.name = args.name;
656
+ if (args.description)
657
+ body.description = args.description;
658
+ if (args.width)
659
+ body.width = args.width;
660
+ if (args.height)
661
+ body.height = args.height;
662
+ if (args.layers)
663
+ body.layers = args.layers;
664
+ const params = {};
665
+ if (args.replaceLayers)
666
+ params.replaceLayers = "true";
667
+ return apiRequest("PUT", `/v1/template/${args.template_id}`, body, params);
668
+ }
669
+ case "clone_template": {
670
+ const body = {};
671
+ if (args.name)
672
+ body.name = args.name;
673
+ return apiRequest("POST", `/v1/template/${args.template_id}/clone`, body);
674
+ }
675
+ case "delete_template":
676
+ return apiRequest("DELETE", `/v1/template/${args.template_id}`);
677
+ case "list_template_renders": {
678
+ const params = {};
679
+ if (args.page !== undefined)
680
+ params.page = String(args.page);
681
+ if (args.limit !== undefined)
682
+ params.limit = String(args.limit);
683
+ return apiRequest("GET", `/v1/template/${args.template_id}/renders`, undefined, params);
684
+ }
685
+ // FOLDER HANDLERS
686
+ case "list_folders": {
687
+ const params = {};
688
+ if (args.page !== undefined)
689
+ params.page = String(args.page);
690
+ if (args.limit !== undefined)
691
+ params.limit = String(args.limit);
692
+ return apiRequest("GET", "/v1/folders", undefined, params);
693
+ }
694
+ case "create_folder":
695
+ return apiRequest("POST", "/v1/folder", { name: args.name });
696
+ case "update_folder":
697
+ return apiRequest("PUT", `/v1/folder/${args.folder_id}`, { name: args.name });
698
+ case "delete_folder":
699
+ return apiRequest("DELETE", `/v1/folder/${args.folder_id}`);
700
+ // UPLOAD HANDLERS
701
+ case "list_uploads": {
702
+ const params = {};
703
+ if (args.page !== undefined)
704
+ params.page = String(args.page);
705
+ if (args.limit !== undefined)
706
+ params.limit = String(args.limit);
707
+ return apiRequest("GET", "/v1/uploads", undefined, params);
708
+ }
709
+ case "create_upload": {
710
+ const body = { url: args.url };
711
+ if (args.name)
712
+ body.name = args.name;
713
+ return apiRequest("POST", "/v1/upload", body);
714
+ }
715
+ case "delete_upload":
716
+ return apiRequest("DELETE", `/v1/upload/${args.upload_id}`);
717
+ // FONT HANDLERS
718
+ case "list_fonts": {
719
+ const params = {};
720
+ if (args.page !== undefined)
721
+ params.page = String(args.page);
722
+ if (args.limit !== undefined)
723
+ params.limit = String(args.limit);
724
+ return apiRequest("GET", "/v1/fonts", undefined, params);
725
+ }
726
+ case "upload_font":
727
+ return apiRequest("POST", "/v1/font", {
728
+ url: args.url,
729
+ name: args.name,
730
+ });
731
+ case "delete_font":
732
+ return apiRequest("DELETE", `/v1/font/${args.font_id}`);
733
+ // ACCOUNT HANDLERS
734
+ case "get_account":
735
+ return apiRequest("GET", "/v1/account");
736
+ default:
737
+ throw new Error(`Unknown tool: ${name}`);
738
+ }
739
+ }
740
+ // =============================================================================
741
+ // SERVER SETUP
742
+ // =============================================================================
743
+ const server = new Server({
744
+ name: "mcp-server-templated",
745
+ version: "1.0.0",
746
+ }, {
747
+ capabilities: {
748
+ tools: {},
749
+ },
750
+ });
751
+ // List available tools
752
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
753
+ return { tools };
754
+ });
755
+ // Handle tool calls
756
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
757
+ const { name, arguments: args } = request.params;
758
+ try {
759
+ const result = await handleToolCall(name, args);
760
+ return {
761
+ content: [
762
+ {
763
+ type: "text",
764
+ text: JSON.stringify(result, null, 2),
765
+ },
766
+ ],
767
+ };
768
+ }
769
+ catch (error) {
770
+ const errorMessage = error instanceof Error ? error.message : String(error);
771
+ return {
772
+ content: [
773
+ {
774
+ type: "text",
775
+ text: `Error: ${errorMessage}`,
776
+ },
777
+ ],
778
+ isError: true,
779
+ };
780
+ }
781
+ });
782
+ // Start the server
783
+ async function main() {
784
+ const transport = new StdioServerTransport();
785
+ await server.connect(transport);
786
+ console.error("Templated MCP server running on stdio");
787
+ }
788
+ main().catch((error) => {
789
+ console.error("Fatal error:", error);
790
+ process.exit(1);
791
+ });
792
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAE5C,oBAAoB;AACpB,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,+BAA+B;AAC/B,SAAS,SAAS;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qBAAqB;AACrB,KAAK,UAAU,UAAU,CACvB,MAAc,EACd,IAAY,EACZ,IAA8B,EAC9B,WAAoC;IAEpC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,GAAG,GAAG,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC;IACnC,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;QAChD,GAAG,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjC,CA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AAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,YAAY,EAAE;iBAC/B;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "mcp-server-templated",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Templated.io - Generate images, videos, and PDFs from templates",
5
+ "license": "MIT",
6
+ "author": "Templated <support@templated.io>",
7
+ "homepage": "https://templated.io",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/templated-io/mcp-server-templated.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/templated-io/mcp-server-templated/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "dist/index.js",
17
+ "bin": {
18
+ "mcp-server-templated": "dist/index.js"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc && chmod +x dist/index.js",
25
+ "dev": "tsc --watch",
26
+ "start": "node dist/index.js",
27
+ "prepare": "npm run build"
28
+ },
29
+ "keywords": [
30
+ "mcp",
31
+ "model-context-protocol",
32
+ "templated",
33
+ "image-generation",
34
+ "pdf-generation",
35
+ "video-generation",
36
+ "ai",
37
+ "claude"
38
+ ],
39
+ "dependencies": {
40
+ "@modelcontextprotocol/sdk": "^1.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^20.10.0",
44
+ "typescript": "^5.3.0"
45
+ },
46
+ "engines": {
47
+ "node": ">=18"
48
+ }
49
+ }