颜色匹配工具

ColorWizard是一个颜色匹配和图案生成的工具,用于刺绣设计和图像处理。

  • by coltonbatts
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 coltonbatts/colorwizard-mcp-server

使用说明

ColorWizard Monorepo

ColorWizard被拆分为一个带有独立MCP服务器和独立Next.js UI的monorepo。

回购布局

apps/
  mcp/   # MCP server, tools, tests, HTTP bridge for web UI
  web/   # Next.js Magpie Embroidery UI
packages/
  # reserved for future shared packages (empty for now)

硬边界

  • apps/mcp 必须 不 导入自 apps/web (或任何React/Next文件)。
  • apps/web 可以通过HTTP调用MCP功能,或者仅从下的未来共享包导入 packages/.

需求

  • Node.js 20+
  • npm 10+

快速开始

npm install
npm run dev

这将开始:

  • MCP HTTP网桥位于 http://localhost:3001
  • Next.js web用户界面位于 http://localhost:3000

脚本

根

npm run dev          # run mcp + web
npm run dev:mcp      # run MCP HTTP bridge
npm run dev:mcp:stdio# run MCP stdio server
npm run dev:web      # run Next.js app
npm run build        # build mcp + web
npm run test         # run current test suite(s)

MCP应用程序(apps/mcp)

npm run dev:http
npm run dev:stdio
npm run build
npm run test
npm run test:watch

Web应用程序(apps/web)

npm run dev
npm run build
npm run start

环境变量

Web(apps/web/.env.local)

  • NEXT_PUBLIC_DEMO_ORIGIN (默认值: http://localhost:3001)
  • NEXT_PUBLIC_BLUEPRINT_MOCK (1/0,发展行为)

MCP(apps/mcp)

  • DEMO_PORT (默认值: 3001)
  • VERSION
  • ENABLE_PERF_LOGS
  • NODE_ENV

MCP工具(服务器)

实施于 apps/mcp/src/tools 并通过暴露 apps/mcp/src/index.ts.

目前的工具包括:

  • ping
  • health
  • match_dmc
  • image_register
  • sample_color
  • analyze_image_region
  • apply_aesthetic_offset
  • generate_stitch_pattern
  • generate_blueprint
  • generate_blueprint_v1
  • generate_blueprint_v2

网络↔ MCP HTTP端点

web应用程序使用MCP HTTP桥(apps/mcp/demo/server.ts)与:

  • GET /health
  • POST /api/image-register
  • POST /api/match-dmc-batch
  • POST /api/generate-blueprint-v1

码头工人

根 Dockerfile 和 docker-compose.yml 目标 apps/mcp.

docker compose up --build

添加新的MCP工具

  1. 在中添加处理程序/类型 apps/mcp/src/tools/.
  2. 注册于 apps/mcp/src/tools/index.ts.
  3. 电汇请求处理 apps/mcp/src/index.ts 如果需要的话。
  4. 在下添加测试 apps/mcp/src/tools/__tests__/.
  5. 如果web需要,请在中公开HTTP路由 apps/mcp/demo/server.ts 并从 apps/web/lib/api/.
  6. 跑 npm run test.