SN

snap-n-edit/mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 78 趋势 8MIT

MCP server exposing every snapnedit AI photo-editing tool to Claude and other MCP clients. npm: @snapnedit/mcp

概览

A Model Context Protocol server that gives an AI agent the snapnedit photo-editing and design tools: remove a background, upscale, erase an object, replace a sky, compose a multi-layer design and render it to PNG/JPEG/PDF — all as MCP tools over stdio. The server runs no models locally. Every tool call is proxied to the snapnedit API through @snapnedit/sdk with your API key, so running it costs nothing but the credits the operations consume. Two environment variables are required (both read in src/index.ts; the process exits with a message if either is missing): The server speaks MCP over stdio — stdout is the transport, so diagnostics go to stderr. It is normally launched by an MCP client rather than by hand. Publishing to npm is imminent — until it lands, build from the monorepo (npm ci && npm run build) and run node packages/mcp/dist/index.js. In claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.

README

以下为原文 README 节选,完整内容请查看原文。

@snapnedit/mcp

A Model Context Protocol server that gives an AI agent the snapnedit photo-editing and design tools: remove a background, upscale, erase an object, replace a sky, compose a multi-layer design and render it to PNG/JPEG/PDF — all as MCP tools over stdio.

The server runs no models locally. Every tool call is proxied to the snapnedit API through @snapnedit/sdk with your API key, so running it costs nothing but the credits the operations consume.

Running it

Two environment variables are required (both read in src/index.ts; the process exits with a message if either is missing):

Variable Meaning
SNAPNEDIT_API_KEY Your API key (sk_live_...), created in the snapnedit dashboard. Sent as Authorization: Bearer .
SNAPNEDIT_BASE_URL Origin of the API, e.g. https://api.snapnedit.com (or http://localhost:8787 against a local stack).
SNAPNEDIT_API_KEY=sk_live_... SNAPNEDIT_BASE_URL=https://api.snapnedit.com npx snapnedit-mcp

The server speaks MCP over stdio — stdout is the transport, so diagnostics go to stderr. It is normally launched by an MCP client rather than by hand.

Publishing to npm is imminent — until it lands, build from the monorepo (npm ci && npm run build) and run node packages/mcp/dist/index.js.

Registering it

Claude Code

claude mcp add snapnedit \
  --env SNAPNEDIT_API_KEY=sk_live_... \
  --env SNAPNEDIT_BASE_URL=https://api.snapnedit.com \
  -- npx -y snapnedit-mcp

Claude Desktop

In claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "snapnedit": {
      "command": "npx",
      "args": ["-y", "snapnedit-mcp"],
      "env": {
        "SNAPNEDIT_API_KEY": "sk_live_...",
        "SNAPNEDIT_BASE_URL": "https://api.snapnedit.com"
      }
    }
  }
}

Restart Claude Desktop after editing the file. Running from a local build instead of npm looks the same with "command": "node" and "args": ["/absolute/path/to/packages/mcp/dist/index.js"].

Tools

Every image tool takes image (base64-encoded bytes, no data: prefix) and an optional mime; three of them also require a base64 mask. Each returns the edited image as an MCP image content block. Errors from the API (bad input, insufficient credits, a failed job) come back as an error result, not a crash.

Every image tool also accepts three bring your own storage arguments, so large images never have to pass through the agent’s context at all:

Argument Meaning
input_url An https URL (typically a short-lived presigned GET) the snapnedit server fetches the input from. Use it instead of image — exactly one of the two is required.
在 GitHub 查看完整 README

安装

npx -y snapnedit-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "snapnedit": { "command": "npx", "args": ["-y", "snapnedit-mcp"], "env": { "SNAPNEDIT_API_KEY": "sk_live_...", "SNAPNEDIT_BASE_URL": "https://api.snapnedit.com" } } } }