Enables publishing the MCP server as an npm package, allowing users to easily install and use the tool.
Utilizes TypeScript for developing MCP tools, providing type safety and better developer experience.
Uses Zod for schema validation of tool inputs, ensuring proper data validation for the image generation tools.
MCP TemplateIO - Image Generation Tool
A Model Context Protocol (MCP) server built with mcp-framework that provides an image generation tool using Templated.io.
Overview
This template provides a starting point for building MCP servers with custom tools. It includes an example tool and instructions on how to add more tools, develop them, and publish them to npm. This README will guide you through the process of setting up, developing, and deploying your own MCP server.
Related MCP server: Gemini MCP Image Generation Server
Quick Start
Project Structure
Available Tools
Templated Image Generator
This tool generates an image based on a template, given text and image URLs, using the Templated.io API.
Input Parameters:
templateId: ID of the Templated.io template to usephotoBgImageUrl: URL for the image to place in the "photo-bg" layer.bgYellowImageUrl: URL for the image to place in the "bg-yellow" layer.buildText: Text content for the "build" text layer.
Tool Development
Example tool structure:
Adding Components
The project comes with an example tool in src/tools/ExampleTool.ts and the TemplatedImageTool.ts. You can add more tools using the CLI:
Publishing to npm
Update your package.json:
Ensure
nameis unique and follows npm naming conventionsSet appropriate
versionAdd
description,author,license, etc.Check
binpoints to the correct entry file
Build and test locally:
npm run build npm link mcp-templateio # Test your CLI locallyLogin to npm (create account if necessary):
npm loginPublish your package:
npm publish
After publishing, users can add it to their claude desktop client (read below) or run it with npx
Using with Claude Desktop
Local Development
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
After Publishing
GET YOUR API KEY HERE: https://app.templated.io/api-integration?template=4ae9a86b-4ecd-44ee-aebd-7c5a49c16969
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Building and Testing
Make changes to your tools
Run
npm run buildto compileThe server will automatically load your tools on startup