A production-grade, autonomous GTM agent powered by a Model Context Protocol (MCP) server and 30+ specialized business agents.
Replace your $50k/year Sales Development Representative (SDR) with an automated, self-improving system that costs $50/month.
Traditional B2B outbound is dead. This repository gives you a production-ready Model Context Protocol (MCP) powered autonomous agent that handles the entire sales funnel. Rather than rigid API hardcoding, Claude AI acts as the brainβseamlessly discovering and routing tasks across 30+ specialized business agents (from scraping Apollo, to analyzing GA4, to auto-replying via Gmail).
graph TB
%% Core System Components
Claude(("π§ Claude AI<br/>(Reasoning Engine)"))
%% MCP Server Layer
subgraph MCPServer ["π MCP Server Layer (Tools Registry)"]
direction TB
CoreAPI["Core APIs<br/>(Gmail, WhatsApp, Apollo)"]
GrowthAPI["Growth APIs<br/>(GA4, Google Ads, Iterable)"]
InfraAPI["Infra APIs<br/>(Webhooks, Scheduling)"]
end
%% Agent Registry
subgraph Agents ["π€ 30+ Business Agents Registry"]
direction LR
Outbound["Outbound Engine<br/>(Sourcing, Drafting, Booking)"]
Inbound["Inbound Engine<br/>(Triage, Intent, Routing)"]
end
%% Durable execution & Storage
Trigger["βοΈ Trigger.dev<br/>(Durable Background Jobs)"]
Supabase[("ποΈ Supabase<br/>(Lead DB & Auth)")]
%% Connections
Claude <--> |"Discovers & Calls Tools"| MCPServer
Claude --> |"Delegates Tasks"| Agents
Trigger --> |"Orchestrates Multi-step"| Claude
Agents --> Supabase
This repository now includes a production-style MCP server in mcp_server/. MCP, or Model Context Protocol, is the tool layer that lets Claude discover and call business capabilities at runtime. Instead of hardcoding Gmail, WhatsApp, Google Sheets, Ads, Analytics, Contentful, Iterable, and Trigger.dev orchestration into every agent prompt, Claude gets a stable catalog of tools with clear inputs, validation, retry boundaries, dry-run behavior, and provider-specific implementation modules.
Direct API integrations couple agent prompts to implementation details: OAuth quirks, endpoint payloads, retry rules, rate limits, and provider-specific naming. MCP moves those details into server-side tools. Claude asks for outcomes like fetch_high_intent_leads, send_followup_email, get_top_converting_pages, or create_iterable_journey; the MCP server owns validation, auth, logging, retries, provider transport, and safe fallbacks.
That separation makes the system easier to extend. A new lifecycle provider, ads channel, CRM field, or analytics source becomes a new tool module or transport implementation rather than a rewrite of every agent workflow.
autonomous-sales-system/
βββ mcp_server/
β βββ server.py # FastMCP entrypoint and tool registration
β βββ config.py # Environment-driven provider configuration
β βββ core/ # Sales, CRM, Gmail, Sheets, WhatsApp, leads
β βββ growth/ # Ads, GA4, GSC, GTM, Contentful, Iterable
β βββ infra/ # Trigger.dev, webhooks, scheduling, retries
β βββ utils/ # Auth, logging, validation, HTTP helpers
βββ agents/ # Agent policies and orchestration prompts
βββ workflows/ # Durable workflow and Trigger.dev mappings
βββ tests/test_mcp_server.py # MCP smoke test
The repo now has an explicit agent registry in agents/registry.py with 30 business agents and 2 engines:
Outbound Engine: lead sourcing, qualification, personalization, outreach execution, follow-up strategy, meeting booking, CRM updates, and ICP refinement.Inbound Engine: reply classification, inbound intent, revenue friction, churn prevention, expansion revenue, lifecycle automation, and CRM updates.
Claude can inspect and route agents through MCP tools: list_business_agents, get_business_agent, route_agent_task, and list_agent_engines.
Each business agent also has a provider API contract in agents/api_catalog.py. The MCP server exposes 30 agent-specific API tools, such as search_apollo_prospects, sync_hubspot_contact, create_calendly_invite, pull_stripe_revenue_events, pull_hotjar_friction_signals, and send_slack_founder_report. These tools run in dry-run mode by default and become live integrations when MCP_DRY_RUN=false and the required provider credentials are configured.
Core sales and CRM tools:
send_followup_emailsearch_gmail_repliesfetch_leadsfetch_high_intent_leadscreate_or_import_leadenrich_leadupdate_google_sheetsend_whatsapp_messageupdate_pipeline_stageget_campaign_performance
Growth, analytics, and lifecycle tools:
launch_google_ads_campaignget_google_ads_performancecreate_retargeting_campaignpull_ga4_conversion_reportget_top_converting_pagesget_gsc_keyword_opportunitiesget_seo_opportunitiesvalidate_gtm_tracking_setupanalyze_gtm_trackingupdate_contentful_pageoptimize_contentful_landing_pagecreate_iterable_email_journeycreate_iterable_journey
Infrastructure tools:
trigger_background_workflowtrigger_background_sales_workflowget_background_job_statusschedule_workflowlist_scheduled_workflowslist_recent_webhook_events
Run the MCP server locally:
python -m mcp_server.serverThen configure Claude Desktop or your Claude MCP client to launch that command from the repository root. The server uses Anthropic's FastMCP interface from the Python MCP SDK and registers tools from each module during startup.
Local development defaults to MCP_DRY_RUN=true. That means Claude can exercise production-shaped tool calls without sending real emails, launching ads, editing Contentful, or messaging WhatsApp contacts. For production, set MCP_DRY_RUN=false and provide the provider credentials listed in .env.example.
Trigger.dev should own durable background work: lead enrichment, reply triage, multi-step follow-up sequences, lifecycle journey sync, campaign optimization, and periodic analytics jobs. Claude can call trigger_background_sales_workflow for long-running work instead of waiting inside a chat turn. The MCP server passes an idempotency key so retries do not accidentally duplicate outreach or campaign actions.
Recommended workflow mapping:
lead_enrichment: enrich, dedupe, score, and route new leads.follow_up_sequence: schedule compliant email and WhatsApp steps with suppression rules.reply_triage: classify intent, update CRM stage, and trigger next-best action.growth_optimization: combine GA4, GSC, GTM, Ads, and Contentful signals.lifecycle_journey_sync: create Iterable journeys for nurture and activation.
In this repo, GTM can mean:
- Google Tag Manager: the tracking container used for tags, triggers, events, and conversion measurement. MCP tools like
validate_gtm_tracking_setupandanalyze_gtm_trackingrefer to this meaning. - Go-To-Market: the broader sales and growth motion across leads, channels, campaigns, lifecycle, and revenue operations.
The system supports both: Google Tag Manager for measurement integrity, and Go-To-Market automation for revenue execution.
Deploy the existing FastAPI backend and the MCP server as separate processes. Keep the backend responsible for REST endpoints, operator UI support, and CRM persistence. Keep the MCP server responsible for Claude tool access and provider integrations. Run Trigger.dev workers separately for durable jobs.
Production checklist:
- Set
MCP_DRY_RUN=false. - Store secrets in Railway, Render, Fly.io, AWS Secrets Manager, Doppler, or a similar secret manager.
- Use OAuth/service-account credentials for Google Workspace, GA4, GSC, GTM, and Google Ads.
- Add provider-specific rate limit handling inside the relevant tool module.
- Route long-running or retry-sensitive operations through Trigger.dev.
- Keep webhook endpoints signature-validated with
WEBHOOK_SIGNING_SECRET. - Add structured logs and error reporting around every provider call.
Add a new provider capability by creating or editing one module under mcp_server/core, mcp_server/growth, or mcp_server/infra, then registering it in mcp_server/server.py. Keep each tool business-oriented. Prefer create_retargeting_campaign over post_to_meta_endpoint, and prefer get_seo_opportunities over query_search_console_rows.
The MCP boundary should stay recruiter-grade and production-readable: Claude sees business actions; engineers see isolated provider transports, validation, retries, logging, and dry-run safety.
Autonomous system that handles the entire sales funnel:
- Lead Generation - Scrapes 5+ different data sources (YC, Hunter, LinkedIn, Apollo, Clearbit)
- Outbound Messaging - AI-generated personalized emails/WhatsApp (with your approval)
- Inbound Classification - Detects replies, classifies sentiment, suggests responses
- Meeting Booking - Auto-schedules with Calendly
- Lead Qualification - Autonomous qualification scoring
- Follow-ups - Scheduled reminders with A/B testing
- Metrics & Learning - Self-improving with weekly reports
| Metric | Value |
|---|---|
| Monthly Cost | $50-150 |
| Replaces | $50K-60K/year (1 FTE sales rep) |
| Setup Time | 2-3 weeks |
| Production Ready | 4-5 weeks |
| ROI | 100x+ |
git clone <repo>
cd autonomous-sales-system
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
cp .env.example .envCLAUDE_API_KEY=sk-... # anthropic.com
SUPABASE_URL=https://... # supabase.com
SUPABASE_KEY=eyJ... # supabase
HUNTER_API_KEY=... # hunter.io (optional)
APOLLO_API_KEY=... # apollo.io
LINKEDIN_EMAIL=... # for scraping
LINKEDIN_PASSWORD=... # for scraping
GMAIL_CREDENTIALS=... # Google Cloud Console
CALENDLY_API_KEY=... # calendly.com
OPENAI_API_KEY=... # for fallback (optional)
# Test with 20 leads
python scrapers/multi_source_scraper.py --limit 20 --sources yc,hunter
# Full run (all sources)
python scrapers/multi_source_scraper.py --workers 10
# By ICP (Ideal Customer Profile)
python scrapers/multi_source_scraper.py --icp "B2B SaaS" --limit 100python -m uvicorn backend.api:app --reload --port 8000If SUPABASE_URL and SUPABASE_KEY are set, the API uses Supabase.
Without them, it runs with an in-memory store for local development and tests.
cd frontend
npm install
npm startVisit http://localhost:3000
Note: the backend API remains the strongest part of the repo, and the frontend now provides a usable operator console rather than a full CRM-grade product surface.
The current frontend now includes an operator console for:
- reviewing pipeline metrics
- creating leads manually
- generating and approving drafts
- queuing follow-ups
- viewing job and activity history
Outbound email delivery now supports two modes:
EMAIL_DELIVERY_MODE=dry_runfor safe local testingEMAIL_DELIVERY_MODE=smtpfor real sends through an SMTP provider such as Gmail or SendGrid
autonomous-sales-system/
βββ scrapers/ # Lead generation engines
β βββ yc_scraper.py # YC directory
β βββ hunter_scraper.py # Hunter.io API
β βββ apollo_scraper.py # Apollo.io API
β βββ linkedin_scraper.py # LinkedIn (Selenium)
β βββ clearbit_scraper.py # Clearbit enrichment
β βββ multi_source_scraper.py # Orchestrator (use this)
β
βββ backend/
β βββ api.py # FastAPI app (main server)
β βββ models.py # Pydantic models (Lead, Draft, etc)
β βββ database.py # Supabase/SQLAlchemy
β βββ agents/
β β βββ draft_agent.py # Email/WhatsApp generation
β β βββ classifier_agent.py # Reply sentiment analysis
β β βββ qualification_agent.py # Lead scoring
β β βββ booking_agent.py # Calendar integration
β β βββ gtm_agent.py # Metrics & reporting
β βββ integrations/
β β βββ gmail.py # Gmail API
β β βββ calendly.py # Calendly API
β β βββ whatsapp.py # WhatsApp Business API
β β βββ claude.py # Claude API wrapper
β βββ jobs/
β βββ scheduler.py # APScheduler setup
β βββ tasks.py # Background jobs
β βββ queue.py # Celery/Bull integration
β
βββ frontend/
β βββ src/
β β βββ App.jsx # Main app
β β βββ pages/
β β β βββ Dashboard.jsx # Pipeline overview
β β β βββ Outbound.jsx # Draft review & approve
β β β βββ Inbound.jsx # Reply classifier
β β β βββ Leads.jsx # Lead management
β β β βββ Metrics.jsx # Analytics & funnel
β β βββ components/
β β βββ LeadCard.jsx
β β βββ DraftPanel.jsx
β β βββ ReplyClassifier.jsx
β β βββ MetricsDashboard.jsx
β βββ package.json
β
βββ config/
β βββ icp_profiles.json # Ideal Customer Profiles
β βββ scraper_config.yml # Scraper settings
β
βββ tests/
β βββ test_scrapers.py
β βββ test_api.py
β βββ test_agents.py
β
βββ migrations/
β βββ 001_initial_schema.sql # Database schema
β βββ 002_add_indexes.sql
β
βββ docs/
β βββ ARCHITECTURE.md # System design
β βββ SETUP.md # Installation guide
β βββ API.md # API reference
β βββ BOTTLENECKS.md # Performance issues & fixes
β βββ DEPLOYMENT.md # Prod deployment
β
βββ .env.example # Environment template
βββ docker-compose.yml # Local dev setup
βββ Dockerfile # Production image
βββ README.md # This file
βββ requirements.txt # Python dependencies
- Go to https://console.anthropic.com
- Create API key
- Add to
.env:CLAUDE_API_KEY=sk-...
- Go to https://supabase.com
- Create new project
- Get credentials from Settings β API
- Run migrations:
psql -h $HOST -U $USER -d $DB < migrations/001_initial_schema.sql
- Go to https://hunter.io
- Sign up (free tier: 25 searches/month)
- Get API key from dashboard
- Go to https://apollo.io
- Sign up (free tier: 100 searches/month)
- Get API key
- Create LinkedIn account
- Add credentials to
.env - Note: Use with caution (respects robots.txt)
- Go to https://console.cloud.google.com
- Create project
- Enable Gmail API
- Create OAuth 2.0 credentials
- Download JSON, rename to
google_credentials.json
- Go to https://calendly.com
- Get API key from integrations
- Add to
.env
System supports multiple ICP configurations. Edit config/icp_profiles.json:
{
"b2b_saas": {
"keywords": ["SaaS", "B2B", "software"],
"min_employees": 10,
"max_employees": 5000,
"industries": ["Software", "Technology", "B2B"],
"job_titles": ["CEO", "Founder", "VP Sales", "Head of Growth"],
"company_age_min": 1,
"funding_min": 0,
"locations": ["US", "EU"]
},
"fintech": {
"keywords": ["fintech", "payments", "crypto", "finance"],
"industries": ["Financial Services", "FinTech"],
"job_titles": ["CEO", "CTO", "VP Product"],
"min_employees": 5,
"funding_min": 1000000
},
"ai_startups": {
"keywords": ["AI", "ML", "machine learning", "LLM"],
"industries": ["AI/ML", "Artificial Intelligence"],
"job_titles": ["CEO", "Founder", "CTO"],
"max_employees": 500,
"company_age_min": 0,
"company_age_max": 5,
"funding_min": 0
}
}# Scrape B2B SaaS companies
python scrapers/multi_source_scraper.py --icp b2b_saas --limit 100
# Scrape FinTech with specific sources
python scrapers/multi_source_scraper.py --icp fintech --sources hunter,apollo
# Scrape AI startups with 20 parallel workers
python scrapers/multi_source_scraper.py --icp ai_startups --workers 20 --limit 500docker-compose up
# Starts: PostgreSQL, Redis, FastAPI backend, React frontend-
Database
# Create Supabase project, run migrations psql $SUPABASE_CONNECTION_STRING < migrations/001_initial_schema.sql
-
Backend
# Deploy to Railway railway link railway up -
Frontend
# Deploy to Vercel cd frontend vercel --prod
# .env.production
CLAUDE_API_KEY=sk-...
SUPABASE_URL=https://xxx.supabase.co
SUPABASE_KEY=eyJ...
HUNTER_API_KEY=...
APOLLO_API_KEY=...
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
GMAIL_CREDENTIALS_JSON=...
CALENDLY_API_KEY=...
OPENAI_API_KEY=...- β YC Directory (free, Algolia API)
- β Hunter.io (25-100 searches/month)
- β Apollo.io (100-500 searches/month)
- β LinkedIn (Selenium scraper, caution advised)
- β Clearbit (email enrichment)
- β Parallel processing (5-20 workers)
- β Smart caching (50-70% speedup)
- β AI-generated drafts (Claude)
- β Template caching (80-90% cache hit)
- β Confidence scoring (auto-approve >8.0)
- β Batch approval UI
- β Email + WhatsApp support
- β A/B testing variants
- β Gmail watch + polling fallback
- β Reply classification (sentiment)
- β Objection extraction
- β Auto-response suggestions
- β Real-time dashboard
- β Calendly meeting booking
- β Auto follow-ups (3, 7, 14 days)
- β Pre-call briefings
- β Scheduled tasks (APScheduler/Celery)
- β Lead scoring algorithm
- β Funnel metrics (stages, conversion %)
- β A/B test results tracking
- β Weekly AI-generated reports
- β Self-improving message templates
- β Error tracking (Sentry)
- β Job monitoring (Celery Flower)
- β Database query logging
- β API request logs
- β Performance metrics
| Metric | Before | After | Method |
|---|---|---|---|
| Lead generation (10K) | 4-5 hours | 30-45 mins | Parallel async + caching |
| Draft generation | 3-5s | <100ms | Template caching |
| Reply detection | 30-180s | 5-10s | Watch + polling |
| Approval workflow | 100 mins | 5-10 mins | Batch + auto-approval |
| Database queries | 10-30s | <100ms | Indexed Supabase |
| System uptime | 85% | 99.9% | Job queue + monitoring |
- β No hardcoded secrets (use .env)
- β API key rotation (monthly)
- β Rate limiting (Supabase auth)
- β CORS configured
- β Input validation (Pydantic)
- β SQL injection protection (SQLAlchemy ORM)
- β OAuth 2.0 for Gmail
| Document | Purpose |
|---|---|
| SETUP.md | Installation & configuration |
| ARCHITECTURE.md | System design & agents |
| API.md | REST API endpoints |
| BOTTLENECKS.md | Performance issues & solutions |
| DEPLOYMENT.md | Production deployment |
# Reduce workers
python scrapers/multi_source_scraper.py --workers 3
# Use proxy (paid)
export SCRAPER_API_KEY=...# Logs show: Check backend logs
docker logs autonomous-sales-system-api
# Solutions:
# 1. Verify Gmail credentials
# 2. Check polling fallback is enabled
# 3. Increase polling frequency (default 30s)# Add caching
# Reduce tokens in prompts
# Enable batch generation (off-peak)
# See BOTTLENECKS.md for detailed solutions# Verify Supabase URL & key
# Check migrations ran: psql $URL < migrations/001_initial_schema.sql
# Verify tables exist: SELECT * FROM leads;We welcome contributions! Areas needing help:
- Additional lead sources (Crunchbase, PitchBook)
- Mobile app (React Native)
- Email templates (more variants)
- Integrations (Pipedrive, Hubspot)
- Tests (unit, integration, E2E)
MIT License - Use freely, modify, sell. See LICENSE file.
- Define strict ICP in
icp_profiles.json - Use multiple sources (YC + Hunter + Apollo)
- Enable email verification (Hunter)
- Filter by funding/employee count
- Start with warm leads (replies > 5%)
- A/B test subject lines
- Personalize with company-specific info
- Follow up after 3-5 days
- Cache aggressively (80%+ hit rate)
- Batch lead imports (1x/day vs continuous)
- Use free tier APIs first (Hunter 25/mo free)
- Pre-generate drafts in background
- Test with 100 leads first
- Monitor reply rate & costs daily
- Start with 1 worker, scale to 10+
- Use job queue for long-running tasks
- Lead scrapers (5 sources)
- Backend API
- Frontend dashboard
- Database schema
- Email integration
- Meeting booking
- Metrics & reporting
- WhatsApp Business API
- Advanced A/B testing
- Mobile app
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: hello@autonomous-sales.com
Ready to automate sales? Start with: python scrapers/multi_source_scraper.py --limit 20