Sponsored by Deepsite.site

Hachimi Image Search

Created By
Marisalice1146 months ago
hachimiagent中使用的图片搜索mcp
Content

Hachimi Image Search MCP Server

简介

Hachimi Image Search API 现已兼容MCP协议。任何支持MCP协议的智能体助手(如Claude、Cursor以及其他兼容客户端)都可以通过此服务快速接入Pexels图片搜索功能。

本服务基于 Spring AI MCP Java SDK 开发,提供了灵活的图片搜索工具。

🛠️ 工具列表

  • searchImage(query)

    • 描述:根据关键词搜索图片。
    • 输入: query (搜索关键词)
    • 输出: 默认数量的图片链接 (以逗号分隔)
  • searchImageWithCount(query, count)

    • 描述:根据关键词搜索指定数量的图片。
    • 输入: query (搜索关键词), count (图片数量, 1-20)
    • 输出: 指定数量的图片链接 (以逗号分隔)
  • searchFewImages(query)

    • 描述:快速搜索少量(3张)图片。
    • 输入: query (搜索关键词)
    • 输出: 3张图片链接 (以逗号分隔)
  • searchManyImages(query)

    • 描述:搜索较多(12张)图片。
    • 输入: query (搜索关键词)
    • 输出: 12张图片链接 (以逗号分隔)
  • searchSingleImage(query)

    • 描述:仅搜索1张图片。
    • 输入: query (搜索关键词)
    • 输出: 1张图片链接

🚀 快速开始

前提条件

  • Java 21 或更高版本
  • Pexels API Key (从 Pexels API 免费获取)

1. 安装

克隆项目到本地:

git clone https://github.com/Marisalice114/hachimi-image-search-mcp-server.git
cd hachimi-image-search-mcp-server

2. 构建

使用 Maven 打包项目:

mvn clean package

成功后,将在 target 目录下生成 hachimi-image-search-mcp-server-0.0.1-SNAPSHOT.jar 文件。

3. 使用

在您的MCP客户端(如 Cherry Studio)的MCP服务器配置中,添加以下JSON配置。

Stdio 模式 (推荐)

此模式通过标准输入/输出进行通信,配置简单。

{
  "mcpServers": {
    "hachimi-image-search-mcp-server": {
      "command": "java",
      "args": [
        "-Dspring.profiles.active=local,stdio",
        "-jar",
        "path/to/hachimi-image-search-mcp-server-0.0.1-SNAPSHOT.jar"
      ],
      "env": {
        "PEXELS_API_KEY": "YOUR_PEXELS_API_KEY"
      }
    }
  }
}

SSE (Server-Sent Events) 模式

此模式通过HTTP SSE进行通信,需要暴露端口。

{
  "mcpServers": {
    "hachimi-image-search-mcp-server": {
      "command": "java",
      "args": [
        "-Dspring.profiles.active=local,sse",
        "-jar",
        "path/to/hachimi-image-search-mcp-server-0.0.1-SNAPSHOT.jar"
      ],
      "env": {
        "PEXELS_API_KEY": "YOUR_PEXELS_API_KEY"
      },
      "mcp": {
         "port": 8080,
         "protocol": "http"
      }
    }
  }
}

重要提示:

  • path/to/ 替换为您项目中 jar 文件的 绝对路径
  • YOUR_PEXELS_API_KEY 替换为您自己的Pexels API密钥。
  • 激活 local profile 是为了加载 application-local.yml 中定义的 pexels.api-key 配置。

⚙️ 配置详解

Spring Profiles

项目通过Spring Profiles管理不同的运行环境:

  • stdio: 启用标准输入/输出通信模式。
  • sse: 启用SSE通信模式,服务会监听 8080 端口。
  • local: 加载 application-local.yml 配置文件,用于注入 PEXELS_API_KEY

在启动时,您应该组合使用 local 和您需要的通信模式,例如 local,stdiolocal,sse

环境变量

您也可以直接通过环境变量设置API密钥,而不是在JSON配置中。

export PEXELS_API_KEY="YOUR_PEXELS_API_KEY"

在这种情况下,可以移除JSON配置中的 env 部分。

Server Config

{
  "mcpServers": {
    "hachimi-image-search-mcp-server": {
      "command": "java",
      "args": [
        "-Dspring.profiles.active=local,stdio",
        "-jar",
        "path/to/hachimi-image-search-mcp-server-0.0.1-SNAPSHOT.jar"
      ],
      "env": {
        "PEXELS_API_KEY": "YOUR_PEXELS_API_KEY"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
WindsurfThe new purpose-built IDE to harness magic