reference-search-mcp
reference-search-mcp
개인용 도구: 화가가 그림 참고 자료를 찾는 도구. AI 코딩 에이전트는 먼저 AGENTS.md를 읽어 주세요.
AI용 참고 이미지 검색 MCP 서버입니다. 자연어 쿼리를 받아 → 키워드로 파싱 → 여러 이미지 소스를 병렬 검색 → 썸네일 중복 제거 → 번호가 매겨진 콜라주로 구성 → 도구 호출로 멀티모달 모델이 필터링(일반 JSON 출력이 아닌) → 클라이언트 주도의 반복(a, b, c… 라운드, 라운드 간 중복 제거) → ID별로 원본 이미지를 다운로드해 파일 경로를 반환합니다.
调用方 AI (MCP 客户端)
│ image_search_start("找适合播客封面的太空插画素材")
▼
[reference-search-mcp] ┌──────────────────────┐
├─ LLM 层 (pi) NL → 关键词 (submit_keywords 工具) │ 搜索适配器(并行) │
├─ providers DDG / Bing / Wikimedia / Openverse / Serper │ ddg ─┐ │
├─ 去重 pHash(跨轮 seen 集合) │ bing ─┤ 结果合并 │
├─ 拼图 sharp 编号拼图 round-a.png(a1..aN) │ wikimedia ─┘ │
├─ 视觉筛选 pi vision 模型看拼图,调用 select_images / └──────────────────────┘
│ reject_images / refine_search 工具
▼
{ round:"a", gridPath, selectedIds:["a3","a17"], metadata:[...] }
│ image_search_iterate("不要 a3,多找像 b7 的") → round b(重复图自动剔除)
│ image_search_collect(session, ["b1","c12"]) → 本地文件路径 + manifest.json왜 결과를 '도구 호출'로 전달하고, 구조화된 JSON으로는 전달하지 않나요?
필터 모델이 콜라주에 대한 선택을 하는 방식은 select_images / reject_images / refine_search 같은 함수 호출로 표현됩니다.
파라미터 스키마는 모델 제공자가 강제로 검증하므로 원래부터 유효한 JSON이며, markdown 펜스, 산문에 끼어든 출력, 키 이름이 어긋나는 문제가 없습니다.
여러 의도를 한 번에 표현합니다(선택 + 거부 + 다음 라운드 키워드 제안).
유효하지 않은 ID(예:
a99)를 전달하면 실행기가 오류를 돌려주고 모델은 다음 라운드에서 스스로 수정합니다.MCP 바깥 계층과 같은 구조입니다. 바깥은 호출 AI가 도구를 통해 우리를 사용하고, 안쪽은 우리가 도구를 통해 모델을 사용합니다.
LLM 계층은 pi(@earendil-works/pi-ai, MIT)를 기반으로 하며, 여러 공급업체 API를 통합합니다(Anthropic / OpenAI / DeepSeek / Gemini / 通义 / Kimi / MiniMax…). 인증을 자동으로 해석하고, 모델 카탈로그를 내장하며, 재시도와 JSON 복구 도구를 포함합니다. 무거운 agent 프레임워크는 도입하지 않습니다. 서버 측 LLM은 세 개의 역할이한정된 함수(키워드 파싱 / 피드백 해석 / 콜라주 필터링)에 불과하며, 실제 반복 루프는 호출하는 AI가 주도합니다.
Related MCP server: mcp-universal-crawler
빠른 시작
요구 사항: Node ≥ 22.19.
npm install --ignore-scripts
npm run build1. LLM 설정(pi 인증, 둘 중 하나)
# 方式 A:环境变量(任意 pi 支持的提供商)
export DEEPSEEK_API_KEY=sk-... # 文本解析(便宜)
export ANTHROPIC_API_KEY=sk-ant-... # 视觉筛选
# 或 OPENAI_API_KEY / GEMINI_API_KEY / OPENROUTER_API_KEY ...
# 方式 B:pi 的登录体系(支持订阅制)
npx @earendil-works/pi-coding-agent /login # 或直接 pi /login모델 선택(선택 사항):
export PI_TEXT_MODEL=deepseek/deepseek-chat
export PI_VISION_MODEL=anthropic/claude-sonnet-4-5
export PI_THINKING=off # off|minimal|low|medium|high사용자 지정 OpenAI 호환 엔드포인트(Qwen-VL / GLM-4V / Ollama 등):
export PI_CUSTOM_PROVIDER_API=openai-completions
export PI_CUSTOM_PROVIDER_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
export PI_CUSTOM_PROVIDER_MODELS=qwen-vl-max,qwen-turbo
export PI_CUSTOM_PROVIDER_API_KEY=sk-...DeepSeek 시각 모델(deepseek-v4-flash-vision-exp는 pi 내장 모델 카탈로그에 없으므로 사용자 지정 엔드포인트를 거칩니다):
export DEEPSEEK_API_KEY=sk-...
export PI_TEXT_MODEL=deepseek/deepseek-v4-flash
export PI_VISION_MODEL=deepseek-vision/deepseek-v4-flash-vision-exp
export PI_CUSTOM_PROVIDER_ID=deepseek-vision
export PI_CUSTOM_PROVIDER_API=openai-completions
export PI_CUSTOM_PROVIDER_BASE_URL=https://api.deepseek.com
export PI_CUSTOM_PROVIDER_MODELS=deepseek-v4-flash-vision-exp
export PI_CUSTOM_PROVIDER_API_KEY_ENV=DEEPSEEK_API_KEYLLM 자격 증명이 없어도 사용 가능(폴백 모드): start/iterate 실행 시 keywords를 명시적으로 넘기면 자동 파싱과 필터링을 건너뛰고 전체 후보를 돌려줍니다.
2. 이미지 소스 설정
export PROVIDERS=ddg,bing,wikimedia # 默认;并行查询
export OPENVERSE_TOKEN=... # 启用 openverse(CC 图库)
export SERPER_API_KEY=... # 启用 serper(Google 图搜)
export SAFE_SEARCH=true3. MCP 클라이언트 연동
Claude Code:
{
"mcpServers": {
"reference-search": {
"command": "node",
"args": ["D:/path/to/reference-search-mcp/dist/index.js"],
"env": { "DEEPSEEK_API_KEY": "...", "ANTHROPIC_API_KEY": "..." }
}
}
}자체 개발한 stdio 클라이언트: node dist/index.js로 실행하는 표준 MCP 프로토콜이며, 도구가 JSON 텍스트 블록을 반환합니다.
이중 모드: 이 MCP는 '시각 능력 아웃소싱'입니다
이 MCP의 본질은 텍스트 전용 모델에 눈을 달아 주는 것입니다. 검색, 콜라주 생성, 이미지 연결은 기계적인 부분이고, 시각적 필터링(콜라주를 보고 그리드 선택)은 "아웃소싱된 시각 능력"입니다. 호출하는 쪽이 멀티모달인지에 따라 서버가 시각 판단을 대신할지가 결정됩니다.
모드 | 사용 호출자 | 서버 동작 | 반환 |
| 텍스트 전용 모델 | 텍스트로 키워드 파싱 + 시각 필터 |
|
| 멀티모달 모델 | 기계적 처리만 함. 비전 모델 무호출(비전 API 1회 절약) | 콜라주 경로와 후보ID 전체를 반환하고, 직접 눈으로 보며 선택 |
| 임의 모델 | 시각 모델을 구성하면 판별하고, 없으면 폴백 |
|
collect는 원래 모든 유효한 ID를 허용하므로, 모멀티모달 호출자는 selectedIds를 무시하고 개별적인 ID를 골라 낱개로 가질 수 있습니다. 개별 호출마다 filter: false로 전역 설정을 덮어쓸 수도 있습니다.
함수 목록
함수 | 입력 파라미터 | 반환 요약 |
|
|
|
|
| 다음 라운드 |
|
|
|
|
| 각 라운드의 선택/거부, 현재 키워드, 수집 상황 |
ID 규칙: 라운드 문자 + 그리드 인덱스입니다. a3 = 1라운드 3번째 칸, b12 = 2라운드 12번째 칸입니다. 모든 참조와 collect의 하한 이 규칙을 공유합니다.
설정 자세히 보기
변수 | 기본값 | 설명 |
|
| 사용할 이미지 소스, 쉼표로 구분 |
| — | 소스별 API 키 |
| 6 / 8 | 라운드당 48칸. |
| 120 | 세션과 임시 콜라주 자동 정리 |
| 시스템 temp / | 데이터와 생성물 위치 |
| 15000 | 가져오기 타임아웃 |
| 3 | 내부 도구 루프 최대 라운드 |
|
|
|
| 자동 선택 | LLM 모델 선택 |
구성
src/
mcp/ # MCP server(stdio)与 4 个工具注册
llm/ # pi-ai 之上的工具调用循环:parseKeywords / interpretFeedback / filterGrid
providers/ # SearchProvider 接口 + ddg/bing/wikimedia/openverse/serper 适配器,并行容错
grid/ # sharp 拼图构建(编号徽章/占位格)、pHash 去重
session/ # 会话状态机(轮次 a/b/c、seen 哈希、TTL 清理)
collect/ # 整图下载(UA/Referer/重试/校验)、manifest 生成
service.ts # 编排:search → dedupe → grid → filter → round state테스트와 스크립트
npm test # 34 个测试:单测 + 真实 MCP stdio 集成测试
npm run smoke -- --query "space nebula" --keywords "nebula,art" --collect "a1,a2" [--iterate "更多星球"]
npm run handshake -- --query "cat" --keywords "cat" # MCP stdio 握手冒烟(先 build)
npx tsx scripts/debug-pi.ts # 诊断:pi 层工具调用(DeepSeek 文本)
npx tsx scripts/debug-vision.ts # 诊断:视觉模型对最近一轮拼图的原始响应주의할 점
저작권:
metadata/manifest는 라이선스 정보을 그대로 전달하며(Wikimedia/Openverse 소스 등), 상업 소재는 반드시 출처의 이용 허락을 직접 확인하세요.핫링크 보호: Etsy 등 일부 사이트는 제3자 다운로드를 거부합니다.
collect는 ID별로 실패를 따로 보고하며, 403이 사이트르 브라우저에서 직접 열 수 있습니다.스트래핑 방지: 소스 어댑터가 UA, 요청 간격, 재시도 백오프를 두기 때문에 단일 소스 실패해도 전체에 지장을 주지 않습니다.
폴백 모드: LLM 자격 증명이 없으면
keywords를 명시해야 하며, 자동 필르가 되지 않습니다(반환 전 후보).
Available Tools
4 toolsimage_search_collectDownload the full images for chosen cell idsA
Download the full-resolution images for a list of round-qualified ids (e.g. ['a3', 'b12']) to the output directory. Returns local file paths plus a manifest with source URLs and licenses.
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | ||
| session_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It discloses the action (downloads to output directory) and the return format (local paths and manifest with URLs/licenses). It does not mention file overwriting, network requirements, or session validity, but these are minor gaps for a download tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences that are tightly written: the first states the core action, the second states the return value. No filler, and the most important information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the essential function but omits the purpose of session_id and its relation to the broader search workflow. Without annotations or an output schema, an agent may not know if session_id must come from a prior start/iterate call or whether the output directory is session-scoped. This is incomplete for a multi-step tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explains 'ids' with an example and meaning (round-qualified ids), but 'session_id' is not explained at all. Since schema description coverage is 0%, the description should have delineated both parameters; it partially compensates but leaves a critical gap on how session_id is used.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb (download), resource (full-resolution images), and target (list of ids) with an example. It clearly distinguishes from siblings (start/iterate/status) which are about session management, not downloading.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by mentioning 'round-qualified ids' and downloading, but it never explicitly says when to use this tool versus siblings or that it should follow a prior step. The workflow relationship to image_search_start/iterate/status is left to inference, with no exclusions or explicit conditions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
image_search_iterateIterate on an existing search sessionA
Give feedback referencing round-qualified ids (e.g. 'keep a3, more like b7, no photos') plus optional explicit keywords. Produces the next round (b, c, ...) with dedup against all previously shown images. The LLM interprets the feedback into keyword additions/removals via refine_search.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| filter | No | false = skip the server-side vision filter for this round | |
| criteria | No | ||
| feedback | Yes | Natural-language feedback; may reference cell ids like a3 / b12 | |
| keywords | No | Explicit keyword replacement; skips LLM feedback interpretation | |
| session_id | Yes | ||
| safe_search | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses dedup against previously shown images and that the LLM interprets feedback into keyword changes via refine_search. However, it doesn't mention side effects like session mutation, reversibility, or any potential rate limits. It covers some key behaviors but not all.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with zero waste. The primary usage is front-loaded, and the key behaviors (dedup, LLM interpretation) are clearly stated. Very efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 7 parameters, no output schema, and no annotations, the description is relatively brief. It covers core mechanics but omits details on several parameters and doesn't describe the return value or any side effects. It's adequate but not fully complete for complex usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is only 43%, so the description must compensate for undocumented parameters like count, criteria, safe_search, and session_id. It adds meaning for feedback (referencing cell ids) and keywords (explicit replacement) but does not explain the remaining parameters. The description fails to bridge the coverage gap for those.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: it iterates on an existing search session by taking feedback referencing round-qualified ids, producing the next round with dedup. It distinguishes from siblings by implying it's not for starting a new session (image_search_start) but for refinement, and the title reinforces 'existing'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives clear usage instructions: provide feedback with round-qualified ids and optionally explicit keywords. It implies when to use (with an existing session) but does not explicitly mention when not to use or name alternatives. Context from siblings suggests this is for continuation, but the description alone doesn't state exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
image_search_startStart an image search sessionA
Parse a natural-language query into keywords (unless keywords are given), search all configured image providers in parallel, dedupe, render a numbered composite grid (round 'a', cell ids a1..aN), and run a multimodal filter that returns the selected cell ids. Returns the grid file path, the selected ids, the metadata table, and the keywords actually used.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Max candidates in this round (default: grid capacity) | |
| query | Yes | Natural-language image request, e.g. 'space nebula illustrations for a podcast cover' | |
| filter | No | false = skip the server-side vision filter and return all candidates (use when the calling model is multimodal and will look at the grid itself); default follows FILTER_MODE | |
| criteria | No | Style / quality criteria for filtering, e.g. 'flat vector, no text, dark background' | |
| keywords | No | Explicit search keywords; skips LLM parsing when given | |
| safe_search | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It details the process steps, the return values (grid file path, selected ids, metadata table, keywords used), and explains special behaviors like the 'filter' parameter (false skips filter) and 'keywords' parameter (skips LLM parsing). It also notes the default for filter follows FILTER_MODE. This is transparent, though it does not mention session state persistence or file system side effects beyond returning a path.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences. The first enumerates the pipeline steps without redundancy, and the second lists the return values. It is front-loaded with the core action and contains no filler or repetitive language.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the tool's behavior, parameters, and return values. It does not explain the overall session workflow (e.g., that image_search_iterate follows), but that is arguably outside the scope of a single tool description. The return list compensates for the absent output schema. Completeness is high for the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 83%, so most parameters are described in the schema. The description adds meaningful context beyond the schema by explaining that 'count' defaults to grid capacity, 'filter=false' skips the vision filter, and 'keywords' skips LLM parsing. It also clarifies the filter default via FILTER_MODE. This enriches the parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear verb and resource: 'start an image search session.' It then describes the full pipeline (parse query, search parallel, dedupe, render grid, filter, return results). The action is specific and distinct from siblings like iterate, collect, and status, making it obvious this tool initiates the session.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not explicitly state when to use this tool versus its siblings. It does not mention 'use this to begin a session' or direct the agent to image_search_iterate for refinement. While the name implies it is the starting point, there is no explicit guidance on choosing it over alternatives or any exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
image_search_statusShow session stateB
Rounds so far, per-round selections/rejections, current keywords, and collected ids.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full responsibility for disclosing side effects. It lists what data is returned but does not explicitly state that the operation is read-only or free of side effects. The verb 'show' implies a non-mutating action, but this is not made explicit, leaving some ambiguity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that front-loads the core purpose ('show session state') and then lists all contents in a compact list. There is no superfluous information, and every item contributes to understanding the returned data.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple status tool with one parameter and no output schema, the description lists the key fields returned, which is helpful. However, it lacks an explicit read-only statement and does not mention error conditions (e.g., invalid session_id), which are important given the absence of annotations. It is adequate but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description completely ignores the only parameter, session_id, and the schema provides no description for it either. The agent gets no additional context about the format, origin, or purpose of session_id beyond its name, which is insufficient given the 0% schema description coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'show' and the resource 'session state', and then enumerates the specific contents ('rounds so far, per-round selections/rejections, current keywords, and collected ids'). This distinguishes it from sibling tools that start, iterate, or collect, as it is the only one that reports on state.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given on when to use this tool versus its siblings. It does not mention that it should be used between iterations, nor does it reference alternatives or conditions that would select it. The only hint is the name 'status', which implies a read operation, but there is no explicit context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
image_search_collect - First observed
image_search_iterate - First observed
image_search_start - First observed
image_search_status
TDQS
Scored across 4 tools
Each tool has a unique and clearly defined role: start initializes a search, iterate refines it with feedback, collect downloads selected results, and status reports the current state. No two tools overlap in purpose.
All tools follow the exact same `image_search_<verb>` pattern, with verbs that accurately describe the action (start, iterate, collect, status). The naming is uniformly styled and predictable.
Four tools is perfectly scoped for an iterative image search workflow. Each tool covers a necessary step without redundancy, making the set concise and well-balanced.
The tools cover the full lifecycle: initiating a search, refining it through feedback, collecting final results, and monitoring progress. No obvious gaps exist for the intended use case, as the start tool integrates search and multimodal filtering.
Maintenance
Related MCP Connectors
Search Google straight from your AI agent. Web results, images, videos, news, products, scholarly ar
Agent-native search engine with live web research optimized for AI agents.
- GoroOAuthai.usegoro
62 real-world tools for agents: search, scraping, social, enrichment, image, video, voice.
A design-style library for AI agents: search real styles, fetch a ready-to-apply design spec.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to search, download, and analyze Google images via SerpAPI.35 npm19ISC
- AlicenseNot gradedqualityDmaintenanceEnables AI to autonomously search, filter, and download images from the web using natural language commands, with intelligent scoring and local storage.MIT
- FlicenseAqualityBmaintenanceEnables agents to generate images through the GPT Image Playground via a browser extension, supporting task submission, status tracking, and downloading generated images with reference image support.31-
- AlicenseNot gradedqualityBmaintenanceEnables agents to perform structured shopping actions and retrieve targeted product images for visual comparison, matching, and aesthetic recommendations.MIT