Amazon Cart MCP Server
Enables AI assistants to interact with your personal Amazon cart through browser automation, allowing search, add to cart, and view cart functionalities.
README
Amazon Cart MCP Server
Local MCP (Model Context Protocol) server that enables AI assistants to interact with your personal Amazon cart through browser automation. Works with Claude Desktop, Poke, and any MCP-compatible client.
⚠️ Important Disclaimer
This tool uses browser automation to interact with Amazon.com.
- Users are solely responsible for ensuring their use complies with Amazon's Terms of Service
- This project is for personal, educational use only - not for commercial automation or reselling
- Use at your own risk - the authors assume no liability for any violations of Amazon's policies or consequences thereof
- Not affiliated with Amazon - this is an independent, unofficial tool
- Amazon may change their website or policies at any time, potentially breaking functionality
- Excessive automation may result in account restrictions or bans
By using this software, you acknowledge and accept these risks.
Features
- 🔍 Search Amazon - Find products by search query
- 🛒 Add to Cart - Add items to your Amazon cart automatically
- 👀 View Cart - Check current cart contents and subtotal
- 🔐 Login Persistence - Session saved locally for seamless use
- 🌐 Secure Access - Bearer token authentication via ngrok tunnel
Quick Start
Prerequisites
- Node.js v20 or higher
- npm or yarn
- ngrok account (free tier works)
Installation
-
Clone the repository:
git clone https://github.com/madebydia/amazon-mcp-server.git cd amazon-mcp-server -
Install dependencies:
npm install -
Configure environment:
cp .env .env.local # Optional: keep your settings separateEdit
.envand set:AUTH_TOKEN- Generate a secure random token (required)HEADLESS=false- For first-time loginAMAZON_DOMAIN=amazon.com- Or your local Amazon domain
-
Build the project:
npm run build -
Start the server:
npm start -
First-time login:
- A Chrome browser window will open
- Log into your Amazon account manually
- Session will be saved in
./user-data/ - After logging in once, you can:
- Stop the server (Ctrl+C)
- Set
HEADLESS=truein.env - Restart with headless mode
-
Expose via ngrok (in a separate terminal):
npm run tunnel # Note the HTTPS URL (e.g., https://abc123.ngrok.io)
Connecting to Poke
-
Copy your ngrok URL from the terminal
-
In Poke, add a custom MCP integration:
- URL:
https://your-ngrok-url.ngrok.io/sse - API Key: Your
AUTH_TOKENfrom.env - Type: MCP Server
- URL:
-
Important: Always use the
/sseendpoint! -
Test the connection by asking Poke:
- "What tools do you have?"
- "Search Amazon for wireless mouse"
Connecting to Claude Desktop
- Build the project:
npm run build - Open Claude Desktop → Settings → Developer → Edit Config
- Add to
mcpServers:
{
"mcpServers": {
"amazon-cart": {
"command": "node",
"args": ["/absolute/path/to/amazon-mcp-server/dist/server.js"],
"env": {
"AUTH_TOKEN": "your-token-here",
"HEADLESS": "true",
"AMAZON_DOMAIN": "amazon.com"
}
}
}
}
- Restart Claude Desktop
- You should see the Amazon tools available in the tools menu (🔧)
First-time setup: Run the server once with
HEADLESS=falseto log into Amazon manually. After that, setHEADLESS=truefor Claude Desktop.
Available Tools
| Tool | Description | Parameters |
|---|---|---|
search_amazon |
Search for products on Amazon | query (required) |
add_to_cart |
Add a product to cart | query or asin, quantity (optional) |
view_cart |
View current cart contents | None |
check_login |
Verify Amazon login status | None |
Architecture
┌─────────────────┐
│ Poke.com │ (Remote AI Assistant)
│ (Cloud) │
└────────┬────────┘
│ HTTPS
↓
┌─────────────────┐
│ ngrok │ (Secure Tunnel)
│ Public HTTPS │
└────────┬────────┘
│ Local
↓
┌─────────────────┐
│ MCP Server │ (Port 3000)
│ SSE + HTTP │
└────────┬────────┘
│
↓
┌─────────────────┐
│ Puppeteer │ (Browser Automation)
│ + Chrome │
│ (Persistent │
│ Session) │
└─────────────────┘
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Server port |
AUTH_TOKEN |
required | Bearer token for authentication |
AMAZON_DOMAIN |
amazon.com |
Amazon domain (e.g., amazon.co.uk) |
HEADLESS |
false |
Run browser in headless mode |
USER_DATA_DIR |
./user-data |
Chrome user data directory |
Example .env
PORT=3000
AUTH_TOKEN=a1b2c3d4-e5f6-4789-a012-3b4c5d6e7f8a
AMAZON_DOMAIN=amazon.com
HEADLESS=false
USER_DATA_DIR=./user-data
Security
⚠️ Important Security Considerations
-
AUTH_TOKEN Protection
- Never commit
.envto Git (already in.gitignore) - Use a cryptographically secure random token
- Generate with:
openssl rand -hex 32
- Never commit
-
ngrok Security
- Free tier URLs are public but unguessable
- Consider ngrok's authentication features for extra security
- Upgrade to ngrok paid plan for reserved domains and IP restrictions
-
Session Data
- Login sessions stored in
./user-data/ - Contains cookies and authentication tokens
- Never share or commit this directory
- Already excluded via
.gitignore
- Login sessions stored in
-
Network Security
- Server only accepts authenticated requests
- All traffic through ngrok is HTTPS encrypted
- Local server binds to localhost only
-
Browser Automation
- Puppeteer runs with sandbox disabled (required for some systems)
- Session isolation via Chrome user data directory
- No data sent to third parties
Best Practices
- ✅ Use strong, unique AUTH_TOKEN
- ✅ Never share your ngrok URL publicly
- ✅ Regularly rotate AUTH_TOKEN
- ✅ Monitor server logs for suspicious activity
- ✅ Keep dependencies updated (
npm audit) - ✅ Use HEADLESS=true in production
- ⚠️ This is for personal use only - not production-ready for multi-user scenarios
Troubleshooting
Tools Not Showing in Poke
- Restart the server
- Delete and re-add the MCP connection in Poke
- Check server logs for
tools/listrequest - Verify ngrok tunnel is active
Items Not Added to Cart
- Verify you're logged into Amazon:
- Check the browser window (if visible)
- Or ask Poke to run
check_login
- If not logged in:
- Set
HEADLESS=false - Restart server
- Log in manually in the browser window
- Set
Connection Keeps Dropping
- Normal behavior - Poke reconnects as needed
- If persistent, check ngrok connection:
curl https://your-url.ngrok.io/health
Computer Sleep Mode
- Server and ngrok pause when computer sleeps
- Poke will reconnect automatically on wake
- To prevent sleep: Run
caffeinatein a separate terminal (macOS)
Development
Project Structure
amazon-mcp/
├── src/
│ ├── server.ts # MCP server + SSE implementation
│ ├── amazon.ts # Amazon automation logic
│ ├── browser.ts # Puppeteer browser management
│ └── types.ts # TypeScript interfaces
├── dist/ # Compiled JavaScript (gitignored)
├── user-data/ # Chrome session data (gitignored)
├── .env # Environment config (gitignored)
└── package.json
Running in Development
npm run dev # Uses ts-node, no build required
Building
npm run build # Compiles TypeScript to dist/
Testing
Health Check
curl http://localhost:3000/health
Expected response:
{"status":"ok","server":"amazon-mcp-server"}
Test SSE Connection
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://localhost:3000/sse
Should maintain an open connection with heartbeats.
Compliance Notes
This project is designed for personal, single-user use only. It is not intended for:
- ❌ Multi-tenant deployments
- ❌ Production SaaS applications
- ❌ SOC 2 Type II compliance scenarios
- ❌ HIPAA or other regulated data handling
- ❌ Commercial automation at scale
If you need enterprise-grade compliance, consider:
- Implementing proper authentication (OAuth 2.0)
- Adding audit logging
- Using encrypted storage for sessions
- Deploying to compliant infrastructure (AWS, GCP with compliance certifications)
- Implementing rate limiting and abuse prevention
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
- 🐛 Issues: GitHub Issues
- 📧 Contact: via GitHub
Author
Created by @madebydia
Note: Keep your computer awake while running the server. The ngrok tunnel and SSE connections are sensitive to network interruptions.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。