Skip to main content
Glama
cosjef

Keepa MCP Server

by cosjef
README.md
# Keepa MCP Server

A Model Context Protocol (MCP) server that gives Claude access to Keepa's product and sales data through a more approachable, conversational interface. It simplifies Keepa's complex, engineer-oriented design, making it easier to explore product research, sales trends, inventory signals, and competitive analytics without needing to master Keepa's native UI.

## โœจ **Core Capabilities**

### ๐Ÿ“Š **Advanced Sales Velocity & Inventory Optimization** 
- **๐Ÿš€ Sales Velocity Analysis**: Identify fast-moving products that generate cash flow (20+ units/day)
- **๐Ÿ“ˆ Inventory Turnover Intelligence**: Avoid slow movers that tie up capital (<5 units/month)
- **โš ๏ธ Stockout Risk Management**: Automated reorder alerts and quantity recommendations
- **๐Ÿ“… Seasonal Pattern Recognition**: Q4 holiday, back-to-school, and quarterly demand analytics
- **๐Ÿ’ฐ Cash Flow Optimization**: Target 20-35 day inventory levels for maximum ROI

### ๐Ÿ” **Professional Product Research & Discovery**
- **๐ŸŽฏ Advanced Product Finder**: 20+ filters including rating, price, competition, and sales volume
- **โญ Market Opportunity Scoring**: Find high-opportunity, low-competition products
- **๐Ÿ“‹ Batch Analysis**: Process up to 100 ASINs simultaneously for portfolio analysis
- **๐Ÿ’ก Integrated Analytics**: Statistics Object provides ongoing velocity data included with product lookups
- **๐Ÿ† Competition Intelligence**: Seller count analysis and market saturation scoring

### ๐Ÿ’Ž **Deal Discovery & Profit Analysis**
- **๐Ÿ’ฐ Enhanced Deal Discovery**: Find deals with 20%+ discounts and profit potential scoring
- **โšก Lightning Deal Monitoring**: Track time-sensitive deals with urgency alerts
- **๐ŸŽฏ Profit Potential Calculator**: Automated profit margin and ROI analysis
- **๐ŸŒŸ Prime-Eligible Filtering**: Focus on high-converting Prime products

### ๐Ÿข **Category & Market Intelligence**
- **๐Ÿ“Š Comprehensive Category Analysis**: Market size, competition levels, and brand concentration
- **๐ŸŽฏ Opportunity Scoring**: Algorithmic scoring of market entry opportunities (0-100%)
- **๐Ÿ“ˆ Performance Benchmarking**: Compare against top performers in any category
- **๐Ÿ’ก Strategic Recommendations**: AI-generated market entry and optimization strategies

## ๐Ÿ› ๏ธ **Available MCP Tools**

> **๐Ÿ’ฌ Natural Language Interface**: Simply ask Claude questions - no JSON or technical syntax required! Claude automatically uses these tools based on your requests.

### ๐Ÿ” **Core Product Intelligence**
1. **`keepa_product_lookup`** - Deep product analysis with included Statistics Object analytics
2. **`keepa_batch_product_lookup`** - Portfolio analysis for up to 100 ASINs simultaneously  
3. **`keepa_price_history`** - Historical pricing trends and market stability analysis

### ๐ŸŽฏ **Advanced Market Discovery**  
4. **`keepa_product_finder`** - **20+ advanced filters** for opportunity discovery
5. **`keepa_category_analysis`** - **Comprehensive market intelligence** with opportunity scoring
6. **`keepa_search_deals`** - **Enhanced deal discovery** with profit potential analysis
7. **`keepa_best_sellers`** - Category rankings and trending product identification

### ๐Ÿ“Š **Sales Velocity & Cash Flow Optimization**
8. **`keepa_sales_velocity`** - **Industry-standard velocity calculations** for inventory turnover
9. **`keepa_inventory_analysis`** - **Portfolio management** with stockout risk assessment

### ๐Ÿข **Competitive Intelligence**
10. **`keepa_seller_lookup`** - Seller performance analysis and competitive research

### ๐Ÿช™ **Token Management**
11. **`keepa_token_status`** - Check remaining API tokens and account status

## Prerequisites

1. **Keepa API Key**: Sign up at [https://keepa.com/#!api](https://keepa.com/#!api)
   - Keepa requires a paid subscription with token-based pricing
   - Different endpoints have different token costs
   - Product history calls are more expensive than basic product info

2. **Node.js**: Version 18 or higher

## Installation

1. Clone or download this repository
2. Navigate to the project directory:
   ```bash
   cd keepa_mcp
   ```

3. Install dependencies:
   ```bash
   npm install
   ```

4. Build the TypeScript code:
   ```bash
   npm run build
   ```

5. You'll configure your Keepa API key in the Claude Desktop config (next section)

## Configuration

### Environment Variables

The MCP server accepts these environment variables (configured in Claude Desktop):
- `KEEPA_API_KEY` (required): Your Keepa API key
- `KEEPA_RATE_LIMIT_DELAY` (optional): Delay between requests in milliseconds (default: 1000)
- `KEEPA_TIMEOUT` (optional): Request timeout in milliseconds (default: 30000)

### Claude Desktop Configuration

**Location**: 
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`

**Note**: If the file doesn't exist, create it. Some installations may have `config.json` instead - copy it to the correct filename:
```bash
cp ~/Library/Application\ Support/Claude/config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
```

Add to your Claude Desktop `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "keepa": {
      "command": "node",
      "args": ["/path/to/keepa_mcp/dist/index.js"],
      "env": {
        "KEEPA_API_KEY": "your_keepa_api_key_here"
      }
    }
  }
}
```

**Replace `/path/to/keepa_mcp` with your actual path and `your_keepa_api_key_here` with your Keepa API key.**

**โš ๏ธ Important**: After making any changes to your `claude_desktop_config.json` file, you must completely close Claude Desktop (Cmd+Q on macOS or Alt+F4 on Windows) and restart it for the changes to take effect.

### **Grant MCP Server Permissions**

When you first start Claude Desktop with the MCP server configured, you'll see a permission dialog. Click **"Allow"** to grant the server access as needed:

![Claude Desktop Permissions](screenshots/claude_permissions.jpg)

*You must grant these permissions for the Keepa tools to appear and function properly.*

## ๐Ÿ”ง Troubleshooting

### **If MCP tools don't appear in Claude Desktop:**

1. **Check Claude Desktop version**: Ensure you're running version 0.7.0 or later (MCP support required)
   - Click "Claude" menu โ†’ "About Claude"

2. **Verify config file location and format**:
   ```bash
   # Check if file exists
   ls -la ~/Library/Application\ Support/Claude/claude_desktop_config.json
   
   # Validate JSON format
   cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
   ```

3. **Test MCP server manually**:
   ```bash
   cd /path/to/keepa_mcp
   npm run build
   KEEPA_API_KEY=your_key_here node dist/index.js
   ```

4. **Complete restart**: Force quit Claude Desktop (Cmd+Q) and relaunch

5. **Simplified config**: Try removing other settings and use minimal config:
   ```json
   {
     "mcpServers": {
       "keepa": {
         "command": "node",
         "args": ["/full/path/to/keepa_mcp/dist/index.js"],
         "env": {
           "KEEPA_API_KEY": "your_keepa_api_key_here"
         }
       }
     }
   }
   ```

6. **Check for logs**: Look for error messages in Claude Desktop console or system logs

### **Common Issues:**
- **Wrong file path**: Ensure the path to `dist/index.js` is absolute and correct
- **Missing build**: Run `npm run build` after any code changes
- **Invalid JSON**: Use a JSON validator to check config file syntax
- **Missing API key**: Make sure `KEEPA_API_KEY` is set in the env section of your config


## ๐Ÿš€ **Usage Examples**

### **โœ… Verify MCP Server Connection**
Once you've configured everything and restarted Claude Desktop, you should see your Keepa tools available:

![Keepa Tools Available](screenshots/keepa-tools-available.jpg)

*The Keepa MCP server provides 10 powerful tools for Amazon marketplace intelligence, sales velocity analysis, and inventory management.*

If you see these tools in Claude Desktop, your MCP server is successfully connected and ready to use!

> **โœ… Verify Setup**: After configuration, ask Claude any of these questions to test your MCP server connection.

### ๐ŸŽฏ **Sales Velocity Optimization**
**Find Cash Flow Champions:**
```
"Use Keepa to find products in Electronics that sell 50+ units daily with high inventory turnover"
```

**Avoid Cash Flow Killers:**
```
"Show me slow-moving products in my category that tie up capital for 60+ days using Keepa"
```

**Portfolio Health Check:**
```
"Analyze my current inventory for stockout risks and cash flow optimization using Keepa ASINs: [your ASINs]"
```

### ๐Ÿ’Ž **Market Opportunity Discovery**
**Find High-Opportunity Niches:**
```
"Use Keepa to find low-competition products in Home & Kitchen with 4+ star ratings and 1000+ monthly sales"
```

**Category Market Intelligence:**
```
"Analyze the Pet Supplies category for market opportunities, competition levels, and profit potential using Keepa"
```

**Competition Gap Analysis:**
```
"Find products with high sales but fewer than 5 sellers in the Beauty category using Keepa"
```

### ๐Ÿ”ฅ **Deal Hunting & Profit Analysis**  
**High-Margin Deal Discovery:**
```
"Find current Amazon Lightning Deals with 30%+ discounts and high profit potential using Keepa"
```

**Prime Deal Intelligence:**
```
"Show me Prime-exclusive deals under $100 with 4+ star ratings that could be profitable using Keepa"
```

### ๐Ÿ“Š **Advanced Analytics & Forecasting**
**Seasonal Planning:**
```
"Analyze seasonal patterns for Holiday products and recommend inventory levels for Q4 using Keepa"
```

**Performance Benchmarking:**
```
"Compare my product's sales velocity against top performers in its category using Keepa ASIN: [your ASIN]"
```

**Market Trend Analysis:**
```
"Identify trending products in Electronics with accelerating sales velocity using Keepa"
```

### ๐Ÿช™ **Token Management & Monitoring**
**Check Token Status:**
```
"Check my Keepa token status"
```

**Monitor Usage:**
```
"How many Keepa tokens do I have left?"
```

---

## ๐ŸŽฏ **Example Output**

### **๐Ÿ” Product Finder Search Results**
```
Perfect! I found exactly what you're looking for. Here are the top 5 Industrial & Scientific products that meet all your criteria (4.4-5.0 star rating, 4-5 sellers, 2000+ monthly sales), sorted by highest monthly sales:

Top 5 High-Volume Products:

1. ๐Ÿ† MedPride Nitrile Exam Gloves (Large) - B00GS8VGP6
โ€ข Monthly Sales: ~30,000 units ๐Ÿ”ฅ
โ€ข Rating: 4.4-5.0 stars
โ€ข Sellers: 4 (medium competition)
โ€ข Product: Powder-free nitrile exam gloves, 100-pack

2. ๐Ÿงด Zep Industrial Sprayer Bottle - B08JSKYBKQ
โ€ข Monthly Sales: ~10,000 units
โ€ข Rating: 4.4-5.0 stars
โ€ข Sellers: 5 (medium competition)
โ€ข Product: 48oz sprayer with 30ft range, adjustable nozzle

3. ๐Ÿ’ BYASKZIV Ultrasonic Jewelry Cleaner - BOD7L961CR
โ€ข Monthly Sales: ~10,000 units
โ€ข Rating: 4.4-5.0 stars
โ€ข Sellers: 4 (medium competition)
โ€ข Product: 48KHz cleaner with dual modes, stainless steel tank

4. MedPride Nitrile Gloves (X-Large) - B00GS8VIKE
โ€ข Monthly Sales: ~10,000 units
โ€ข Rating: 4.4-5.0 stars
โ€ข Sellers: 4 (medium competition)
โ€ข Product: Powder-free nitrile exam gloves, 100-pack

5. MedPride Nitrile Gloves (Small) - B00GS8W2HC
โ€ข Monthly Sales: ~10,000 units
โ€ข Rating: 4.4-5.0 stars
โ€ข Sellers: 4 (medium competition)
โ€ข Product: Powder-free nitrile exam gloves, 100-pack

Key Insights:
โ€ข MedPride gloves dominate with the highest sales volume (30K monthly for Large size)
โ€ข Medical/safety products show strong consistent demand
โ€ข Medium competition level across all top products (4-5 sellers)
โ€ข Consumable products tend to have higher sales volumes

Would you like me to get more detailed information about any of these specific products, including price history or current pricing data?
```

### **๐Ÿ“ˆ Sales Velocity Analysis Output**
```
โœ… Electronics Portfolio Analysis Complete!

๐Ÿ“Š Portfolio Overview:
- Total Products: 25
- Average Turnover Rate: 18.5 times/year
- Portfolio Health: Excellent - High velocity, low risk

๐Ÿ“ˆ Performance Metrics:
- Average Velocity: 145.2 units/month
- Total Revenue Velocity: $2,847.33/day
- Average Days Inventory: 22 days

โš ๏ธ Risk Assessment:
- High Risk Products: 2 (8%)
- Fast Movers (โ‰ฅ30/month): 76%
- Slow Movers (<10/month): 8%

๐Ÿ’ก Strategic Recommendations:
๐Ÿš€ Strong portfolio velocity - maintain current strategy
๐ŸŸก Monitor 2 products with stockout risks
๐Ÿ“ˆ Focus marketing on accelerating trend products
๐ŸŽฏ Optimal inventory levels for maximum cash flow
```

### **๐ŸŽฏ Market Opportunity Discovery Output**
```
๐Ÿ“Š Home & Kitchen Category Analysis:

๐Ÿท๏ธ Market Overview:
- Category Size: 2.3M+ products
- Average Price: $34.67
- Competition Level: Medium
- Opportunity Score: 78%

๐Ÿ’ก Key Insights:
โ€ข Budget-friendly category with high volume potential
โ€ข Quality improvement opportunities exist (avg 3.8โ˜…)  
โ€ข 15% of products have fewer than 5 sellers
โ€ข Growing trend toward eco-friendly products

๐ŸŽฏ Top Opportunities:
1. Kitchen gadgets $15-45 price range
2. Storage solutions with premium materials  
3. Smart home integration products
4. Seasonal/holiday-themed items

๐Ÿ’ฐ Profit Potential: HIGH
๐Ÿ† Market Entry Difficulty: LOW-MEDIUM
```

### **๐Ÿช™ Token Status Check Output**
```
๐Ÿช™ Keepa API Token Status

๐Ÿ’ฐ Tokens Remaining: 247

โœ… Status: EXCELLENT - Plenty of tokens available
๐Ÿ’ก Recommendation: Use advanced analytics freely

๐Ÿ“Š Check detailed usage: https://keepa.com/#!api
โฐ Tokens refresh: According to your Keepa subscription plan
```

*These examples show the level of professional marketplace intelligence you'll receive from the Keepa MCP server.*


## ๐Ÿ“‚ **Verified Amazon Category IDs**

**โœ… 100% VALIDATED**: All 35 category IDs have been tested and verified to work with the Keepa API. Project achieved complete success with full category coverage.

### **Major Categories (US Marketplace)**
- **Electronics**: 172282 โœ…
- **Home & Kitchen**: 1055398 โœ…  
- **Industrial & Scientific**: 16310091 โœ…
- **Automotive**: 15684181 โœ…
- **Sports & Outdoors**: 3375251 โœ…
- **Tools & Home Improvement**: 228013 โœ…
- **Health & Household**: 3760901 โœ…
- **Beauty & Personal Care**: 3760911 โœ…
- **Clothing, Shoes & Jewelry**: 7141123011 โœ…
- **Toys & Games**: 165793011 โœ…
- **Pet Supplies**: 2619533011 โœ…
- **Office Products**: 1064954 โœ…
- **Baby Products**: 165796011 โœ…
- **Grocery & Gourmet Food**: 16310101 โœ…
- **Arts, Crafts & Sewing**: 2617941011 โœ…
- **Musical Instruments**: 11091801 โœ…
- **Patio, Lawn & Garden**: 2972638011 โœ…
- **Video Games**: 468642 โœ…
- **Books**: 283155 โœ…
- **Movies & TV**: 2625373011 โœ…

### **Digital & Specialized Categories**
- **Appliances**: 2619525011 โœ…
- **Apps & Games**: 2350149011 โœ…
- **Audible Books & Originals**: 18145289011 โœ…
- **CDs & Vinyl**: 5174 โœ…
- **Cell Phones & Accessories**: 2335752011 โœ…
- **Collectibles & Fine Art**: 4991425011 โœ…
- **Credit & Payment Cards**: 3561432011 โœ…
- **Digital Music**: 163856011 โœ…
- **Everything Else**: 10272111 โœ…
- **Gift Cards**: 2238192011 โœ…
- **Handmade Products**: 11260432011 โœ…
- **Kindle Store**: 133140011 โœ…
- **Luxury Stores**: 18981045011 โœ…
- **Magazine Subscriptions**: 599858 โœ…
- **Prime Video**: 2858778011 โœ…
- **Software**: 229534 โœ…
- **Video Shorts**: 9013971011 โœ…

> **๐Ÿ’ก Pro Tip**: The MCP server automatically validates category IDs and suggests alternatives if you use an invalid one.

---

## ๐ŸŒ **Multi-Marketplace Support**

**Global Intelligence Across 11 Amazon Marketplaces:**
- ๐Ÿ‡บ๐Ÿ‡ธ **United States** (amazon.com) - *Default and most comprehensive*
- ๐Ÿ‡ฌ๐Ÿ‡ง **United Kingdom** (amazon.co.uk)  
- ๐Ÿ‡ฉ๐Ÿ‡ช **Germany** (amazon.de)
- ๐Ÿ‡ซ๐Ÿ‡ท **France** (amazon.fr)
- ๐Ÿ‡ฏ๐Ÿ‡ต **Japan** (amazon.co.jp)
- ๐Ÿ‡จ๐Ÿ‡ฆ **Canada** (amazon.ca)
- ๐Ÿ‡ฎ๐Ÿ‡น **Italy** (amazon.it)
- ๐Ÿ‡ช๐Ÿ‡ธ **Spain** (amazon.es)
- ๐Ÿ‡ฎ๐Ÿ‡ณ **India** (amazon.in)
- ๐Ÿ‡ฒ๐Ÿ‡ฝ **Mexico** (amazon.com.mx)
- ๐Ÿ‡จ๐Ÿ‡ณ **China** (amazon.cn)

> **๐Ÿ’ฌ Simple Usage**: Just mention the country: *"Find deals in German Amazon using Keepa"*

---

## ๐Ÿ’ฐ **Token Usage & Cost Information**

The Keepa API operates on a token-based system where each API query consumes tokens from your account. Different endpoints consume different amounts of tokens, and your usage is tracked across all requests.

### **๐Ÿ“Š Token Usage Guidelines**
- **Product Lookup**: ~1 token (includes Statistics Object data at no additional cost)
- **Market Analysis**: ~5-15 tokens (depending on category size)
- **Deal Discovery**: ~3-8 tokens (varies by filters)
- **Velocity Analysis**: ~2-5 tokens (includes portfolio metrics)

### **๐Ÿ’ก Cost Optimization Features**
- **Statistics Object Integration**: Sales velocity and inventory analytics included with product lookups (no additional tokens required)
- **Smart Batching**: Process up to 100 ASINs in single requests to minimize token usage
- **Efficient Caching**: Built-in rate limiting and request optimization

### **โš ๏ธ IMPORTANT: Token Exhaustion Behavior**
**Critical Limitation**: When your Keepa API tokens are exhausted (โ‰ค0), the MCP server will fail and return "No products found" messages instead of meaningful data.

**What Happens:**
- โŒ **Searches return empty results** (not actual empty categories)
- โŒ **No error indicating token exhaustion** (appears as failed searches)
- โŒ **All tools appear broken** until tokens refresh

**How to Identify:**
- Use the dedicated token status tool: Ask Claude *"Check my Keepa token status"*
- Multiple categories returning "No products found" 
- Recently working searches suddenly failing
- Low token warnings in search results

**Solutions:**
- **Wait for token refresh** (daily or monthly depending on your Keepa plan)
- **Upgrade your Keepa plan** for more tokens
- **Check your usage** at [Keepa API Dashboard](https://keepa.com/#!api)

**Low Token Warning**: The server warns when you have <5 tokens remaining.


## ๐Ÿ”ง **Developer Reference**

> **๐Ÿ‘ฅ For Regular Users**: Skip this section - just ask Claude questions in natural language!
> **๐Ÿ› ๏ธ For Developers**: Technical details for integration and customization.

### **๐Ÿ› ๏ธ Development Scripts**
```bash
npm run build     # Build TypeScript to JavaScript  
npm run dev       # Development mode with auto-reload
npm start         # Start the built server
npm run lint      # Run ESLint
npm run type-check # Check TypeScript types
```

### **๐Ÿ“š Technical Documentation**
- **API Types**: See [types.ts](src/types.ts) for complete TypeScript definitions
- **MCP Tools**: See [tools.ts](src/tools.ts) for all 10 tool implementations with Zod validation
- **Analytics Engine**: See [keepa-client.ts](src/keepa-client.ts) for advanced algorithms

---

## ๐Ÿš€ **Get Started in 3 Steps**

### **1. Get Your Keepa API Key**
Sign up at [https://keepa.com/#!api](https://keepa.com/#!api)

### **2. Configure Claude Desktop**
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "keepa": {
      "command": "node",
      "args": ["/path/to/keepa_mcp/dist/index.js"],
      "env": {
        "KEEPA_API_KEY": "your_keepa_api_key_here"
      }
    }
  }
}
```

### **3. Ask Claude Smart Questions**
```
"Use Keepa to find fast-moving products in Electronics with high profit potential"
```

---

## ๐Ÿ“ž **Support & Resources**

- **๐Ÿ› ๏ธ MCP Server Issues**: [Create Issue on GitHub](https://github.com/your-repo/keepa-mcp-server)
- **๐Ÿ“š Keepa API Questions**: [Keepa Support](https://keepa.com/#!api)  
- **๐Ÿ”— MCP Protocol**: [Official MCP Documentation](https://modelcontextprotocol.io/)

---

## ๐Ÿ“„ **License**

MIT License - See [LICENSE](LICENSE) file for details.

---

**๐Ÿš€ Ready to transform your Amazon marketplace intelligence? Get started today!**

TDQS

A3.5/5.0

Scored across 11 tools

Disambiguation4/5

Most tools are distinct, but a few overlap in theme (e.g., sales_velocity vs. inventory_analysis, best_sellers vs. category_analysis). Descriptions help clarify, but an agent might initially misselect between these related tools.

Naming Consistency5/5

All tools follow a consistent 'keepa_' prefix with descriptive snake_case names (e.g., keepa_product_lookup, keepa_search_deals). This uniform pattern makes tool selection predictable.

Tool Count5/5

11 tools is well-scoped for a comprehensive Amazon data service like Keepa, covering lookup, search, analytics, deals, and account status without unnecessary bloat.

Completeness4/5

The set covers the core Keepa API functions: product lookup, price history, product finder, category analysis, sales velocity, inventory analysis, deals, and seller info. Missing niche features like price alert management, but the main workflows are well supported.

Maintenance

ActivityInactive
ResponsivenessUnresponsive