IP

ia-programming/mcp-images

开发工具

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

21 stars 8 forks 质量 62 趋势 10MIT

## MCP-Images 正在寻找强大的图像处理服务器?MCP Server-Image 只需几行代码即可提供企业级图像处理。

概览

一个模型上下文协议(MCP)服务器,提供从URL、本地文件路径和数字数组获取和处理图像的工具。服务器内置一个名为fetch_images的工具,可以返回以base64编码字符串形式返回图像及其MIME类型。 如果您觉得这个项目有帮助并希望支持未来的项目,欢迎请我们喝杯咖啡!您的支持帮助我们继续构建创新的人工智能解决方案。 您的贡献极大地激发了我们打造智能且用户友好应用的热情。 - 从URL获取图像(http/https) - 从本地文件路径加载图像 - 大型本地图像的专用处理 - 大型图像的自动图像压缩(>1MB) - 多张图像的并行处理 - 为不同文件扩展名进行正确的MIME类型映射 - 全面的错误处理和日志记录 - Python 3.10+ - UV包管理器(推荐) 1.克隆此仓库 2.

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,提供从URL、本地文件路径和数字数组获取和处理图像的工具。服务器内置一个名为fetch_images的工具,可以返回以base64编码字符串形式返回图像及其MIME类型。

支持我们

如果您觉得这个项目有帮助并希望支持未来的项目,欢迎请我们喝杯咖啡!您的支持帮助我们继续构建创新的人工智能解决方案。

您的贡献极大地激发了我们打造智能且用户友好应用的热情。

目录

  • 特色
  • 先决条件
  • 安装
  • 运行服务器
  • 直接法
  • 配置风帆/光标
  • 可用工具
  • 使用示例
  • 调试
  • 贡献
  • 许可证

特色

  • 从URL获取图片(http/https)
  • 从本地文件路径加载图像
  • 大型本地图像的专用处理
  • 大图像自动压缩(>1MB)
  • 多图像的并行处理
  • 为不同文件扩展名进行正确的MIME类型映射
  • 全面的错误处理和日志记录

先修条件

  • Python 3.10+
  • UV包管理器(推荐)

安装

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

README

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

MCP Server - Image

A Model Context Protocol (MCP) server that provides tools for fetching and processing images from URLs, local file paths, and numpy arrays. The server includes a tool called fetch_images that returns images as base64-encoded strings along with their MIME types.

Support Us

If you find this project helpful and would like to support future projects, consider buying us a coffee! Your support helps us continue building innovative AI solutions.

Your contributions go a long way in fueling our passion for creating intelligent and user-friendly applications.

Table of Contents

Features

  • Fetch images from URLs (http/https)
  • Load images from local file paths
  • Specialized handling for large local images
  • Automatic image compression for large images (>1MB)
  • Parallel processing of multiple images
  • Proper MIME type mapping for different file extensions
  • Comprehensive error handling and logging

Prerequisites

  • Python 3.10+
  • uv package manager (recommended)

Installation

  1. Clone this repository
  2. Create and activate a virtual environment using uv:
uv venv
# On Windows:
.venv\Scripts\activate
# On Unix/MacOS:
source .venv/bin/activate
  1. Install dependencies using uv:
uv pip install -r requirements.txt

Running the Server

There are two ways to run the MCP server:

1. Direct Method

To start the MCP server directly:

uv run python mcp_image.py

2. Configure for Windsurf/Cursor

Windsurf

To add this MCP server to Windsurf:

  1. Edit the configuration file at ~/.codeium/windsurf/mcp_config.json
  2. Add the following configuration:
{
  "mcpServers": {
    "image": {
      "command": "uv",
        "args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"]
    }
  }
}

Cursor

To add this MCP server to Cursor:

  1. Open Cursor and go to Settings (Navbar → Cursor Settings)
  2. Navigate to Features → MCP Servers
  3. Click on + Add New MCP Server
  4. Enter the following configuration:
{
  "mcpServers": {
    "image": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"]
    }
  }
}

Available Tools

The server provides the following tools:

fetch_images: Fetch and process images from URLs or local file paths Parameters:

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "image": { "command": "uv", "args": ["--directory", "/path/to/mcp-image", "run", "mcp_image.py"] } } }