{
  "markdown": "<p align=\"center\">\n  <img src=\"./assets/social-preview.png\" alt=\"amazon-in-mcp\" width=\"900\" />\n</p>\n\n<h1 align=\"center\">amazon-in-mcp</h1>\n\n<p align=\"center\">\n  An <a href=\"https://modelcontextprotocol.io\">MCP</a> server that lets your LLM shop on Amazon.in.<br/>\n  Cheapest in-stock listing. Best-value pick. Price history. No paid APIs.\n</p>\n\n<p align=\"center\">\n  <a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/badge/license-MIT-black.svg\"></a>\n  <img alt=\"Node\" src=\"https://img.shields.io/badge/node-%E2%89%A518-black.svg\">\n  <a href=\"https://github.com/justadityaraj/amazon-in-mcp/releases\"><img alt=\"Release\" src=\"https://img.shields.io/github/v/release/justadityaraj/amazon-in-mcp?color=black\"></a>\n  <img alt=\"MCP\" src=\"https://img.shields.io/badge/MCP-stdio-FF9900.svg\">\n  <a href=\"https://coderabbit.ai\"><img alt=\"CodeRabbit Reviews\" src=\"https://img.shields.io/coderabbit/prs/github/justadityaraj/amazon-in-mcp?labelColor=171717&color=FF570A&label=CodeRabbit+Reviews\"></a>\n</p>\n\n---\n\n## What it does\n\nThree tools your LLM can call against `amazon.in`:\n\n| Tool | What it returns |\n|---|---|\n| `search_amazon_in(query, max_results=5, page=1)` | Ranked listings + two convenience picks: **cheapest in stock** and **best value** (rating × log10(reviews) / √price). `page` fetches deeper result pages. |\n| `get_product(asin_or_url)` | Full product detail — price, MRP, discount, rating, reviews, stock, bullets, brand, seller, delivery |\n| `price_history_link(asin_or_url)` | A Keepa.com chart URL for the amazon.in domain. No network call. |\n\nNo API keys. No accounts. Runs locally over stdio. Direct HTML scraping with rotating user agents and retry on bot-check pages.\n\n---\n\n## Quick start\n\n**1. Install** (Claude Code):\n\n```bash\ngit clone https://github.com/justadityaraj/amazon-in-mcp.git\ncd amazon-in-mcp && npm install && npm run build\nclaude mcp add amazon-in -- node \"$PWD/dist/index.js\"\n```\n\n**2. Restart your MCP client** (Claude Code, Cursor, Claude Desktop, etc.)\n\n**3. Ask:**\n\n> *\"Find me a good 1TB external SSD on amazon.in under ₹10,000. Best value pick.\"*\n\nYour LLM will call `search_amazon_in`, rank by value, and hand back a real product with current price and a Keepa link for price history.\n\n---\n\n## What it looks like\n\nA real call to `search_amazon_in(\"wireless mouse\", max_results=3)` returns:\n\n```json\n{\n  \"query\": \"wireless mouse\",\n  \"page\": 1,\n  \"total_results\": 3,\n  \"results\": [\n    {\n      \"asin\": \"B0CQRNWJM2\",\n      \"title\": \"ZEBRONICS Blanc Slim Wireless Mouse...\",\n      \"url\": \"https://www.amazon.in/dp/B0CQRNWJM2?tag=artech-21\",\n      \"price_inr\": 423,\n      \"mrp_inr\": 799,\n      \"rating\": 4.0,\n      \"review_count\": 7801,\n      \"in_stock\": true,\n      \"delivery\": \"FREE delivery Tomorrow\",\n      \"price_history_url\": \"https://keepa.com/#!product/12-B0CQRNWJM2\"\n    }\n  ],\n  \"cheapest_in_stock\": { \"asin\": \"...\", \"price_inr\": 199, \"...\": \"...\" },\n  \"best_value\":        { \"asin\": \"...\", \"rating\": 4.3, \"...\": \"...\" }\n}\n```\n\n`get_product` adds `bullets[]`, `brand`, `seller`, `discount_percent`, `availability`.\n\n---\n\n## Configure your MCP client\n\n<details>\n<summary><b>Claude Code</b></summary>\n\n```bash\nclaude mcp add amazon-in -- node /absolute/path/to/amazon-in-mcp/dist/index.js\n```\n</details>\n\n<details>\n<summary><b>Claude Desktop</b></summary>\n\nEdit `~/Library/Application Support/Claude/claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"amazon-in\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/amazon-in-mcp/dist/index.js\"]\n    }\n  }\n}\n```\n</details>\n\n<details>\n<summary><b>Cursor / Windsurf / others</b></summary>\n\nSame JSON config as Claude Desktop. Drop it into the client's MCP settings file.\n</details>\n\n---\n\n## Configuration\n\nAll optional. Set these in the `env` block of your MCP client config; defaults preserve the original behavior.\n\n| Env var | Default | Purpose |\n|---|---|---|\n| `AMAZON_IN_AFFILIATE_TAG` | `artech-21` | Amazon Associates tag on emitted URLs. `none` / `off` / `\"\"` disables. See [funding](#how-this-project-is-funded). |\n| `AMAZON_IN_CACHE_TTL_MS` | `90000` | Lifetime of the in-memory page cache (ms). `0` disables caching. |\n| `AMAZON_IN_PROXY` | _unset_ | HTTP/HTTPS proxy URL for all requests, e.g. `http://user:pass@host:8080`. |\n\nExample — route through a proxy and shorten the cache to 30 s:\n\n```json\n{\n  \"mcpServers\": {\n    \"amazon-in\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/dist/index.js\"],\n      \"env\": {\n        \"AMAZON_IN_PROXY\": \"http://user:pass@proxy.example:8080\",\n        \"AMAZON_IN_CACHE_TTL_MS\": \"30000\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## Automatic routing (no need to say \"use the Amazon MCP\")\n\nOnce installed, the server tells your client to reach for these tools on its own. It ships MCP **server instructions** (returned in the `initialize` handshake) that instruct the model to use `search_amazon_in` / `get_product` by default for any amazon.in shopping, price, availability, or reviews question — including when you just paste an amazon.in link or an ASIN. The tool descriptions carry the same trigger keywords as a fallback for clients that read tool descriptions but not server instructions.\n\nSo you can ask \"find me a mechanical keyboard under 3000\" or paste a product link and the client routes to this server without you naming it. Note this is model-level guidance surfaced by the host (Claude Code, Claude Desktop, Cursor, …), not a hard protocol guarantee — a client that ignores server instructions and tool descriptions won't be forced to route.\n\n---\n\n## Image search\n\nThe server intentionally doesn't accept image input — keeps it provider-agnostic. Instead, paste the image into your LLM client, ask it to describe the product, and it'll call `search_amazon_in` with the right keywords automatically. Works the same in every MCP-capable client.\n\n---\n\n## How \"best value\" is scored\n\nAmong in-stock listings with at least 10 reviews:\n\n$$\n\\text{score} = \\frac{\\text{rating} \\times \\log_{10}(\\text{reviews} + 10)}{\\sqrt{\\text{price}}}\n$$\n\nThe highest score wins. `cheapest_in_stock` is just the lowest `price_inr` among in-stock items — useful when you want raw cheapness instead of balance.\n\n---\n\n## Robustness\n\n| | |\n|---|---|\n| **UA rotation** | 5 modern desktop UAs (Chrome / Safari / Firefox on Mac / Win / Linux) |\n| **Retries** | 3 attempts, exponential backoff on 5xx, 429, and bot-check pages |\n| **Bot detection** | Scans first 8 KB for known CAPTCHA / robot markers |\n| **Timeout** | 20 s per request |\n| **Caching** | Successful pages cached in memory for 90 s (per URL) to skip duplicate fetches; tune with `AMAZON_IN_CACHE_TTL_MS`, `0` disables |\n| **Proxy** | Optional — set `AMAZON_IN_PROXY` to route requests through an HTTP/HTTPS proxy when a datacenter IP is blocked |\n| **State** | None persisted. Stdio, no cookies, no session — the cache is a short-lived, in-process buffer only |\n\nExpect ~1–5% of requests to fail with a bot-check during heavy use. Wait 30–60 seconds and retry, run from a different network, or set `AMAZON_IN_PROXY`.\n\n---\n\n## How this project is funded\n\nBy default, amazon.in URLs returned by this server include the author's Amazon Associates tag (`artech-21`). If you (or your LLM) click through and buy something, the author earns a small commission. **You pay the same price.** This is the only way the project stays free, MIT, and actively maintained.\n\nOverride or disable anytime with the `AMAZON_IN_AFFILIATE_TAG` env var:\n\n| Value | Behavior |\n|---|---|\n| _unset_ | Author's tag (`artech-21`) — supports the project |\n| `yourtag-21` | Your own Amazon Associates tag |\n| `none` / `off` / `false` / `\"\"` | No tag, raw amazon.in URLs |\n\nExample — your own tag:\n\n```json\n{\n  \"mcpServers\": {\n    \"amazon-in\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/dist/index.js\"],\n      \"env\": { \"AMAZON_IN_AFFILIATE_TAG\": \"yourtag-21\" }\n    }\n  }\n}\n```\n\n---\n\n## Roadmap\n\n- [ ] Publish to npm so install becomes `npx -y amazon-in-mcp-server`\n- [ ] Optional Keepa API support (user-supplied key) for real price-history data\n- [ ] Filter helpers — `min_rating`, `min_reviews`, `under_price`\n- [ ] Smoke-test suite with cached HTML fixtures\n\n---\n\n## Development\n\n```bash\nnpm install\nnpm run dev      # tsx watch\nnpm run build    # tsc → dist/\nnpm start        # node dist/index.js\n```\n\nTest interactively with the MCP Inspector:\n\n```bash\nnpx @modelcontextprotocol/inspector node dist/index.js\n```\n\nProject layout:\n\n```\nsrc/\n  index.ts        # MCP server + 3 tool registrations\n  scraper.ts      # fetch with UA rotation, retry, bot-check, proxy, cache\n  parse.ts        # cheerio selectors for search + product pages\n  cache.ts        # in-memory TTL + LRU cache\n  constants.ts    # UAs, headers, tuning constants, affiliate/proxy/cache config\n  types.ts        # SearchResultItem, ProductDetail\n```\n\n---\n\n## Disclaimer\n\nFetches publicly accessible amazon.in pages for personal research and assistant use. Does **not** bypass authentication, paywalls, or CAPTCHAs — when Amazon serves a bot-check the tool stops and reports the error.\n\nYou are responsible for using this in line with Amazon's Terms of Service and any local laws. No warranty about uptime, accuracy, or fitness for any purpose. DOM selectors are best-effort and may break when Amazon updates its layout. PRs welcome.\n\n---\n\n## License\n\nMIT © [Aditya Raj Singh](https://adityarajsingh.com/)\n\nIssues, bug reports, and selector fixes welcome — Amazon's DOM shifts every few months, so this will break occasionally and need community help to keep current.\n<!-- by [Aditya Raj Singh](https://adityarajsingh.com/) -->\n",
  "bytes": 9589,
  "sha": "b85e50a3b488eac424c92f4012972dd2e5bde48144a8169d3102ba14aa878adb",
  "repo_slug": "justadityaraj/amazon-in-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_justadityaraj_amazon_in_mcp_se_6e7ad59f/readme"
}