Skip to main content
Glama

MCP TemplateIO - 图像生成工具

使用 mcp-framework 构建的模型上下文协议 (MCP) 服务器,它使用 Templated.io 提供图像生成工具。

概述

此模板提供了使用自定义工具构建 MCP 服务器的起点。它包含一个示例工具,并提供有关如何添加、开发更多工具以及将其发布到 npm 的说明。此 README 将指导您完成设置、开发和部署您自己的 MCP 服务器的过程。

Related MCP server: Meme MCP Server

快速入门

# Install dependencies
npm install

# Build the project
npm run build

项目结构

mcp-templateio/
├── src/
│   ├── tools/        # MCP Tools
│   │   ├── ExampleTool.ts
│   │   └── TemplatedImageTool.ts # Image generation tool
│   └── index.ts      # Server entry point
├── package.json
└── tsconfig.json

可用工具

模板图像生成器

该工具使用 Templated.io API,根据模板、给定的文本和图像 URL 生成图像。

输入参数:

  • templateId :要使用的 Templated.io 模板的 ID

  • photoBgImageUrl :放置在“photo-bg”层的图像的 URL。

  • bgYellowImageUrl :放置在“bg-yellow”层的图像的 URL。

  • buildText :“构建”文本层的文本内容。

工具开发

示例工具结构:

import { MCPTool } from "mcp-framework";
import { z } from "zod";

interface MyToolInput {
  message: string;
}

class MyTool extends MCPTool<MyToolInput> {
  name = "my_tool";
  description = "Describes what your tool does";

  schema = {
    message: {
      type: z.string(),
      description: "Description of this input parameter",
    },
  };

  async execute(input: MyToolInput) {
    // Your tool logic here
    return `Processed: ${input.message}`;
  }
}

export default MyTool;

添加组件

该项目附带了src/tools/ExampleTool.tsTemplatedImageTool.ts中的示例工具。您可以使用 CLI 添加更多工具:

# Add a new tool
mcp add tool my-tool

# Example tools you might create:
mcp add tool data-processor
mcp add tool api-client
mcp add tool file-handler

发布到 npm

  1. 更新你的 package.json:

    • 确保name唯一并遵循 npm 命名约定

    • 设置适当的version

    • 添加descriptionauthorlicense等。

    • 检查bin指向正确的入口文件

  2. 本地构建和测试:

    npm run build
    npm link
    mcp-templateio  # Test your CLI locally
  3. 登录 npm(如有必要,请创建帐户):

    npm login
  4. 发布你的包:

    npm publish

发布后,用户可以将其添加到他们的 claude 桌面客户端(见下文)或使用 npx 运行它

与 Claude Desktop 一起使用

本地开发

将此配置添加到您的 Claude Desktop 配置文件:

MacOS~/Library/Application Support/Claude/claude_desktop_config.json Windows%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mcp-templateio": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-templateio/dist/index.js"]
    }
  }
}

发布后

在此处获取您的 API 密钥: https://app.templated.io/api-integration?template=4ae9a86b- 4ecd-44ee-aebd-7c5a49c16969

将此配置添加到您的 Claude Desktop 配置文件:

MacOS~/Library/Application Support/Claude/claude_desktop_config.json Windows%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mcp-templateio": {
      "command": "node",
      "args": [
        "C:\\Users\\alex0\\Documents\\AA_CodeAndScripts\\modelcontextprotocol\\mcp-templateio\\dist\\index.js"
      ],
      "env": {"TEMPLATED_API_KEY":"YOUR-API-KEY-HERE"}
    },
  }
}

构建和测试

  1. 更改你的工具

  2. 运行npm run build进行编译

  3. 服务器将在启动时自动加载您的工具

了解更多

F
license - not found
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Generate on-brand images from your AI agent: design, edit, and render templates over MCP.

  • A Model Context Protocol server for Wix AI tools

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Lucker631/mcp-templateio'

If you have feedback or need assistance with the MCP directory API, please join our Discord server