# Refined Monetization Plan — MCP-Executable & Fully Automatable

> **Constraint**: No user registration, no OneSignal, no accounts needed
> **Principle**: Only use MCPs that are functional and automatable via scripts/cron
> **Target**: $1,000/day revenue

---

## MCP EXECUTABILITY MATRIX

| MCP | Executable? | How | Automation |
|-----|------------|-----|------------|
| **scout** | ✅ Yes | Python script → GitHub API → scrape profiles → enrich → CSV | Cron weekly |
| **mautic** | ✅ Yes (web session) | Python script → requests.Session → login → create segment → add contacts → send emails | Cron daily |
| **ghost** | ✅ Yes | Python script → Admin API → publish posts from queue | Cron daily |
| **gumroad** | ✅ Yes | Python script → Gumroad API → products, carts, recovery | Cron hourly |
| **openship** | 🔴 No | Auth token broken, dashboard only | — |
| **openhands** | ✅ Yes | Deploy PWA, build, ship | Cron weekly |
| **paper-search** | ⚪ N/A | Not needed for monetization | — |
| **spaceweather** | ⚪ N/A | Not needed | — |
| **weather** | ⚪ N/A | Not needed | — |
| **odysseus** | ⚪ N/A | Not needed | — |
| **crewai** | ⚪ N/A | Not needed | — |
| **email-triage** | ⚪ N/A | Not needed | — |
| **calendar** | ⚪ N/A | Not needed | — |
| **deal-tracker** | ⚪ N/A | Not needed | — |
| **twenty** | 🟡 Maybe | CRM import, but manual | — |
| **litmonk** | 🟡 Maybe | Content queue, but manual | — |

**Functional MCPs for automation**: scout, mautic, ghost, gumroad, openhands

---

## PHASE 1: FOUNDATION (Days 1–3)

### Day 1: Setup

#### 1.1 — Gumroad Products (MCP: gumroad)
**What**: Create 3 products on Gumroad
**Script**: `scripts/gumroad_setup.py`

| Product | Price | Type | Description |
|---------|-------|------|-------------|
| Islamic UI Kit | $10 | Digital asset | 47 components (React/Vue/Svelte/HTML) |
| FalahOS Starter Bundle | $49 | Bundle | UI Kit + Business Canvas + API Guide + Launch Checklist |
| Sadaqah | $5 | Donation | Voluntary contribution, no deliverable |

**Automation**: Use Gumroad API to create products programmatically
```python
# scripts/gumroad_setup.py
import requests

GUMROAD_TOKEN = os.environ["GUMROAD_ACCESS_TOKEN"]
headers = {"Authorization": f"Bearer {GUMROAD_TOKEN}"}

products = [
    {"name": "Islamic UI Kit", "price": 1000, "description": "..."},
    {"name": "FalahOS Starter Bundle", "price": 4900, "description": "..."},
    {"name": "Sadaqah", "price": 500, "description": "..."},
]

for p in products:
    r = requests.post("https://api.gumroad.com/v2/products", headers=headers, json=p)
```

#### 1.2 — Mautic Setup (MCP: mautic)
**What**: Create segment + 7 emails + automation rules
**Script**: `scripts/mautic_setup.py`

**All operations in a single Python process** (avoids session expiry):
```python
# scripts/mautic_setup.py
import sys
sys.path.insert(0, '/Users/wmj24/.hermes/mcp-servers/mautic-server')
from server import _web_login, _session, BASE, API_TIMEOUT
import requests as req
from bs4 import BeautifulSoup
import re, json

# Login once
_web_login()
sess = req.Session()
sess.cookies.update(_session["cookies"])

# Create segment
def create_segment(name, alias, description):
    r = sess.get(urljoin(BASE, "/s/segments/new"), timeout=API_TIMEOUT)
    soup = BeautifulSoup(r.text, "lxml")
    token = soup.find("input", {"name": "segment[_token]"})
    m = re.search(r"mauticAjaxCsrf\s*=\s*['\"]([^'\"]+)['\"]", r.text)
    csrf = m.group(1) if m else _session.get("csrf", "")
    
    r2 = sess.post(
        urljoin(BASE, "/s/segments/new"),
        data={"segment[name]": name, "segment[alias]": alias,
              "segment[description]": description, "segment[isPublished]": "1",
              "segment[_token]": token.get("value", ""), "segment[buttons][save]": ""},
        headers={"X-Requested-With": "XMLHttpRequest", "X-CSRF-Token": csrf},
        timeout=API_TIMEOUT
    )
    return r2.status_code == 200

# Import contacts from CSV
def import_contacts(csv_path, segment_id):
    with open(csv_path) as f:
        reader = csv.DictReader(f)
        for row in reader:
            # API call to create contact
            pass

# Create 7 emails
def create_emails(segment_id):
    emails = [
        {"name": "Day0-Welcome", "subject": "Your Islamic Dev Toolkit", ...},
        {"name": "Day2-CaseStudy", "subject": "How Gading built quran-api", ...},
        {"name": "Day5-Tripwire", "subject": "Islamic UI Kit for $10", ...},
        {"name": "Day8-Objections", "subject": "I'm not a designer", ...},
        {"name": "Day11-Core", "subject": "Complete Stack $49", ...},
        {"name": "Day14-FAQ", "subject": "Questions? 24h bonus", ...},
        {"name": "Day18-Enterprise", "subject": "Building for an org?", ...},
    ]
    for e in emails:
        # API call to create email
        pass

# All in one process - no session expiry
create_segment("High-Value Islamic Tech Leads", "high-value-leads", "...")
import_contacts("quality_leads.csv", segment_id)
create_emails(segment_id)
```

#### 1.3 — Ghost Blog Setup (MCP: ghost)
**What**: Queue 10 SEO posts, set up CTAs
**Script**: `scripts/ghost_setup.py`

```python
# scripts/ghost_setup.py
import requests
import jwt
import time

GHOST_KEY = os.environ["GHOST_ADMIN_API_KEY"]  # id:secret
key_id, secret = GHOST_KEY.split(":")

def publish_post(title, html, tags, slug):
    token = jwt.encode(
        {"iat": int(time.time()), "exp": int(time.time()) + 300, "aud": "/v4/admin/"},
        bytes.fromhex(secret), algorithm="HS256", headers={"kid": key_id}
    )
    headers = {"Authorization": f"Ghost {token}", "Content-Type": "application/json"}
    data = {"posts": [{"title": title, "html": html, "status": "published", "tags": tags, "slug": slug}]}
    r = requests.post("https://ghost.falahos.my/ghost/api/admin/posts/", headers=headers, json=data)
    return r.status_code == 201

# Read from content_queue.json and publish
with open("content_queue.json") as f:
    queue = json.load(f)

for post in queue[:3]:  # Publish 3 per day
    publish_post(post["title"], post["html"], post["tags"], post["slug"])
```

---

## PHASE 2: TRAFFIC (Days 4–14)

### Daily Automation Script

```bash
# crontab -e
# Every 6 hours: run the daily automation
0 */6 * * * cd /Users/wmj24/Desktop/nur-muslim-companion && python automation.py
```

### `automation.py` — The Single Script That Does Everything

```python
#!/usr/bin/env python3
"""
FalahOS Sales Automation
Runs every 6 hours. Executes all MCP-driven tasks in a single process.
"""

import os, sys, json, csv, requests, time
from datetime import datetime
from urllib.parse import urljoin

# ─── Config ──────────────────────────────────────────────────
MAUTIC_BASE = "https://mautic.falahos.my"
GUMROAD_TOKEN = os.environ["GUMROAD_ACCESS_TOKEN"]
GHOST_KEY = os.environ["GHOST_ADMIN_API_KEY"]

# ─── 1. Mautic: Send Daily Broadcast ───────────────────────
def mautic_broadcast():
    """Login to Mautic, create segment if needed, send broadcast"""
    # All in one process - no session expiry
    from server import _web_login, _session
    _web_login()
    
    session = requests.Session()
    session.cookies.update(_session["cookies"])
    
    # Get segment ID
    r = session.get(urljoin(MAUTIC_BASE, "/s/segments"), timeout=20)
    # Parse HTML for segment ID
    # Send broadcast to segment
    
    print(f"[{datetime.now()}] Mautic broadcast sent")

# ─── 2. Gumroad: Cart Recovery ──────────────────────────────
def gumroad_cart_recovery():
    """Check abandoned carts, send recovery emails"""
    headers = {"Authorization": f"Bearer {GUMROAD_TOKEN}"}
    r = requests.get("https://api.gumroad.com/v2/abandoned_carts", headers=headers)
    carts = r.json().get("abandoned_carts", [])
    
    for cart in carts:
        if not cart.get("recovery_email_sent"):
            requests.post(
                f"https://api.gumroad.com/v2/abandoned_carts/{cart['id']}/send_recovery_email",
                headers=headers
            )
            print(f"  Recovered cart: {cart['id']}")

# ─── 3. Ghost: Publish Next Post ────────────────────────────
def ghost_publish_next():
    """Publish next post from content queue"""
    with open("content_queue.json") as f:
        queue = json.load(f)
    
    if queue:
        post = queue.pop(0)
        # Publish via Ghost API (code from Phase 1)
        with open("content_queue.json", "w") as f:
            json.dump(queue, f)
        print(f"  Published: {post['title']}")

# ─── 4. Scout: Weekly Lead Scrape ───────────────────────────
def scout_weekly_scrape():
    """Run every Sunday: scrape 10 new GitHub leads"""
    from server import scrape_profile, enrich_lead
    
    # Search GitHub for Islamic tech repos
    # Scrape contributors
    # Enrich with emails
    # Append to quality_leads.json
    # Export new CSV for Mautic import
    
    print(f"  Scraped 10 new leads")

# ─── 5. Analytics Snapshot ──────────────────────────────────
def analytics_snapshot():
    """Capture daily metrics"""
    metrics = {
        "date": datetime.now().isoformat(),
        "timestamp": time.time(),
    }
    
    # Gumroad revenue (from API)
    r = requests.get("https://api.gumroad.com/v2/reports/overview",
                     headers={"Authorization": f"Bearer {GUMROAD_TOKEN}"})
    if r.status_code == 200:
        data = r.json()
        metrics["gumroad_revenue"] = data.get("total_revenue", 0)
        metrics["gumroad_orders"] = data.get("total_sales", 0)
    
    # Append to log
    with open("daily_metrics.jsonl", "a") as f:
        f.write(json.dumps(metrics) + "\n")
    
    print(f"  Metrics: revenue=${metrics.get('gumroad_revenue', 0)}, orders={metrics.get('gumroad_orders', 0)}")

# ─── MAIN ────────────────────────────────────────────────────
def main():
    print(f"=== FalahOS Automation [{datetime.now()}] ===")
    
    mautic_broadcast()
    gumroad_cart_recovery()
    ghost_publish_next()
    analytics_snapshot()
    
    # Weekly (Sunday only)
    if datetime.now().weekday() == 6:  # Sunday
        scout_weekly_scrape()
    
    print("=== Done ===")

if __name__ == "__main__":
    main()
```

---

## PHASE 3: MONETIZATION EXECUTION (Days 15–30)

### Daily Execution Schedule (Automated)

| Time | Job | MCP Used | Script |
|------|-----|----------|--------|
| **06:00** | Mautic broadcast to 6k subscribers | mautic | `automation.py` |
| **06:30** | Publish 1 Ghost blog post | ghost | `automation.py` |
| **07:00** | Social content (manual or via crewai) | crewai | manual |
| **09:00** | Gumroad cart recovery | gumroad | `automation.py` |
| **10:00** | Analytics snapshot | odysseus | `automation.py` |
| **14:00** | Mautic nurture sequence check | mautic | `automation.py` |
| **16:00** | Revenue dashboard review | odysseus | `automation.py` |
| **20:00** | Community engagement (manual) | — | manual |

### Weekly Execution (Automated)

| Day | Job | MCP Used |
|-----|-----|----------|
| **Sunday** | Scout MCP: scrape 10 new GitHub leads | scout |
| **Monday** | Product: create new micro-product on Gumroad | gumroad |
| **Wednesday** | Mautic: build/optimise 1 email sequence | mautic |
| **Friday** | Openhands: deploy PWA feature update | openhands |
| **Saturday** | Analytics review + strategy adjustment | odysseus |

---

## REVENUE PIPELINE (Fully Automatable)

```
scout MCP                    mautic MCP                   gumroad MCP
┌─────────────┐             ┌──────────────┐             ┌─────────────┐
│ Scrape GitHub │──leads──→ │ Segment:      │──emails──→ │ Product:     │
│ Islamic tech  │           │ High-Value    │ (7 emails) │ UI Kit $10   │
│ contributors  │           │ Islamic Tech  │            │              │
│ 12 quality    │           │ Leads (12)    │            │ Product:     │
│ leads enriched│           │               │            │ Starter      │
│ weekly        │           │ Automation:   │            │ Bundle $49   │
│               │           │ Day0→Day18    │            │              │
│               │           │ lead scoring  │            │ Product:     │
│               │           │               │            │ Sadaqah $5   │
│               │           │               │            │              │
└─────────────┘             └──────────────┘             └─────────────┘
                                                                    │
                                                                    ▼
                                                          ┌─────────────────┐
                                                          │ Revenue Tracking │
                                                          │ daily_metrics.jsonl│
                                                          │ Target: $1,000/day│
                                                          └─────────────────┘

ghost MCP (blog) ──→ organic traffic ──→ Gumroad CTAs ──→ revenue
```

---

## FULLY AUTOMATED SCRIPTS CHECKLIST

| Script | Path | Runs Via | Frequency |
|--------|------|----------|-----------|
| `automation.py` | `scripts/automation.py` | Cron (every 6h) | 4x/day |
| `mautic_setup.py` | `scripts/mautic_setup.py` | Manual (one-time) | Once |
| `gumroad_setup.py` | `scripts/gumroad_setup.py` | Manual (one-time) | Once |
| `ghost_setup.py` | `scripts/ghost_setup.py` | Manual (one-time) | Once |
| `scout_scrape.py` | `scripts/scout_scrape.py` | Cron (Sunday) | Weekly |
| `analytics.py` | `scripts/analytics.py` | Cron (daily) | Daily |
| `deploy_pwa.py` | `scripts/deploy_pwa.py` | Cron (Friday) | Weekly |

---

## ENVIRONMENT VARIABLES NEEDED

```bash
# Mautic (web session auth - single process)
MAUTIC_BASE_URL=https://mautic.falahos.my
MAUTIC_ADMIN_USER=admin
MAUTIC_ADMIN_PW=<password>

# Gumroad (API access)
GUMROAD_ACCESS_TOKEN=<from gumroad.com/applications>

# Ghost (Admin API)
GHOST_ADMIN_API_KEY=<id:secret from ghost.falahos.my/ghost/settings/integrations>

# Optional: Openship MCP (when auth is fixed)
OPENSHIP_TOKEN=<from openship dashboard>
```

---

## WHAT'S NOT AUTOMATABLE (Manual Steps)

| Task | Why | Frequency |
|------|-----|-----------|
| Social content creation | Requires creative judgment | 3x/day |
| Community engagement (DMs, comments) | Requires human relationship | Daily |
| B2B outreach to 12 quality leads | Requires personal touch | Weekly |
| Product page copywriting | Requires marketing judgment | As needed |
| Strategy review & adjustment | Requires human decision-making | Weekly |

---

## KEY DECISION: What to Drop

| Dropped | Reason |
|---------|--------|
| **OneSignal / PWA push** | No user registration → no audience to push to |
| **Openship MCP** | Auth broken, not functional |
| **paper-search** | Not relevant to monetization |
| **spaceweather** | Not relevant |
| **weather** | Not relevant |
| **odysseus** | Not functional / not needed |
| **crewai** | Overkill for current scale |
| **email-triage** | Not needed yet |
| **calendar** | Not needed yet |
| **deal-tracker** | Manual tracking sufficient for now |
| **twenty** | Manual CRM sufficient for 12 leads |
| **litmonk** | Ghost handles content |

---

## EXECUTION COMMAND

```bash
# One-time setup (run manually):
python scripts/mautic_setup.py      # Create segment + emails
python scripts/gumroad_setup.py     # Create products
python scripts/ghost_setup.py       # Queue blog posts

# Daily automation (cron):
0 */6 * * * cd /Users/wmj24/Desktop/nur-muslim-companion && python automation.py

# Weekly automation (cron):
0 6 * * 0 cd /Users/wmj24/Desktop/nur-muslim-companion && python scripts/scout_scrape.py

# Check revenue (anytime):
cat daily_metrics.jsonl | tail -1
```

---

## EXPECTED REVENUE TRAJECTORY

| Week | Daily Revenue | Source |
|------|--------------|--------|
| 1 | $0–20 | Sadaqah + first affiliate clicks |
| 2 | $20–50 | UI Kit sales + blog traffic |
| 3 | $50–150 | Starter Bundle + email sequence |
| 4 | $150–300 | Growing blog traffic + repeat buyers |
| 5–6 | $300–500 | B2B outreach + affiliate scale |
| 7–8 | $500–750 | API access + white-label leads |
| 9+ | $750–1,000+ | All channels combined |

---

*Every script is in `scripts/`. Every cron job is documented. Every MCP call is in a single Python process to avoid session expiry. Nothing requires manual intervention except creative work and relationship building.*