# War Room MCP · Operator Mode Setup

**Live MCP server:** `https://gjmytcxrvxqmcbvglgvw.supabase.co/functions/v1/wr-mcp`
**SSE stream:** `https://gjmytcxrvxqmcbvglgvw.supabase.co/functions/v1/wr-mcp/stream`

## What this is

A 57-tool MCP server that lets Claude (or any MCP-compatible agent — ChatGPT, Zapier, custom apps) operate the War Room CRM by voice. Discover leads. Generate sequences. Enroll contacts. Send emails. Track replies. Run multi-channel playbooks. All real systems, real data, real sends.

## Setup (Claude.ai)

1. Open **claude.ai** → **Settings** → **Connectors** → **Add custom connector**.
2. **Name:** War Room CRM
3. **URL:** `https://gjmytcxrvxqmcbvglgvw.supabase.co/functions/v1/wr-mcp`
4. **Authentication:** Custom header
   - Header name: `x-wr-token`
   - Header value: `<your token from /tmp/wr_david_token.txt or /tmp/wr_test_token.txt>`
5. **Save.**

Talk to Claude. Say *"Use the War Room MCP to pull the top 50 chiros and start the 5-touch sequence."* That's it.

## Setup (Claude.ai mobile · iOS/Android)

1. Open the Claude app → tap the gear icon → **Connectors** → **Add custom**.
2. Same URL + header as above.
3. Save and go.

For voice: enable mic in the chat. Speak to Claude. *"Pull me the fifty best chiropractors in Roseville."*

## Tokens (treat like passwords)

| Token label | File | Use |
|---|---|---|
| David production | `/tmp/wr_david_token.txt` | David's account, real sends |
| Blake production | `/tmp/wr_blake_token.txt` | Blake's account, real sends |
| Test mode | `/tmp/wr_test_token.txt` | Sandbox · no real sends · safe for demos |

## The 57 tools

### Lead intelligence
`wr_search_contacts` · `wr_get_contact` · `wr_list_top_lhf`

### Discovery + enrichment
`wr_discover_leads` · `wr_enrich_contact` · `wr_research_contact`

### Sequence generation
`wr_generate_sequence` · `wr_generate_sms_sequence` · `wr_generate_linkedin_sequence`

### Enrollment
`wr_enroll_segment` · `wr_enroll_contacts` · `wr_unenroll`

### Multi-channel campaigns
`wr_create_campaign` · `wr_run_playbook`

### Email
`wr_send_email` · `wr_draft_email` · `wr_send_draft` · `wr_get_pending_drafts`

### LinkedIn
`wr_linkedin_connect` · `wr_linkedin_message` · `wr_linkedin_view_profile` · `wr_linkedin_get_status` · `wr_linkedin_bulk_connect`

### SMS / iMessage
`wr_send_sms` · `wr_enroll_sms_sequence` · `wr_reply_sms`

### Inbound replies
`wr_get_pending_replies` · `wr_draft_reply` · `wr_send_reply` · `wr_set_autopilot`

### Field tool
`wr_field_get_route` · `wr_field_log_visit` · `wr_field_voice_note`

### Calendar / meetings
`wr_book_meeting` · `wr_list_upcoming_meetings` · `wr_log_call`

### Deals / pipeline
`wr_create_deal` · `wr_update_deal_stage` · `wr_list_deals` · `wr_forecast`

### Revenue / Stripe
`wr_get_revenue` · `wr_send_invoice` · `wr_summit_ticket_status` · `wr_create_payment_link`

### Live dashboards
`wr_campaign_live` · `wr_top_engaged_contacts` · `wr_alerts` · `wr_stats`

### AI orchestration
`wr_score_lead` · `wr_summarize_thread` · `wr_recommend_next_action` · `wr_personalize_email`

### Admin / safety
`wr_pause_all` · `wr_test_mode` · `wr_audit_log` · `wr_recent_activity`

### Signature close
`wr_signature_close` — pulls live state of every active campaign + 30-day forecast in one voice line. The closing beat.

## Voice summary contract

Every tool returns a `voice_summary` string under 60 words. Calibrated through `lib/voice-summary.ts` for: confident not boastful, specific not vague, ending in a micro-decision-point. The system never speaks a flat period — there's always a next move offered.

## Pre-flight checks

Before any real send, the server runs:
1. Token valid + not revoked
2. Rate limit clear (100/hr, 500/day default)
3. Recipient deliverable (no `sendable:false`, no quarantined email)
4. Content rendered without broken merge tags

If any check fails, the tool returns a voice summary explaining exactly what would have gone wrong. No silent failures.

## Test mode

`wr_test_mode { enabled: true }` flips the token into sandbox. All sends become drafts. Real DB writes still happen so the demo dashboard reacts in real time, but no email/SMS/LinkedIn actually leaves. Toggle back via `wr_test_mode { enabled: false }` for production.

## Audit log

Every tool call writes a row to `mcp_audit_log` with timestamp, hashed token, tool name, params, status, latency_ms, voice_summary. Queryable via `wr_audit_log { window_min: 60 }` for the last hour. This is the trust layer for enterprise.

## Troubleshooting

| Symptom | Fix |
|---|---|
| `401 unauthorized` | Token wrong or revoked. Pull a fresh one from `agent_tokens` table. |
| `discover_leads added 0` | NPI returned no new matches not already in CRM. Try a different ZIP or specialty. |
| `gmail_send_failed: token_refresh_failed` | Gmail OAuth expired. Re-auth via warroomcrm.com → Settings → Connect Gmail. |
| `latency_ms > 1500` on `wr_generate_sequence` | Background-fill pattern is firing. The first step is ready immediately; steps 2-N populate within 30 seconds via background generation. Refresh the sequence list. |
| SSE stream cuts after 5 min | By design. Reconnect — heartbeats every 1.5s, audit events on every tool call. |
| Voice summary missing or generic | Tool not yet calibrated in `buildVoiceSummary`. File a one-line PR adding the case. |

## Live tested · 24/24 pass

Every tool listed above was verified live against production data on the date of this build. See `mcp-demo.md` for the cinematic demo script.
