Overview
The ChatAds MCP Wrapper is a Python package that runs locally on your machine and proxies requests to the ChatAds API. Use this if your MCP client requires local stdio-based servers or you need local control over the MCP server.If your MCP client supports remote HTTP servers, consider using the Native MCP Server instead - no installation required.
Requirements
- Python 3.10+
- ChatAds API key
Installation
Quick Start
MCP Client Configuration
Add ChatAds to your MCP client’s configuration. The location varies by client:- Claude Desktop
- Other Clients
Edit your Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Option 1: Using python -m (Recommended)
Option 2: Using the chatads-mcp command
First, find where the command was installed:Benefits
- Universal compatibility - Works with any MCP client supporting stdio transport
- Local control - Runs on your machine, you control the process
- Circuit breaker - Built-in resilience for network issues
- Offline caching - Can cache responses locally
- Debug logging - Full visibility into requests
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
CHATADS_API_KEY | (required) | Your ChatAds API key |
CHATADS_API_BASE_URL | https://api.getchatads.com | Override API base URL |
CHATADS_MCP_TIMEOUT | 15 | Request timeout in seconds |
CHATADS_MCP_MAX_RETRIES | 3 | Max retry attempts |
CHATADS_MCP_BACKOFF | 0.6 | Backoff delay between retries |
CHATADS_CIRCUIT_BREAKER_THRESHOLD | 5 | Failures before circuit opens |
CHATADS_CIRCUIT_BREAKER_TIMEOUT | 60 | Seconds before retry after circuit opens |
LOGLEVEL | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
CHATADS_LOG_FORMAT | text | Log format (text or json) |
Available Tools
chatads_message_send
The main tool for fetching affiliate product recommendations.Response Format: The MCP Wrapper returns the ChatAds API response directly. Key fields:
status- Response status: “filled”, “partial_fill”, “no_offers_found”, or “internal_error”offers[]- Array of affiliate offers (snake_case, only contains filled offers)- Each offer has:
link_text,url,confidence_level
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | User message to analyze (1-5000 chars) |
ip | string | No | IPv4 address for country detection |
country | string | No | ISO country code (e.g., “US”) |
quality | string | No | ”fast”, “standard” (default), or “best” |
api_key | string | No | Override env var API key |
Features
Circuit Breaker
Prevents retry storms when the API is experiencing issues. After N consecutive failures (default: 5), the circuit breaker “opens” and fails fast for a cooldown period. States:CLOSED- Normal operationOPEN- Failing fast, not attempting requestsHALF_OPEN- Testing if service recovered
Quota Warnings
The wrapper monitors usage and warns when approaching limits:- Monthly quota < 10 requests remaining
- Daily quota >= 90% used
metadata.notes and logs.
Running Standalone
You can run the wrapper directly for testing:Development
Install from Source
Run Tests
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
CONFIGURATION_ERROR | Missing API key | Set CHATADS_API_KEY env var |
FORBIDDEN / UNAUTHORIZED | Invalid key | Verify key in dashboard |
DAILY_LIMIT_EXCEEDED | Hit daily cap | Wait or upgrade plan |
CIRCUIT_BREAKER_OPEN | Too many failures | Wait 60 seconds |
UPSTREAM_UNAVAILABLE | Network/API outage | Check API status, retry later |
| Tool not appearing | Command not found | Use full path from which chatads-mcp |
Comparison: Wrapper vs Native Server
| Feature | Python Wrapper | Native Server |
|---|---|---|
| Installation | Required | None |
| Transport | stdio (local) | HTTP (remote) |
| Updates | Manual pip upgrade | Automatic |
| Local control | Yes | No |
| Circuit breaker | Client-side | Server-side |
| Offline use | Can cache locally | No |