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.
- 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.
- π 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
- Node.js v20 or higher
- npm or yarn
- ngrok account (free tier works)
-
Clone the repository:
git clone https://github.com/meimakes/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)
-
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"
- 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.
| 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-
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
- β 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
- Restart the server
- Delete and re-add the MCP connection in Poke
- Check server logs for
tools/listrequest - Verify ngrok tunnel is active
- 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
- Normal behavior - Poke reconnects as needed
- If persistent, check ngrok connection:
curl https://your-url.ngrok.io/health
- Server and ngrok pause when computer sleeps
- Poke will reconnect automatically on wake
- To prevent sleep: Run
caffeinatein 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 requirednpm run build # Compiles TypeScript to dist/curl http://localhost:3000/healthExpected response:
{"status":"ok","server":"amazon-mcp-server"}curl -H "Authorization: Bearer YOUR_TOKEN" \
http://localhost:3000/sseShould maintain an open connection with heartbeats.
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
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details.
- π Issues: GitHub Issues
- π§ Contact: via GitHub
Created by @meimakes
Note: Keep your computer awake while running the server. The ngrok tunnel and SSE connections are sensitive to network interruptions.