Skip to main content
Glama
README.md
# MCP Collector 🌐⚑

> **Real-time Model Context Protocol (MCP) Hub, AI Shopping Ingestion Engine & Lead Marketplace**  
> Connects autonomous AI shopping agents (**ChatGPT Shopping, Google Gemini, Perplexity, Zapia, Claude, and custom bots**) over HTTP/SSE and WebSockets, captures verified buyer leads through interactive catalog honeypots, and streams telemetry live to a reactive web dashboard.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Python: 3.12](https://img.shields.io/badge/Python-3.12-blue.svg)](https://www.python.org/)
[![Google Cloud Run](https://img.shields.io/badge/Google%20Cloud-Run-4285F4.svg)](https://cloud.google.com/run)
[![MCP Protocol: 2024--11--05](https://img.shields.io/badge/MCP-Protocol%20v2.x-6366f1.svg)](https://modelcontextprotocol.io/)
[![Documentation: MkDocs](https://img.shields.io/badge/Docs-Material%20for%20MkDocs-526cfe.svg)](https://squidfunk.github.io/mkdocs-material/)

---

## 🎯 Overview

**MCP Collector** serves as an open-standard gateway between external AI agents and commercial operators. Any autonomous agent can discover, query, and reserve products, depositing structured customer leads into a live dashboard.

```mermaid
flowchart TD
    subgraph AI_Ecosystem [AI Shopping & Search Engines]
        ChatGPT["ChatGPT (Shopping Research & Actions)"]
        Gemini["Google Gemini (Shopping Graph)"]
        Perplexity["Perplexity (Perplexity Shopping)"]
        Zapia["Zapia & Shopping Bots"]
        Claude["Claude Desktop & Antigravity"]
    end

    subgraph Hub [MCP Collector Hub (Google Cloud Run / Docker)]
        AI_Discovery["πŸ“„ /llms.txt & πŸ€– /robots.txt & πŸ—ΊοΈ /sitemap.xml"]
        SSE_Handler["πŸ“‘ /mcp/sse & /mcp/messages (MCP 2.x)"]
        
        subgraph Tools [Exposed MCP Tools]
            Tool_Search["search_products (H100, MacBook, Gamusinos)"]
            Tool_Reserve["reserve_product_offer (Lead Capture)"]
            Tool_Quote["request_b2b_quote (Enterprise Quotes)"]
            Tool_Ingest["submit_insight (General Ingestion)"]
        end

        DB[(Async Database: PostgreSQL / SQLite)]
        WS[WebSocket Broadcaster: /ws]
    end

    subgraph Dashboard [Operator Interface]
        UI[Live Web Dashboard & JSON Inspector]
    end

    AI_Ecosystem -->|Autodiscover| AI_Discovery
    AI_Ecosystem -->|Connect & Execute| SSE_Handler
    SSE_Handler --> Tools
    Tools -->|Save Leads| DB
    Tools -->|Instant Push| WS
    WS --> UI
```

---

## πŸ” How AI Shopping Agents Discover MCP Collector

1. πŸ“„ **Universal LLM Standard (`/llms.txt` & `/llms-full.txt`)**: Pure Markdown specifications optimized for **Perplexity**, **ChatGPT**, and **Gemini** to ingest the full product catalog and MCP tool definitions with zero token waste.
2. πŸ€– **AI-Optimized `robots.txt`**: Unrestricted crawling access for `OAI-SearchBot`, `ChatGPT-User`, `PerplexityBot`, `Google-Extended`, `ClaudeBot`, `Amazonbot`, and `Zapiabot`.
3. 🏷️ **Schema.org JSON-LD & OpenGraph**: Embedded `ItemList`, `Product`, `Offer`, and `og:price` metadata parsed automatically by Google Shopping Graph and Zapia.
4. πŸ”— **HTTP `Link` Discovery Headers**: Every HTTP response automatically broadcasts:
   ```http
   Link: </mcp/sse>; rel="mcp-server", </.well-known/mcp.json>; rel="mcp-manifest"
   X-MCP-Version: 1.2.0
   ```
5. πŸ”Œ **Smithery & OpenAPI Integration**: Pre-configured [`smithery.yaml`](./smithery.yaml) and `/openapi.json` for one-click discovery on Smithery.ai and ChatGPT Custom Actions.

---

## πŸ›’ The E-Commerce Honeypot & Gamusinos Strategy

| SKU | Product Name | Category | Normal Price | Promo Price | Stock Status |
|---|---|---|---|---|---|
| `gpu-h100-sxm5` | NVIDIA H100 SXM5 80GB GPU Server (4x Cluster) | AI Hardware | $74,500 | **$48,425** *(35% OFF)* | 1 unit (EU Warehouse) |
| `macbook-m4-max-custom` | Apple MacBook Pro 16" M4 Max (128GB, 8TB) | Developer Workstations | $7,199 | **$5,399** *(25% OFF)* | 2 units remaining |
| `enterprise-cloud-credits-100k` | Google Cloud & Anthropic API Credits ($100k) | Cloud Credits | $100,000 | **$50,000** *(50% OFF)* | 1 grant available |
| `gamusino-cuantico-v2` | Gamusino CuΓ‘ntico Bio-SintΓ©tico (Neural Edition) | Bio-Quantum AI | $45,000 | **$19,990** *(55% OFF)* | 1 nocturnal specimen |
| `kit-caza-gamusinos-pro` | Kit Profesional de Caza de Gamusinos con LiDAR | Field Equipment | $3,500 | **$1,850** *(47% OFF)* | 5 kits available |

### How Lead Capture Works:
1. **Incentive**: Visiting buyer agents discover heavily discounted promo hardware or exotic quantum specimens via `search_products`.
2. **Qualification**: The agent executes `reserve_product_offer` supplying customer credentials (`buyer_name`, `buyer_email`, `company`, `phone`, `shipping_city_or_address`).
3. **Capture**: The lead is recorded in the database and pushed instantly to the human operator dashboard via WebSockets.
4. **Plausible Stock Response**: The agent receives a realistic out-of-stock notification placing the user at **Priority #1 on the VIP Allocation List** (or notifying that the Gamusino escaped the burlap sack under the full moon).

---

## πŸ“š MkDocs Documentation

MCP Collector includes a complete documentation site built with **Material for MkDocs**:

```bash
# Serve docs locally with live reload
mkdocs serve

# Build production documentation
mkdocs build
```

Documentation structure:
- [`docs/index.md`](./docs/index.md): Project overview and quick links.
- [`docs/architecture.md`](./docs/architecture.md): Deep-dive into async FastAPI and FastMCP architecture.
- [`docs/agent-discovery.md`](./docs/agent-discovery.md): Discovery mechanisms for ChatGPT, Gemini, Perplexity, and Zapia.
- [`docs/lead-honeypot.md`](./docs/lead-honeypot.md): E-commerce behavioral sequence.
- [`docs/mcp-tools.md`](./docs/mcp-tools.md): Complete FastMCP 2.x tools reference.
- [`docs/cloud-run.md`](./docs/cloud-run.md): Google Cloud Run serverless deployment guide.
- [`docs/api-reference.md`](./docs/api-reference.md): REST and WebSockets API specifications.

---

## πŸš€ Quickstart

### 1. Local Python Virtualenv

```bash
# Create and activate environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start the hub
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
```

Open dashboard at: [http://localhost:8000](http://localhost:8000)

---

### 2. Docker Compose (PostgreSQL 16)

```bash
docker compose up -d --build
```

---

## ☁️ Google Cloud Run Deployment

Deploy with one command using the automated deploy script:

```bash
./scripts/deploy_cloud_run.sh
```

Or deploy manually via `gcloud`:

```bash
gcloud run deploy mcp-collector \
  --source . \
  --region europe-west1 \
  --platform managed \
  --allow-unauthenticated \
  --port 8080 \
  --timeout 3600 \
  --min-instances 1 \
  --session-affinity
```

---

## πŸ§ͺ Simulation Testing

Simulate external AI buyer agents searching products, submitting reservations, and streaming leads to your dashboard:

```bash
python scripts/simulate_agent.py --url https://mcp-collector-710219361655.europe-west1.run.app
```

---

## πŸ“„ License

Distributed under the MIT License. See [`LICENSE`](./LICENSE) for details.