reference-search-mcp
reference-search-mcp
Eigenes Werkzeug: Illustratoren suchen Referenzbilder zum Zeichnen. KI-Code-Agenten lesen zuerst AGENTS.md.
Ein MCP-Server für die Referenzbildsuche für KI-Agenten: nimmt natürlichsprachige Anfragen entgegen → zerlegt sie in Schlüsselwörter → durchsucht mehrere Bildquellen parallel → dedupliziert Thumbnails → setzt sie zu einem nummerierten Rasterbild zusammen → das multimodale Modell filtert über Tool-Aufrufe (statt aus nacktem JSON-Output) → clientgesteuerte Iteration (Runden a, b, c … mit Deduplizierung über die Runden) → lädt das Vollbild anhand der ID herunter und gibt den Dateipfad zurück.
调用方 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.jsonWarum über „Tool-Aufrufe“ liefern statt als strukturiertes JSON?
Die Auswahl des Modells beim Filtern des Rasterbilds wird über Funktionsaufrufe wie select_images / reject_images / refine_search ausgedrückt:
Das Parameterschema wird vom Modellanbieter erzwungen validiert – es ist von Natur aus gültiges JSON, ohne Probleme mit Markdown-Fences, eingesprengte Prosa oder driftende Schlüsselnamen;
Mehrere Absichten werden in einem einzigen Aufruf ausgedrückt (auswählen + verwerfen + Schlüsselwörter für die nächste Runde vorschlagen);
Bei ungültigen IDs (z. B.
a99) meldet der Ausführende einen Fehler, und das Modell korrigiert sich in der nächsten Runde selbst;Analog zur äußeren MCP-Ebene: Außen nutzt die aufrufende KI uns über Tools, innen nutzen wir das Modell über Tools.
Die LLM-Ebene basiert auf pi (@earendil-works/pi-ai, MIT): vereinheitlichte Multi-Provider-API (Anthropic / OpenAI / DeepSeek / Gemini / Tongyi / Kimi / MiniMax …), automatische Anmelde-Erkennung, eingebauter Modellkatalog, Retry- und JSON-Reparatur-Werkzeuge. Es wird kein schwergewichtiges Agent-Framework eingeführt – die serverseitige LLM besteht nur aus drei abgegrenzten Funktionen (Schlagwort-Parsing / Feedback-Interpretation / Raster-Auswahl); die eigentliche Iterationsschleife steuert die aufrufende KI.
Related MCP server: mcp-universal-crawler
Schnellstart
Voraussetzung: Node ≥ 22.19.
npm install --ignore-scripts
npm run build1. LLM konfigurieren (pi-Auth, eines von beiden)
# 方式 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 /loginModellwahl (optional):
export PI_TEXT_MODEL=deepseek/deepseek-chat
export PI_VISION_MODEL=anthropic/claude-sonnet-4-5
export PI_THINKING=off # off|minimal|low|medium|highBenutzerdefinierte OpenAI-kompatible Endpunkte (Qwen-VL / GLM-4V / Ollama usw.):
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-Vision-Modell (deepseek-v4-flash-vision-exp, nicht im pi-eigenen Modellkatalog, daher eigener Endpunkt):
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_KEYAuch ohne LLM-Zugangsdaten nutzbar (Degradationsmodus): bei start/iterate keywords explizit angegeben – die automatische Analyse und Filterung entfallen, alle Kandidaten werden zurückgegeben.
2. Bildquellen konfigurieren
export PROVIDERS=ddg,bing,wikimedia # 默认;并行查询
export OPENVERSE_TOKEN=... # 启用 openverse(CC 图库)
export SERPER_API_KEY=... # 启用 serper(Google 图搜)
export SAFE_SEARCH=true3. MCP-Client anbinden
Claude Code:
{
"mcpServers": {
"reference-search": {
"command": "node",
"args": ["D:/path/to/reference-search-mcp/dist/index.js"],
"env": { "DEEPSEEK_API_KEY": "...", "ANTHROPIC_API_KEY": "..." }
}
}
}Eigener stdio-Client: node dist/index.js, Standard-MCP-Protokoll, die Tools geben JSON-Textblöcke zurück.
Zwei Modi: Dieses MCP = „ausgelagerte visuelle Fähigkeit“
Der Kern dieses MCP ist es, reinen Textmodellen ein Paar Augen zu geben: Suche, Raster und Nummerierung sind der mechanische Teil; die visuelle Auswahl (das Raster ansehen und Nummern wählen) ist die „ausgelagerte visuelle Fähigkeit“. Ob die aufrufende KI multimodal ist, entscheidet, ob der Server für sie schauen muss:
Modus | geeigneter Aufrufer | Server-Verhalten | Interaktion |
| reine Textmodelle | Textschlüsselwortanalyse + visuelle Filterung | liefert |
| multimodale Modelle | nur der mechanische Teil, ruft kein Vision-Modell (spart einen Vision-API-Aufruf) | Pfelefad + alle Kandidatennummern zurück; der Aufrufer sieht sich das Raster selbst an und wählt die IDs selbst |
| beliebig | Wenn ein Vision-Modell eingerichtet ist, wird gefiltert; wenn nicht Fallback | wie server / client |
collect akzeptiert ohnehin jede gültige ID – eine multimodale Aufrufer kann selectedIds ignorieren und selbst wählen. Auch pro Aufruf kann filter: false die globale Konfiguration übersteuern.
Tool-Kontrakt
Tool | Parameter | Rückgabe zugsammenfassung |
|
|
|
|
| nächste Runde |
|
|
|
|
| pro Runde ausgewählt/verworfen, aktuelle Schlüsselwörter, bereits gesammelt |
ID‑Regeln: Runden-Jede Buchstabe + Zellnummer. a3 = Runde 1, Zelle 3; b12 = Runde 2, Zelle 12. Alle Referenzen und Collect richten sich danach.
Konfigurationsübersicht
Variable | Standard | Bedeutung |
|
| Aktivierte Bildquellen, kommasepariert |
| — | Optionale Anmeldedaten von Bildquellen |
| 6 / 8 | 48 Zellen pro Runde; |
| 120 | Sitzungen und temporäre Raster automatisch aufräumen |
| System-Temp / | Verzeichnisse für Daten und Sammelergebnisse |
| 15000 | Abruf-Timeout |
| 3 | Maximale Runden der Tool-Schleife |
|
|
|
| automatische Wahl | LLM-Modellauswahl |
Architektur
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 stateTests und Skripte
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 # 诊断:视觉模型对最近一轮拼图的原始响应Wichtige Hinweise
Lizenz:
metadata/manifestgeben die Lizenz transparent durch (Wikimedia/Openverse bringt eine eigene mit); bei kommerziellen Materialien bitte selbst die Befugnis der Quelle prüfen.Hotlink-Schutz: Manche Sites (z. B. Etsy) verweigern Downloads durch Dritte;
collectmeldet pro ID einen Fehler; bei 403 die URL im Browser öffnen.Scrape-Schutz: Die Adapter sind mit UA, Request-Interval und Retry-Backoff angerichtet; ein Ausfall einer einzelnen Quelle verhindert nicht das Gesamtergebnis.
Degradationsmodus: Ohne LLM-Zugangsdaten nur mit abgesetzten
keywords; keine automatische Auswahl (die ganze Kandidatenliste wird zurückgegeben).
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