Image Scraper MCP Server

Image Scraper MCP Server

MCP server for scraping images from DuckDuckGo and Google Maps place photos without API key.

Category
访问服务器

README

Image Scraper

A Python web scraper that retrieves images for a given search query. Supports DuckDuckGo Images and Google Maps place photos — no API key required, and every result carries the credit/attribution you need to safely reuse the image.

Features

  • Three scraping scripts:
    • image_scraper_selenium.py (Selenium DuckDuckGo) — recommended; returns the real image URL plus full source attribution
    • image_scraper_maps.py (Selenium Google Maps) — place photo scraper with photographer attribution
    • image_scraper.py (BeautifulSoup DuckDuckGo) — fast fallback that only returns URL + alt text
  • MCP server (image_scraper_mcp_server.py) exposing both search_images and search_maps_images tools
  • Credit & attribution built-in — every result includes the publisher domain, source page URL, article title, and image dimensions so you can credit the image instead of just receiving a proxied redirect
  • Configurable number of images, headless mode, and error handling

Credit & Attribution

Reusing images from search results requires credit. Both scrapers are built to give you what you need:

Tool What you get for credit
search_images (DDG) source_domain, source_url, title, source_favicon_url, width, height — the real image URL, with DDG's iu/?u= redirector unwrapped
search_maps_images (Google Maps) author (the Google Maps contributor's name) and author_profile_url — the photographer's profile URL

Suggested credit format:

  • DuckDuckGo results: Image: {title or alt} — {source_domain} ({source_url}). If source_domain or source_url is missing for a result, treat that entry as low-attribution and prefer a different one.
  • Google Maps results with an author: Photo by {author} ({author_profile_url}).
  • Google Maps results with no author (official place photos): Image: {Place Name} via Google Maps or Source: Google Maps.

Installation

  1. Install Python dependencies:
uv sync
  1. Make sure you have Google Chrome installed (required for Selenium). Selenium 4+ automatically manages ChromeDriver, no manual installation needed.

Usage

Selenium DuckDuckGo (recommended)

uv run python image_scraper_selenium.py "cute cats" 5

Prints a JSON payload with attribution per image:

{
  "query": "cute kittens",
  "source": "duckduckgo",
  "count": 2,
  "images": [
    {
      "url": "https://tse3.mm.bing.net/th/id/OIP.6ytt01A4fK8ToB7he6XJegHaFD?pid=Api",
      "alt": "Cute Kittens Playing With Yarn Free Stock Photo - Public Domain Pictures",
      "title": "Cute Kittens Playing With Yarn Free Stock Photo - Public Domain Pictures",
      "source_url": "https://www.publicdomainpictures.net/en/view-image.php?image=588007&picture=cute-kittens-playing-with-yarn",
      "source_domain": "publicdomainpictures.net",
      "source_favicon_url": "https://external-content.duckduckgo.com/ip3/www.publicdomainpictures.net.ico",
      "width": 1920,
      "height": 1309,
      "ddg_proxied_url": "https://external-content.duckduckgo.com/iu/?u=..."
    }
  ]
}

The url is the real image URL (DDG's external-content.duckduckgo.com/iu/?u= redirector is unwrapped). ddg_proxied_url is kept for reference. Width and height are read from the dimensions overlay on the result tile.

When called through the MCP server, the same data is rendered as human-readable text that includes a Credit: line per result, plus the source page title and dimensions:

Found 2 images for 'cute kittens':

1. https://tse3.mm.bing.net/th/id/OIP.6ytt01A4fK8ToB7he6XJegHaFD?pid=Api
   Credit: publicdomainpictures.net (https://www.publicdomainpictures.net/en/view-image.php?image=588007&picture=cute-kittens-playing-with-yarn)
   Title: Cute Kittens Playing With Yarn Free Stock Photo - Public Domain Pictures
   Dimensions: 1920 × 1309
   Alt: Cute Kittens Playing With Yarn Free Stock Photo - Public Domain Pictures

2. https://tse1.mm.bing.net/th/id/OIP.So-qlqEv3QwuZpL4cOY-PwHaHa?pid=Api
   Credit: wallpaperaccess.com (https://wallpaperaccess.com/cute-cats-and-kittens)
   Title: Cute Cats and Kittens Wallpapers - Top Free Cute Cats and Kittens ...
   Dimensions: 2560 × 1600
   Alt: Cute Cats and Kittens Wallpapers - Top Free Cute Cats and Kittens ...

Google Maps place photos

uv run python image_scraper_maps.py "Eiffel Tower" 5
{
  "query": "Joe's Pizza NYC",
  "source": "google_maps",
  "count": 3,
  "images": [
    {
      "url": "https://lh3.googleusercontent.com/...",
      "author": "Mary van Lutsenburg Maas",
      "author_profile_url": "https://www.google.com/maps/contrib/118270766331517021243"
    }
  ]
}

By default, the scraper prefers photos with visible author attribution and falls back to the place's official photo strip when fewer attributed photos are available — so you always get num_images results if any exist. Attributed photos are returned first, then official ones fill the remaining slots. Pass require_attribution: true to disable the fallback and only get attributed photos.

BeautifulSoup DuckDuckGo (no Selenium, fast)

uv run python image_scraper.py "cute cats" 5

Lightweight fallback. Only returns the proxied image URL and the alt text — no source attribution. Use this only when you need a fast scrape and don't need to credit the result.

Specifying the number of images

All scrapers accept an optional second argument for the result count (1–50, default 5):

uv run python image_scraper_selenium.py "sports cars" 10
uv run python image_scraper_maps.py "Eiffel Tower" 8
uv run python image_scraper.py "golden retriever puppy" 5

MCP Server

image_scraper_mcp_server.py exposes two tools:

Tool Use for Returns
search_images General image search (DDG) Text output with Credit:, Title:, Dimensions:, Alt: per result
search_maps_images Place photos (Google Maps) JSON output with author and author_profile_url per photo

search_images parameters

  • query (required): Search query
  • num_images (optional, default 5, range 1–50): Number of results
  • headless (optional, default true): Run Chrome headless

search_maps_images parameters

  • query (required): Place name (e.g. "Eiffel Tower", "Joe's Pizza NYC")
  • num_images (optional, default 5, range 1–50): Number of photos
  • headless (optional, default true): Run Chrome headless
  • require_attribution (optional, default false): If true, only return photos with visible author attribution. If false (default), prefer attributed photos but fall back to the place's official photo strip when fewer attributed photos are available.

See MCP_SETUP.md for installing the server as a Docker-based MCP tool for Claude Desktop or other MCP clients.

Tests

.venv/bin/python -m unittest discover -s tests

87 tests cover both scrapers and the MCP server, with all browser interactions stubbed so they run in seconds without Chrome or network access:

  • tests/test_image_scraper_ddg.py — DDG URL decoding, dimensions parser, tile attribution, MCP text formatting
  • tests/test_image_scraper_maps.py — Google Maps review-photo extraction, fallback, MCP JSON formatting

Notes

  • DuckDuckGo is generally more scraper-friendly than Google.
  • The Selenium DuckDuckGo scraper is more reliable than the BeautifulSoup version and returns proper attribution.
  • Some images may be low resolution or thumbnails; check width and height before reuse.
  • Respect robots.txt and the terms of service of DuckDuckGo and Google Maps.
  • Reuse of copyrighted images may require permission from the publisher; the attribution fields tell you who to ask.

License

MIT License — feel free to use and modify as needed.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选