Promas
Enables AI agents to automatically discover, extract, and retrieve verified high-resolution product images and product links from e-commerce sites via a universal extraction pipeline with pluggable search backends, caching, and CDN-aware upscaling.
README
Promas (Product Image Scraper)
<p align="center"> <img src="https://raw.githubusercontent.com/szqiel/promas/main/docs/assets/demo.gif" alt="Promas Demo" width="750"> </p>
<p align="center"> <a href="pyproject.toml"><img src="https://img.shields.io/badge/version-1.0.0-blue.svg" alt="Version 1.0.0"></a> <a href="https://github.com/szqiel/promas/actions/workflows/ci.yml"><img src="https://github.com/szqiel/promas/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="Dockerfile"><img src="https://img.shields.io/badge/Docker-Ready-blue.svg" alt="Docker"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python 3.10+"></a> <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-FastMCP-green.svg" alt="FastMCP"></a> </p>
Promas is an automated product image scraper and Model Context Protocol (MCP) server for AI agents.
Instead of writing fragile per-site scrapers that break whenever HTML structures change, Promas combines Pluggable Search-Driven Discovery with a Universal Semantic Extraction Pipeline and Extensible CDN-Aware Upscaling. It reliably extracts master-resolution product photography across any brand or retail site (Apple, Nike, Sony, Amazon, Target, B&H, Best Buy, eBay, Shopify stores, and arbitrary product URLs).
1. Quickstart
Option A: Install from PyPI (Recommended)
pip install promas
playwright install chromium
Run instantly from anywhere:
promas "iPhone 16 Pro"
Option B: Run with Docker (Zero local Python / Playwright setup)
# Build the Docker image
docker build -t promas .
# Run the FastMCP Server for your AI Agent
docker run -i --rm promas
# Or run the standalone CLI scraper
docker run --rm promas promas "Sony FX3"
2. Architecture & Pipeline
graph TD
User([AI Agent / CLI Request]) --> Cache{TTL Disk Cache}
Cache -- "Cache Hit (<0.1s)" --> Return([Return Verified Master Assets])
Cache -- "Cache Miss" --> SearchRouter{Pluggable Discovery}
SearchRouter -->|BRAVE_API_KEY| BraveAPI[Brave Search API]
SearchRouter -->|SERPAPI_API_KEY| SerpAPI[SerpAPI Google]
SearchRouter -->|Default: Free / Zero Keys| BrowserSearch[Stealth Browser Discovery]
BraveAPI --> Scorer[E-Commerce Candidate Scorer]
SerpAPI --> Scorer
BrowserSearch --> Scorer
Scorer --> ParallelScraper[Parallel Multi-Page Scraper]
subgraph Scraping Pipeline
ParallelScraper --> RateLimiter[Domain Rate Limiter]
RateLimiter --> Parser[Universal Extractor: Schema.org, OG, Microdata, DOM]
Parser --> CDNUpscaler[CDN Master Upscalers: Scene7, Nike, Shopify, Amazon...]
end
CDNUpscaler --> Verifier[Async HTTP Verification & pHash Dedup]
Verifier --> CacheStore[(Save to Disk Cache)]
CacheStore --> Return
3. Why Promas? (Comparison)
| Feature | Raw Scripts (BeautifulSoup, Puppeteer) |
Paid APIs (Bright Data, ScrapingBee) |
Promas |
|---|---|---|---|
| Cost | Free | $50–$500+/mo recurring | 100% Free & Open-Source (MIT) |
| Setup & Maintenance | Fragile per-site selectors; breaks on redesigns | Generic HTML responses; requires custom parsers | Search-Driven + Semantic Schemas + CDN Upscalers |
| Anti-Bot & Rate Limits | Blocked quickly by Cloudflare/Akamai | Handled in cloud | Per-Domain Rate Limiter + Stealth + Tenacity Retries |
| Image Verification | None; returns broken links & 1x1 pixels | Basic status check | Async HTTP validation + pHash perceptual dedup |
| Search Backends | Hardcoded scrapers | Custom API scrapers | Pluggable (Brave API / SerpAPI / Browser Fallback) |
| Caching | None | Extra cost | Built-in TTL Disk Cache (Sub-second repeated queries) |
| Image Quality | Usually captures low-res UI thumbnails | Raw page images only | Master CDN de-capping (up to 2500px+) |
| AI Agent Native | Manual wrapper needed | REST API only | Native FastMCP Tool Protocol + Docker support |
4. Search Backends & Configuration
Promas works 100% out of the box with zero configuration or API keys required.
How Search Discovery Works:
- Free / Default (Zero Setup): Promas uses its built-in Playwright Stealth browser engine to discover e-commerce candidates via Bing and DuckDuckGo for free.
- Brave Search API (Recommended for Production): If
BRAVE_API_KEYis set, Promas switches to official, ToS-compliant, sub-second API discovery.- Get a free key (2,000 free queries/month): Brave Search API
- SerpAPI (Alternative): If
SERPAPI_API_KEYis set, Promas queries Google Search via SerpAPI.- Get a free key (100 free queries/month): SerpAPI
Environment Variables Reference:
| Variable | Default | Description |
|---|---|---|
BRAVE_API_KEY |
None | Optional API key for Brave Search |
SERPAPI_API_KEY |
None | Optional API key for SerpAPI Google Search |
PROMAS_GLOBAL_CONCURRENCY |
3 |
Max simultaneous browser contexts |
PROMAS_PER_DOMAIN_CONCURRENCY |
1 |
Max concurrent requests per target store |
PROMAS_DOMAIN_DELAY_SECONDS |
0.5 |
Polite delay between requests to the same domain |
PROMAS_CACHE_ENABLED |
True |
Toggle disk caching (True/False) |
PROMAS_CACHE_TTL_SECONDS |
86400 (24h) |
Cache expiration time in seconds |
PROMAS_ENABLE_IMAGE_VERIFICATION |
True |
Async HTTP MIME & pixel dimension check |
PROMAS_ENABLE_PERCEPTUAL_DEDUP |
True |
pHash near-duplicate crop removal |
PROMAS_PHASH_HAMMING_THRESHOLD |
4 |
Sensitivity threshold for pHash deduplication |
5. Usage
A. Standalone CLI
Search by Product Name:
promas "iPhone 16 Pro"
Extract from a Direct URL:
promas "https://www.apple.com/iphone-16-pro/"
Filter by Specific Domain & Limit Count:
promas "Sony FX3" --max-images 5 --site bhphotovideo.com
Bypass Cache or Disable Verification:
promas "Nike Air Jordan 1" --no-cache --no-verify
B. FastMCP Server
Run the standalone MCP server:
promas-mcp
C. Agent Integration (mcp_config.json)
Native Python Installation:
{
"mcpServers": {
"promas": {
"command": "promas-mcp",
"env": {
"BRAVE_API_KEY": "optional-key-here"
}
}
}
}
Docker Container (Zero-dependency setup):
{
"mcpServers": {
"promas": {
"command": "docker",
"args": ["run", "-i", "--rm", "promas"]
}
}
}
6. Multi-Tool MCP Suite
Promas exposes dedicated granular tools to AI agents:
| Tool | Purpose | Description |
|---|---|---|
fetch_product_images |
Full Pipeline | Query string or URL -> Automated discovery -> Parallel scrape -> HTTP validation -> pHash dedup -> Master photo links. |
search_product_urls |
Discovery Only | Query string -> Fast ranking of candidate e-commerce product pages (returns URLs without scraping images). |
scrape_single_url |
Extraction Only | Specific direct URL -> Extracts title and master image assets strictly from that page. |
7. Agent System Prompt Guidelines
Add the following instructions to your AI agent's system prompt:
You have access to the `fetch_product_images` tool (Promas), which universally retrieves high-resolution product imagery and official product links from across the web.
GUIDELINES FOR USING PROMAS:
1. When asked for product images, photos, or visual references, call `fetch_product_images(query=<specific product name or direct URL>)`.
2. Do not invent or hallucinate image URLs; strictly return the verified URLs returned by Promas.
3. Render primary high-res images as markdown (e.g. ``) and provide source product links for reference.
4. If a specific store is desired by the user, you can supply `site_filter` (e.g. `site_filter="apple.com"`).
8. Output Schema
{
"status": "success",
"query": "iPhone 16 Pro",
"title": "Apple iPhone 16 Pro",
"sources_scraped": [
"https://www.target.com/p/apple-iphone-16-pro/-/A-93597960",
"https://www.amazon.com/Apple-iPhone-Version-256GB-Titanium/dp/B0DHJDPYYR",
"https://www.apple.com/shop/buy-iphone/iphone-16"
],
"images": [
"https://target.scene7.com/is/image/Target/GUEST_7c0750b4-ee18-41d4-9309-d08e41619229",
"https://target.scene7.com/is/image/Target/GUEST_4e1ce623-313f-4193-93a4-61dc0fc9da14"
],
"error_message": null
}
9. Contributing
Contributions are warmly welcomed! Adding master upscaling support for a new e-commerce platform or CDN takes less than 10 lines of code with our decorator plugin registry.
👉 See CONTRIBUTING.md for step-by-step instructions on adding a new CDN rule.
10. Testing & Quality Assurance
Promas includes unit tests for pure parsing functions, type checks, and canary integration tests:
# Run unit tests
pytest -v
# Run linting
ruff check .
# Run type checker
mypy promas/ tests/
# Run live golden canary integration tests (hits live sites)
pytest -v --run-integration
11. Legal & Ethical Use
- Public Access Only: Promas accesses exclusively publicly available web pages; it does not bypass authentication, paywalls, or private logins.
- Terms of Service: Automated access may be subject to individual site Terms of Service. Always review target domains' ToS and robot policies before scraping at scale, or supply official search API keys (
BRAVE_API_KEY/SERPAPI_API_KEY) for ToS-compliant discovery. - Image Copyright & Attribution: Promas resolves and returns direct image URLs — it does not store, rehost, or copy media files. Downstream display, storage, or commercial use of retrieved imagery is the user's responsibility.
12. License
This project is licensed under the MIT License.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。