# A2P AutoPilot MCP Server โ€” Deployment Guide ## โœ… What Was Built A complete, production-ready MCP Server with 4 interactive UI apps for managing A2P registrations in Claude Desktop. ### ๐Ÿ“ File Structure ``` a2p-autopilot/mcp-app/ โ”œโ”€โ”€ server.ts # Main MCP server (stdio transport) โ”œโ”€โ”€ package.json # Dependencies & scripts โ”œโ”€โ”€ tsconfig.json # TypeScript config โ”œโ”€โ”€ build-all.js # Build script for all apps โ”œโ”€โ”€ README.md # Documentation โ”œโ”€โ”€ .gitignore # Git ignore patterns โ”‚ โ”œโ”€โ”€ src/ # Core server logic โ”‚ โ”œโ”€โ”€ tools.ts # All 9 MCP tool definitions โ”‚ โ”œโ”€โ”€ handlers.ts # Tool execution handlers โ”‚ โ”œโ”€โ”€ resources.ts # UI resource registration โ”‚ โ””โ”€โ”€ mock-data.ts # Realistic test data (10 submissions) โ”‚ โ”œโ”€โ”€ apps/ # 4 React apps (Vite) โ”‚ โ”œโ”€โ”€ registration-wizard/ โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx # Multi-step registration form โ”‚ โ”‚ โ”œโ”€โ”€ main.tsx # React entry point โ”‚ โ”‚ โ”œโ”€โ”€ index.html # HTML template โ”‚ โ”‚ โ””โ”€โ”€ vite.config.ts # Vite single-file build config โ”‚ โ”œโ”€โ”€ dashboard/ โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx # Submissions list with filters โ”‚ โ”‚ โ”œโ”€โ”€ main.tsx โ”‚ โ”‚ โ”œโ”€โ”€ index.html โ”‚ โ”‚ โ””โ”€โ”€ vite.config.ts โ”‚ โ”œโ”€โ”€ submission-detail/ โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx # Deep dive: SID chain, timeline, details โ”‚ โ”‚ โ”œโ”€โ”€ main.tsx โ”‚ โ”‚ โ”œโ”€โ”€ index.html โ”‚ โ”‚ โ””โ”€โ”€ vite.config.ts โ”‚ โ””โ”€โ”€ landing-preview/ โ”‚ โ”œโ”€โ”€ App.tsx # Preview opt-in/privacy/terms pages โ”‚ โ”œโ”€โ”€ main.tsx โ”‚ โ”œโ”€โ”€ index.html โ”‚ โ””โ”€โ”€ vite.config.ts โ”‚ โ”œโ”€โ”€ components/ # Shared React components โ”‚ โ”œโ”€โ”€ layout/ โ”‚ โ”‚ โ”œโ”€โ”€ PageHeader.tsx # App header with title & actions โ”‚ โ”‚ โ”œโ”€โ”€ Card.tsx # Card container โ”‚ โ”‚ โ”œโ”€โ”€ StepProgress.tsx # Multi-step progress indicator โ”‚ โ”‚ โ””โ”€โ”€ Section.tsx # Content section โ”‚ โ”œโ”€โ”€ data/ โ”‚ โ”‚ โ”œโ”€โ”€ StatusBadge.tsx # Color-coded status badges โ”‚ โ”‚ โ”œโ”€โ”€ DataTable.tsx # Generic sortable table โ”‚ โ”‚ โ”œโ”€โ”€ MetricCard.tsx # Dashboard metric cards โ”‚ โ”‚ โ”œโ”€โ”€ Timeline.tsx # Event timeline โ”‚ โ”‚ โ””โ”€โ”€ SidChainTracker.tsx # Visual SID chain progress โ”‚ โ”œโ”€โ”€ forms/ โ”‚ โ”‚ โ”œโ”€โ”€ FormField.tsx # Text input with validation โ”‚ โ”‚ โ”œโ”€โ”€ SelectField.tsx # Dropdown select โ”‚ โ”‚ โ”œโ”€โ”€ PhoneInput.tsx # Phone number input with formatting โ”‚ โ”‚ โ”œโ”€โ”€ EINInput.tsx # EIN input with XX-XXXXXXX formatting โ”‚ โ”‚ โ””โ”€โ”€ FormSection.tsx # Form section container โ”‚ โ””โ”€โ”€ shared/ โ”‚ โ”œโ”€โ”€ Button.tsx # Button with variants & loading state โ”‚ โ”œโ”€โ”€ Modal.tsx # Modal dialog โ”‚ โ”œโ”€โ”€ Toast.tsx # Toast notifications โ”‚ โ””โ”€โ”€ ComplianceChecklist.tsx # Checkbox list for compliance โ”‚ โ”œโ”€โ”€ hooks/ โ”‚ โ”œโ”€โ”€ useMCPApp.ts # Hook to access MCP context data โ”‚ โ””โ”€โ”€ useSmartAction.ts # Hook to call MCP tools from apps โ”‚ โ””โ”€โ”€ styles/ โ””โ”€โ”€ base.css # Global CSS variables & utilities ``` ## ๐Ÿ› ๏ธ Setup Instructions ### 1. Install Dependencies ```bash cd a2p-autopilot/mcp-app npm install ``` ### 2. Build UI Apps ```bash npm run build:ui ``` This runs `build-all.js`, which builds all 4 apps as single-file HTML bundles: - `dist/app-ui/registration-wizard.html` - `dist/app-ui/dashboard.html` - `dist/app-ui/submission-detail.html` - `dist/app-ui/landing-preview.html` ### 3. Test the Server ```bash npm run serve ``` The server runs on stdio. Test by piping JSON-RPC commands: ```bash echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | npm run serve ``` ### 4. Add to Claude Desktop Edit `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json { "mcpServers": { "a2p-autopilot": { "command": "node", "args": [ "/Users/jakeshore/.clawdbot/workspace/a2p-autopilot/mcp-app/server.ts" ], "env": { "A2P_API_URL": "http://localhost:3100", "USE_MOCK_DATA": "true" } } } } ``` Restart Claude Desktop. ## ๐Ÿงช Testing ### Using Mock Data (Default) The server defaults to `USE_MOCK_DATA=true`, which uses the 10 realistic mock submissions in `src/mock-data.ts`. ### Using Live API Set `USE_MOCK_DATA=false` and ensure the A2P AutoPilot backend is running on `localhost:3100`. ### Test Commands in Claude ``` Open the A2P registration wizard Show me the A2P dashboard View submission sub_1 Preview landing pages for sub_1 ``` ## ๐Ÿ“Š MCP Tools ### UI Tools (Model + App Visible) 1. **a2p_registration_wizard** โ€” Opens multi-step registration form - Optional: `externalId` to pre-fill data - Returns: `ui://a2p/registration-wizard` 2. **a2p_dashboard** โ€” Opens submissions dashboard - Optional: `status` filter - Returns: `ui://a2p/dashboard` with submissions & stats 3. **a2p_view_submission** โ€” Opens detailed submission view - Required: `submissionId` - Returns: `ui://a2p/submission-detail` with full data 4. **a2p_preview_landing** โ€” Previews landing pages - Required: `submissionId` - Returns: `ui://a2p/landing-preview` with page URLs ### Backend Tools (App-Only Visibility) 5. **a2p_submit_registration** โ€” Submit new registration - Takes full `RegistrationInput` object - Returns: submission ID & status 6. **a2p_retry_submission** โ€” Retry failed submission - Required: `submissionId` 7. **a2p_cancel_submission** โ€” Cancel pending submission - Required: `submissionId` 8. **a2p_check_status** โ€” Refresh submission status - Required: `submissionId` 9. **a2p_get_stats** โ€” Get dashboard statistics - Returns: counts by status, success rate ## ๐ŸŽจ UI Features ### Registration Wizard - 5-step form: Business Info โ†’ Authorized Rep โ†’ Address โ†’ Campaign โ†’ Review - Form validation with real-time feedback - Pre-fill support via `externalId` - EIN & phone number formatting - Industry & use case dropdowns ### Dashboard - Metric cards: Total, Completed, Pending, Success Rate - Status filter buttons - Sortable submissions table - Click any row to view details ### Submission Detail - Current status with badge - Failure reason display (if applicable) - Full SID chain tracker (10 Twilio SIDs) - Activity timeline with timestamps - Retry/Cancel/Refresh actions - Business & campaign details - Remediation history ### Landing Preview - 3-page preview: Landing, Privacy Policy, Terms - Tab navigation - Generated content based on campaign data - Sample messages display - Opt-in/opt-out instructions ## ๐Ÿ”ง Development ### Run Single App in Dev Mode ```bash cd apps/registration-wizard npx vite ``` Opens on `http://localhost:5173` with hot reload. ### Rebuild After Changes ```bash npm run build:ui ``` ### Add New Component 1. Create in `components/{category}/` 2. Import in app: `import { MyComponent } from '../../components/{category}/MyComponent'` 3. Use Tailwind classes for styling ## ๐Ÿ“ Type Safety All types are imported from `../src/types.ts`: - `RegistrationInput` - `SubmissionRecord` - `SubmissionStatus` - `SidChain` - Business/Campaign enums ## ๐Ÿš€ Next Steps 1. **Connect to Real API**: Set `USE_MOCK_DATA=false` and test with live backend 2. **Add More Tools**: - `a2p_bulk_import` for CSV imports - `a2p_export_report` for analytics 3. **Enhance UI**: - Add charts to dashboard (success rate over time) - Add search/sort to table - Add bulk actions (retry multiple submissions) 4. **Add Notifications**: Show real-time status updates via webhooks ## ๐Ÿ› Troubleshooting ### "Resource not found" error - Run `npm run build:ui` to generate HTML bundles - Check `dist/app-ui/` contains 4 HTML files ### Server won't start - Verify `node` and `tsx` are installed: `npm install -g tsx` - Check logs: `npm run serve 2>&1 | tee server.log` ### UI doesn't show data - Verify `window.mcpContext` is set (check browser console) - Check mock data in `src/mock-data.ts` ## ๐Ÿ“ฆ Production Checklist - [ ] Build all apps: `npm run build:ui` - [ ] Set `USE_MOCK_DATA=false` - [ ] Configure `A2P_API_URL` to production endpoint - [ ] Test all 9 tools in Claude Desktop - [ ] Verify error handling (network failures, validation errors) - [ ] Check mobile responsiveness (Tailwind is mobile-first) - [ ] Add logging/monitoring for tool calls --- **Built by**: Subagent (a2p-mcp-server) **Date**: February 3, 2026 **Status**: โœ… Ready for testing