imagic-mcp

imagic-mcp

About MCP server for image conversion, resizing, and merging — runs locally, no uploads

Category
访问服务器

README

Imagic MCP Server

Convert, resize, and merge images directly from Claude Desktop, Cursor, and other MCP-compatible AI assistants — locally, with no uploads. Part of ImagicSave.

Requirements

  • Node.js 18 or later (includes npm)

Installation

No clone needed. The package is distributed via npm. Configure your AI tool to run it with npx and it will be fetched automatically on first use.

Claude Desktop

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

{
  "mcpServers": {
    "imagic": {
      "command": "npx",
      "args": ["-y", "imagic-mcp"]
    }
  }
}

Restart Claude Desktop. The Imagic tools will appear automatically.

Cursor

Create or edit .cursor/mcp.json in your project (or ~/.cursor/mcp.json for global):

{
  "mcpServers": {
    "imagic": {
      "command": "npx",
      "args": ["-y", "imagic-mcp"]
    }
  }
}

Usage Examples

Once configured, just ask your AI assistant:

  • "Convert /tmp/photo.png to WebP"
  • "Resize /home/user/logo.png to a favicon"
  • "Convert and resize /tmp/banner.jpg to an Instagram square"
  • "Resize /tmp/photo.jpg to 800×600, keep aspect ratio"
  • "Merge /tmp/left.png and /tmp/right.png side by side and save to /tmp/merged.png"
  • "Stack these three images vertically with a 20px gap: /tmp/a.jpg, /tmp/b.jpg, /tmp/c.jpg"
  • "Arrange /tmp/img1.png, /tmp/img2.png, /tmp/img3.png, /tmp/img4.png in a grid"

Tool Reference

Tool Key Parameters Description
convert_image input_path, output_format, quality, output_path Convert an image to a different format
resize_image input_path, width, height, preset, lock_aspect_ratio, output_path Resize an image to custom dimensions or a named preset
convert_and_resize All parameters from both tools above Convert and resize in a single operation
merge_images input_paths, layout, gap, background, output_path Merge multiple images into one

All parameters except input_path / input_paths and output_format / output_path are optional. Output for convert/resize defaults to the same directory as the input with a new extension.

merge_images details

Parameter Type Default Description
input_paths string[] (min 2) Ordered list of absolute image paths
layout horizontal | vertical | grid horizontal How to arrange the images
gap integer ≥ 0 0 Gap in pixels between images
background hex string #ffffff Canvas/gap fill color
output_path string Absolute output path (format inferred from extension)

Layouts:

  • horizontal — images placed side by side, centered vertically
  • vertical — images stacked top to bottom, centered horizontally
  • grid — auto columns (ceil(√n)), each image centered in equal-size cells

Supported Formats

png, jpeg, gif, webp, ico

ICO encoding is built in — no extra dependencies required.

Presets

Preset Name Dimensions
instagram-square 1080 × 1080
instagram-portrait 1080 × 1350
instagram-landscape 1080 × 566
twitter-post 1200 × 675
twitter-header 1500 × 500
full-hd 1920 × 1080
4k 3840 × 2160
youtube-thumbnail 1280 × 720
favicon 32 × 32

Local Development & Testing

Use these steps to test the server from source before publishing to npm.

1. Install dependencies

cd mcp
npm install

2. Smoke-test the server starts

node index.js

It should block on stdin with no output — that's correct. Press Ctrl+C to exit.

3. Send a raw JSON-RPC call

Pipe a request directly to verify a tool works end-to-end:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"convert_image","arguments":{"input_path":"/tmp/test.png","output_format":"webp"}}}' \
  | node index.js

You should see a JSON response with "success": true and the output path.

4. Point Claude Desktop or Cursor at the local source

Instead of npx, use node with an absolute path in your config:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

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

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "imagic": {
      "command": "node",
      "args": ["/Users/pike6/work/project/website/imagic/mcp/index.js"]
    }
  }
}

Restart Claude Desktop (or reload the Cursor window) after editing the config. Ask your AI assistant to convert or resize an image — it will call the local file directly.

5. Test with npm link (optional)

npm link makes the imagic-mcp binary available globally from your local source, which is the closest simulation to the published npx flow:

cd mcp
npm link

Then update your config to use imagic-mcp (same as the published form):

{ "command": "imagic-mcp", "args": [] }

Run npm unlink -g imagic-mcp when you're done testing.

Privacy

Everything runs locally on your machine via stdio. Your images never leave your device and no internet connection is required for image processing.

For Repo Owners: Publishing to npm

Run once inside this directory after creating a free account at npmjs.com:

npm publish

For subsequent updates, bump the version field in package.json then run npm publish again.

Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository and create a branch from main
  2. Install dependencies: npm install
  3. Make your changes in index.js
  4. Test locally (see Local Development & Testing)
  5. Open a pull request with a clear description of what you changed and why

Good areas to contribute:

  • New resize presets
  • Additional output formats
  • Performance improvements for large batches
  • Bug fixes

Please keep pull requests focused — one feature or fix per PR. For larger changes, open an issue first to discuss the approach.

License

MIT © ImagicSave

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选