Skip to main content
Glama

一个代理会话,从头到尾

这是与运行 amazon-lyr 的代理进行的一次真实对话——没有隐藏任何步骤:

1. search_products("noise cancelling headphones", max_price=300, min_rating=4)
2. review_insights("B0X1234567")            # star spread + keyword themes
3. search_in_reviews("B0X1234567", query="broke")     # what actually breaks?
4. add_to_cart("B0X1234567", quantity=1)
5. checkout_preview()                        # totals + address + payment, nothing bought
6. place_order(confirm="PLACE_ORDER")       # only after the user said "buy it"
   ✓ order placed · #111-2223334-5556667
7. track_shipment("111-2223334-5556667")
8. initiate_return("111-2223334-5556667", reason="defective", asin_hint="…")
9. list_returns()                           # refund status confirmed

每一步都是类型化的 MCP 工具调用。购买步骤被刻意设计为难以意外触发——参见安全模型

Related MCP server: Amazon MCP Server

为什么与众不同

无需 API 密钥

通过 curl_cffi 配合 Chrome TLS 模拟,直接对接 Amazon 自身的 Web 端点——与您的浏览器使用相同的会话

完整生命周期

不仅仅是抓取:购物车变更、心愿单写入、带确认解析的结账、退货向导、取消订单

面向代理的原生错误

CAPTCHA、登出重定向和软限流以带恢复提示的类型化错误形式呈现(possibly_throttled、手动回退 URL)——绝不会静默返回垃圾数据

工作原理

browser cookies ──▶ AmazonClient (curl_cffi, captcha-aware)
                        │
                        ▼
              bs4 parsers ──▶ normalized dicts ──▶ 21 FastMCP tools
                                                   (readOnly / destructive annotations)

认证使用您自己的会话:amazon-lyr login 通过 obscura-core 从 Chrome、Brave、Firefox、Edge 或 Zen 导入 Cookie,或从显式 JSON 导出导入。读取操作需要登录令牌;购物车、订单、退货和结账还需要会话上下文 Cookie。

安装

# Persistent install — uv tool (isolated; bootstraps uv on clean systems)
curl -sSL https://raw.githubusercontent.com/ishan-parihar/amazon-lyr/main/install.sh | bash

# Zero-install run without persistence:
uvx --from git+https://github.com/ishan-parihar/amazon-lyr amazon-lyr --version

然后认证一次并启动服务:

amazon-lyr login --browser chrome            # or: --cookies-file cookies.json
amazon-lyr search "mechanical keyboard"      # shell works immediately
amazon-lyr serve                             # MCP server (stdio)
{
  "mcpServers": {
    "amazon": {
      "command": "amazon-lyr",
      "args": ["serve"]
    }
  }
}

工具(21 个)

类别

工具

搜索

search_products(部门、价格区间、最低评分筛选)

产品

get_productcompare_products(最多 5 个 ASIN)

评论

get_reviewsreview_insightssearch_in_reviews

购物车

add_to_cartview_cartupdate_cart_quantityremove_from_cart

心愿单

add_to_wishlistget_wishlist

订单

get_ordersget_order_detailstrack_shipment

退货

list_returnsinitiate_return(友好的原因代码)

购买

checkout_previewplace_order

危险区域

cancel_order

会话

get_session_status

安全模型

资金操作恰好经过两道关卡:

  1. 会话关卡——每次变更操作都需要完整的登录 Cookie(at-main + session-id/ubid-main)。只读会话在任何请求发出之前就会被拒绝。

  2. 同意关卡——place_order 除非传入精确的字面量 confirm="PLACE_ORDER",否则拒绝执行。预期流程是:为用户预览 → 用户批准 → 然后传入该字面量。cancel_orderinitiate_return 同样被标注为破坏性/非幂等操作,以便代理框架相应处理。

卡片验证(OTP / 3-D Secure)会在结账过程中被检测到,并以 needs_verification 形式报告,附带浏览器操作说明——绝不会猜测通过。

限制

诚实的上限,全部以类型化错误而非错误数据的形式呈现:

  • CAPTCHA 墙——账户区域页面比商品目录更严格;重新导入新 Cookie 或等待解除(CaptchaError 包含提示)

  • 软限流——低于 3 秒的请求节奏会静默返回空网格;怀疑受限时响应会携带 possibly_throttled: true

  • 地区价格变体——某些变体在客户端渲染价格;搜索回退到文本扫描,get_product 保持权威

  • 未经同意不自动购买——设计如此;结账要求显式的确认字面量和用户批准

开发

git clone https://github.com/ishan-parihar/amazon-lyr && cd amazon-lyr
uv sync --extra dev
uv run ruff check . && uv run pytest -q

架构说明、不变式和发布流程详见 AGENTS.md

许可证

MIT © Ishan Parihar

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables interaction with Amazon services through AI assistants, allowing users to search products, manage their cart, view order history, and place orders using natural language.
    7
    MIT
  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables scraping Amazon product details and searching for products on Amazon through natural language queries. No API keys required as it scrapes publicly available Amazon pages.
    10
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables users to search for products, retrieve details, and manage their shopping cart on Amazon through the MCP framework. It also supports viewing order history and provides a demonstration of ordering capabilities within AI interfaces.
    7
    42
    MIT

View all related MCP servers

Related MCP Connectors

  • Shopping MCP for AI agents: search, compare, Amazon buy links. Auto-register.

  • Agent-native product catalog for AI shopping agents. 296M+ products, 28 countries.

  • Amazon brand, seller, niche & buy-box intelligence inside your own Claude or ChatGPT.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ishan-parihar/amazon-lyr'

If you have feedback or need assistance with the MCP directory API, please join our Discord server