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.
This tool uses browser automation to interact with Amazon.com.
By using this software, you acknowledge and accept these risks.
git clone https://github.com/meimakes/amazon-mcp-server.git
cd amazon-mcp-server
npm install
cp .env .env.local # Optional: keep your settings separate
Edit .env and set:
AUTH_TOKEN - Generate a secure random token (required)HEADLESS=false - For first-time loginAMAZON_DOMAIN=amazon.com - Or your local Amazon domainnpm run build
npm start
./user-data/HEADLESS=true in .envnpm run tunnel
# Note the HTTPS URL (e.g., https://abc123.ngrok.io)
https://your-ngrok-url.ngrok.io/sseAUTH_TOKEN from .envImportant: Always use the /sse endpoint!
npm run buildmcpServers:{
"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"
}
}
}
}
First-time setup: Run the server once with
HEADLESS=falseto log into Amazon manually. After that, setHEADLESS=truefor Claude Desktop.
| 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 |
┌─────────────────┐
│ 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) │
└─────────────────┘
| 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 |
PORT=3000
AUTH_TOKEN=a1b2c3d4-e5f6-4789-a012-3b4c5d6e7f8a
AMAZON_DOMAIN=amazon.com
HEADLESS=false
USER_DATA_DIR=./user-data
.env to Git (already in .gitignore)openssl rand -hex 32./user-data/.gitignorenpm audit)tools/list requestcheck_loginHEADLESS=falsecurl https://your-url.ngrok.io/healthcaffeinate in a separate terminal (macOS)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
npm run dev # Uses ts-node, no build required
npm run build # Compiles TypeScript to dist/
curl http://localhost:3000/health
Expected response:
{"status":"ok","server":"amazon-mcp-server"}
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://localhost:3000/sse
Should maintain an open connection with heartbeats.
This project is designed for personal, single-user use only. It is not intended for:
If you need enterprise-grade compliance, consider:
Contributions welcome! Please:
MIT License - see LICENSE file for details.
Created by @meimakes
Note: Keep your computer awake while running the server. The ngrok tunnel and SSE connections are sensitive to network interruptions.