diff --git a/.agent/AGENTS.md b/.agent/AGENTS.md index 5eeac02051..fbdad5ae77 100644 --- a/.agent/AGENTS.md +++ b/.agent/AGENTS.md @@ -357,8 +357,8 @@ See `workflows/session-manager.md` for full session lifecycle guidance. | `seo.md` | SEO optimization and analysis | | `content.md` | Content creation workflows | | `research.md` | Research and analysis tasks | -| `marketing.md` | Marketing strategy | -| `sales.md` | Sales operations | +| `marketing.md` | Marketing strategy, email campaigns, automation (FluentCRM) | +| `sales.md` | Sales operations, CRM, pipeline management (FluentCRM) | | `legal.md` | Legal compliance | | `accounts.md` | Financial operations | | `health.md` | Health and wellness | @@ -396,6 +396,7 @@ Subagents provide specialized capabilities. Read them when tasks require domain | `services/hosting/` | Hosting providers - DNS, domains, cloud servers, managed WordPress | hostinger, hetzner, cloudflare, cloudron, closte, 101domains, spaceship | | `services/email/` | Email services - transactional email, deliverability | ses | | `services/communications/` | Communications platform - SMS, voice, WhatsApp, verify, recordings | twilio, telfon | +| `services/crm/` | CRM integration - contact management, email marketing, automation | fluentcrm | | `services/accounting/` | Accounting integration - invoicing, expenses, financial reports | quickfile | | `workflows/` | Development processes - branching, releases, PR reviews, quality gates | git-workflow, plans, release, version-bump, pr, preflight, postflight, ralph-loop, session-review | | `templates/` | Document templates - PRDs, task lists, planning documents | prd-template, tasks-template, plans-template, todo-template | @@ -458,6 +459,7 @@ For AI-assisted setup guidance, see `aidevops/setup.md`. | WordPress work | `tools/wordpress/wp-dev.md`, `tools/wordpress/mainwp.md` | | SEO analysis | `seo/dataforseo.md`, `seo/google-search-console.md` | | Sitemap submission | `seo/gsc-sitemaps.md` | +| CRM/email marketing | `services/crm/fluentcrm.md` | | MCP development | `tools/build-mcp/build-mcp.md`, `tools/build-mcp/server-patterns.md` | | Agent design | `tools/build-agent/build-agent.md`, `tools/build-agent/agent-review.md` | | Database migrations | `workflows/sql-migrations.md` | diff --git a/.agent/aidevops/add-new-mcp-to-aidevops.md b/.agent/aidevops/add-new-mcp-to-aidevops.md index 8b6dda9ded..ee3099e8c6 100644 --- a/.agent/aidevops/add-new-mcp-to-aidevops.md +++ b/.agent/aidevops/add-new-mcp-to-aidevops.md @@ -42,9 +42,23 @@ tools: **MCP Tool Enablement Strategy**: -- **Global**: Disabled (`"mcp-name_*": false` in tools section) -- **Per-Agent**: Enabled only for agents that need it -- **Rationale**: Context efficiency - each agent only loads needed MCPs +- **Global Config**: Disabled (`"enabled": false` in opencode.json) +- **Subagent Only**: Enable `mcp-name_*: true` in the subagent's `tools:` section +- **Never in Main Agents**: Main agents (sales.md, marketing.md, etc.) reference subagents but never enable MCPs directly +- **Rationale**: Context efficiency - MCP only loads when subagent is invoked + +**Correct Pattern**: + +```yaml +# In services/crm/fluentcrm.md (SUBAGENT) - CORRECT +tools: + fluentcrm_*: true # MCP enabled here + +# In sales.md (MAIN AGENT) - references subagent, no MCP +tools: + read: true + # NO fluentcrm_* here - main agents don't enable MCPs +``` **Related Agents to Call**: diff --git a/.agent/aidevops/mcp-integrations.md b/.agent/aidevops/mcp-integrations.md index 34c6f5d242..a9dd43cca1 100644 --- a/.agent/aidevops/mcp-integrations.md +++ b/.agent/aidevops/mcp-integrations.md @@ -58,6 +58,10 @@ This document provides comprehensive setup and usage instructions for advanced M - **Next.js DevTools MCP**: Next.js development and debugging assistance +### **📧 CRM & Marketing** + +- **FluentCRM MCP**: WordPress CRM with contacts, campaigns, automations, and email marketing + ### **📚 Legacy MCP Servers (from MCP-SERVERS.md)** - **Context7 MCP**: Real-time documentation access for development libraries @@ -130,6 +134,61 @@ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json" claude mcp add google-search-console npx mcp-server-gsc@latest ``` +### **FluentCRM MCP** + +**Note**: The FluentCRM MCP server is not published to npm. It requires cloning and building locally. + +```bash +# 1. Clone and build the MCP server +mkdir -p ~/.local/share/mcp-servers +cd ~/.local/share/mcp-servers +git clone https://github.com/netflyapp/fluentcrm-mcp-server.git +cd fluentcrm-mcp-server +npm install +npm run build + +# 2. Store credentials in ~/.config/aidevops/mcp-env.sh: +export FLUENTCRM_API_URL="https://your-domain.com/wp-json/fluent-crm/v2" +export FLUENTCRM_API_USERNAME="your_username" +export FLUENTCRM_API_PASSWORD="your_application_password" +``` + +**For OpenCode** - use bash wrapper pattern (disabled globally, enabled per-agent): + +```json +{ + "fluentcrm": { + "type": "local", + "command": ["/bin/bash", "-c", "source ~/.config/aidevops/mcp-env.sh && node ~/.local/share/mcp-servers/fluentcrm-mcp-server/dist/fluentcrm-mcp-server.js"], + "enabled": false + } +} +``` + +**For Claude Desktop**: + +```json +{ + "mcpServers": { + "fluentcrm": { + "command": "node", + "args": ["~/.local/share/mcp-servers/fluentcrm-mcp-server/dist/fluentcrm-mcp-server.js"], + "env": { + "FLUENTCRM_API_URL": "https://your-domain.com/wp-json/fluent-crm/v2", + "FLUENTCRM_API_USERNAME": "your_username", + "FLUENTCRM_API_PASSWORD": "your_application_password" + } + } + } +} +``` + +**Per-Agent Enablement**: The `services/crm/fluentcrm.md` subagent has `fluentcrm_*: true` in its tools section. Main agents (`sales.md`, `marketing.md`) reference this subagent for CRM operations. + +**Available Tools**: Contacts, Tags, Lists, Campaigns, Email Templates, Automations, Webhooks, Smart Links, Dashboard Stats. + +See `services/crm/fluentcrm.md` for detailed documentation. + ## 🔧 **Configuration Examples** ### **Advanced Chrome DevTools Configuration** diff --git a/.agent/marketing.md b/.agent/marketing.md index 438d506106..c989f37324 100644 --- a/.agent/marketing.md +++ b/.agent/marketing.md @@ -2,6 +2,14 @@ name: marketing description: Marketing strategy and campaigns - digital marketing, analytics, brand management mode: subagent +tools: + read: true + write: true + edit: true + bash: true + glob: true + grep: true + webfetch: true --- # Marketing - Main Agent @@ -10,53 +18,423 @@ mode: subagent ## Quick Reference -- **Purpose**: Marketing strategy and execution -- **Status**: Stub - extend as needed +- **Purpose**: Marketing strategy, campaign execution, and analytics +- **CRM Integration**: FluentCRM MCP for email marketing and automation **Related Agents**: -- `content.md` - Content creation + +- `content.md` - Content creation and copywriting - `seo.md` - Search optimization -- `sales.md` - Sales alignment +- `sales.md` - Sales alignment and lead handoff +- `services/crm/fluentcrm.md` - CRM operations (detailed) + +**FluentCRM MCP Tools**: + +| Category | Key Tools | +|----------|-----------| +| **Campaigns** | `fluentcrm_list_campaigns`, `fluentcrm_create_campaign`, `fluentcrm_pause_campaign`, `fluentcrm_resume_campaign` | +| **Templates** | `fluentcrm_list_email_templates`, `fluentcrm_create_email_template` | +| **Automations** | `fluentcrm_list_automations`, `fluentcrm_create_automation` | +| **Lists** | `fluentcrm_list_lists`, `fluentcrm_create_list`, `fluentcrm_attach_contact_to_list` | +| **Tags** | `fluentcrm_list_tags`, `fluentcrm_create_tag`, `fluentcrm_attach_tag_to_contact` | +| **Smart Links** | `fluentcrm_create_smart_link`, `fluentcrm_generate_smart_link_shortcode` | +| **Reports** | `fluentcrm_dashboard_stats` | **Typical Tasks**: -- Campaign planning -- Channel strategy -- Messaging development -- Performance analysis + +- Email campaign creation and management +- Marketing automation setup +- Audience segmentation +- Lead nurturing sequences +- Campaign performance analysis -## Marketing Workflows +## Email Marketing + +### FluentCRM Setup + +FluentCRM provides self-hosted email marketing with full API access via MCP. + +**Prerequisites**: + +1. FluentCRM plugin installed on WordPress +2. Application password created for API access +3. FluentCRM MCP server configured +4. Email sending configured (SMTP or SES) + +**Environment Setup**: + +> **Security Note**: Never commit actual credentials to version control. Store environment variables in `~/.config/aidevops/mcp-env.sh` (600 permissions). Rotate application passwords regularly. + +```bash +# Add to ~/.config/aidevops/mcp-env.sh +export FLUENTCRM_API_URL="https://your-domain.com/wp-json/fluent-crm/v2" +export FLUENTCRM_API_USERNAME="your_username" +export FLUENTCRM_API_PASSWORD="your_application_password" +``` + +See `.agent/services/crm/fluentcrm.md` for detailed setup instructions. + +## Campaign Management + +### Campaign Types + +| Type | Use Case | FluentCRM Feature | +|------|----------|-------------------| +| **Newsletter** | Regular updates | Email Campaign | +| **Promotional** | Sales and offers | Email Campaign | +| **Nurture** | Lead education | Automation Funnel | +| **Transactional** | Order confirmations | Automation Funnel | +| **Re-engagement** | Win back inactive | Automation Funnel | + +### Creating a Campaign + +```text +1. Create email template + fluentcrm_create_email_template with: + - title: "Campaign Name - Template" + - subject: "Your Subject Line" + - body: HTML content + +2. Create campaign + fluentcrm_create_campaign with: + - title: "Campaign Name" + - subject: "Email Subject" + - template_id: template ID from step 1 + - recipient_list: [list IDs] + +3. Review in FluentCRM admin +4. Schedule or send immediately +``` + +### Campaign Workflow + +1. **Plan** - Define goals, audience, messaging +2. **Create** - Build template and campaign +3. **Test** - Send test emails, check rendering +4. **Schedule** - Set send time for optimal engagement +5. **Monitor** - Track opens, clicks, conversions +6. **Optimize** - A/B test and improve + +## Email Templates + +### Template Best Practices + +| Element | Best Practice | +|---------|---------------| +| **Subject** | 40-60 chars, personalized, clear value | +| **Preheader** | Complement subject, 40-100 chars | +| **Header** | Logo, clear branding | +| **Body** | Single column, scannable, mobile-first | +| **CTA** | Clear, contrasting button, above fold | +| **Footer** | Unsubscribe link, contact info, social | + +### Template Variables + +FluentCRM supports personalization: + +```html +{{contact.first_name}} - First name +{{contact.last_name}} - Last name +{{contact.email}} - Email address +{{contact.full_name}} - Full name +{{contact.custom.field_name}} - Custom fields +``` + +### Creating Templates + +```text +fluentcrm_create_email_template with: +- title: "Welcome Email Template" +- subject: "Welcome to {{company_name}}, {{contact.first_name}}!" +- body: "..." +``` + +## Marketing Automation + +### Automation Triggers + +| Trigger | Use Case | +|---------|----------| +| `tag_added` | When tag is applied | +| `list_added` | When contact joins list | +| `form_submitted` | When form is completed | +| `link_clicked` | When email link is clicked | +| `email_opened` | When email is opened | + +### Common Automation Sequences + +#### Welcome Sequence + +```text +Trigger: list_added (Newsletter list) +Day 0: Welcome email +Day 2: Value content email +Day 5: Product introduction +Day 7: Social proof / testimonials +Day 10: Soft CTA +``` + +#### Lead Nurture Sequence + +```text +Trigger: tag_added (lead-mql) +Day 0: Educational content +Day 3: Case study +Day 7: Comparison guide +Day 10: Demo invitation +Day 14: Follow-up if no response +``` + +#### Re-engagement Sequence + +```text +Trigger: tag_added (inactive-90-days) +Day 0: "We miss you" email +Day 3: Best content roundup +Day 7: Special offer +Day 14: Last chance + unsubscribe option +``` + +### Creating Automations + +```text +fluentcrm_create_automation with: +- title: "Welcome Sequence" +- description: "New subscriber welcome series" +- trigger: "list_added" + +Then configure steps in FluentCRM admin: +1. Add email actions +2. Set delays between emails +3. Add conditions and branches +4. Set exit conditions +``` + +## Audience Segmentation + +### Segmentation Strategies + +| Segment Type | Tags/Lists | Use Case | +|--------------|------------|----------| +| **Demographic** | industry-*, company-size-* | Targeted messaging | +| **Behavioral** | engaged-*, downloaded-* | Engagement-based | +| **Lifecycle** | lead-*, customer-* | Stage-appropriate | +| **Interest** | interest-*, product-* | Relevant content | +| **Source** | source-*, campaign-* | Attribution | + +### Creating Segments + +```text +# Create list for segment +fluentcrm_create_list with: +- title: "Enterprise Prospects" +- slug: "enterprise-prospects" +- description: "Companies with 500+ employees interested in enterprise plan" + +# Add contacts matching criteria +fluentcrm_attach_contact_to_list with subscriberId and listIds +``` + +### Dynamic Segmentation + +Use tags for dynamic segments that update automatically: + +```text +# Create behavior tags +fluentcrm_create_tag with: +- title: "Engaged - Last 30 Days" +- slug: "engaged-30-days" + +# Automation applies/removes based on activity +``` + +## Smart Links + +### Trackable Links + +Smart Links track clicks and can trigger actions: + +```text +fluentcrm_create_smart_link with: +- title: "Product Demo CTA" +- slug: "demo-cta" +- target_url: "https://your-site.com/demo" +- apply_tags: [tag_id for 'clicked-demo-cta'] +``` + +### Use Cases + +| Use Case | Configuration | +|----------|---------------| +| **Content tracking** | Apply interest tags on click | +| **Lead scoring** | Apply engagement tags | +| **Segmentation** | Add to lists on click | +| **Retargeting** | Tag for ad audiences | + +### Generating Shortcodes + +```text +fluentcrm_generate_smart_link_shortcode with: +- slug: "demo-cta" +- linkText: "Request a Demo" + +Returns: Request a Demo +``` + +## Content Marketing Integration + +### Content to Campaign Workflow + +1. **Create content** using `content.md` agent +2. **Optimize for SEO** using `seo.md` agent +3. **Create email** promoting content +4. **Segment audience** by interest +5. **Send campaign** to relevant segments +6. **Track engagement** and conversions + +### Content Promotion Campaigns + +```text +# For each new blog post: +1. Create email template with post excerpt +2. Create campaign targeting relevant interest tags +3. Add smart link to track clicks +4. Schedule for optimal send time +``` + +## Lead Generation + +### Lead Magnet Workflow + +1. **Create lead magnet** (ebook, guide, template) +2. **Create landing page** with form +3. **Create FluentCRM list** for leads +4. **Set up automation** for delivery +5. **Create nurture sequence** for follow-up + +### Form Integration + +FluentCRM integrates with: + +- Fluent Forms +- WPForms +- Gravity Forms +- Contact Form 7 +- Custom forms via API + +### Lead Handoff to Sales + +```text +# When lead is qualified: +1. Apply 'lead-mql' tag +2. Automation notifies sales team +3. Sales reviews and accepts +4. Apply 'lead-sql' tag +5. Remove from marketing sequences +``` + +## Analytics & Reporting + +### Key Metrics + +| Metric | Target | How to Improve | +|--------|--------|----------------| +| **Open Rate** | 20-30% | Better subjects, send time | +| **Click Rate** | 2-5% | Better CTAs, content | +| **Conversion Rate** | 1-3% | Landing page optimization | +| **Unsubscribe Rate** | <0.5% | Better targeting, frequency | +| **List Growth** | 5-10%/mo | More lead magnets, promotion | + +### Dashboard Stats + +```text +fluentcrm_dashboard_stats + +Returns: +- Total contacts +- New contacts this period +- Email engagement metrics +- Campaign performance +``` + +### Campaign Analysis + +After each campaign: + +1. Review open and click rates +2. Analyze by segment performance +3. Identify top-performing content +4. Note unsubscribes and complaints +5. Document learnings for future + +## A/B Testing + +### What to Test + +| Element | Test Ideas | +|---------|------------| +| **Subject Line** | Length, personalization, emoji | +| **Send Time** | Day of week, time of day | +| **From Name** | Company vs. person | +| **CTA** | Button text, color, placement | +| **Content** | Long vs. short, format | + +### Testing Process + +1. Create two template variations +2. Split audience randomly +3. Send to small test group (10-20%) +4. Wait for results (24-48 hours) +5. Send winner to remaining audience + +## Best Practices + +### Email Deliverability + +- Warm up new sending domains +- Maintain clean lists (remove bounces) +- Use double opt-in +- Monitor sender reputation +- Authenticate with SPF, DKIM, DMARC + +### List Hygiene + +- Remove hard bounces immediately +- Re-engage or remove inactive (90+ days) +- Honor unsubscribes instantly +- Validate emails on import -### Campaign Planning +### Compliance -- Define objectives and KPIs -- Identify target audience -- Select channels -- Create timeline -- Allocate resources +| Regulation | Requirements | +|------------|--------------| +| **GDPR** | Explicit consent, right to erasure | +| **CAN-SPAM** | Unsubscribe link, physical address | +| **CASL** | Express consent, identification | -### Content Marketing +### Frequency -Integrate with `content.md` for: -- Blog content strategy -- Social media content -- Email campaigns -- Lead magnets +- Newsletter: Weekly or bi-weekly +- Promotional: 2-4 per month max +- Transactional: As needed +- Nurture: Spaced 2-5 days apart -### SEO Integration +## Troubleshooting -Coordinate with `seo.md` for: -- Keyword-targeted content -- Technical SEO requirements -- Performance tracking +### Common Issues -### Analytics +| Issue | Solution | +|-------|----------| +| Low open rates | Test subjects, check deliverability | +| High unsubscribes | Review frequency, improve targeting | +| Bounces | Clean list, validate emails | +| Spam complaints | Better consent, relevant content | +| Template rendering | Test across email clients | -Track and analyze: -- Traffic sources -- Conversion rates -- Campaign ROI -- Audience engagement +### Getting Help -*Extend this agent with specific marketing tools and workflows as needed.* +- FluentCRM Docs: https://fluentcrm.com/docs/ +- FluentCRM REST API: https://rest-api.fluentcrm.com/ +- See `.agent/services/crm/fluentcrm.md` for detailed troubleshooting diff --git a/.agent/sales.md b/.agent/sales.md index 811aad351e..0f806061dd 100644 --- a/.agent/sales.md +++ b/.agent/sales.md @@ -2,6 +2,14 @@ name: sales description: Sales operations and CRM - lead management, pipeline tracking, sales automation mode: subagent +tools: + read: true + write: true + edit: true + bash: true + glob: true + grep: true + webfetch: true --- # Sales - Main Agent @@ -10,48 +18,316 @@ mode: subagent ## Quick Reference -- **Purpose**: Sales operations and strategy -- **Status**: Stub - extend as needed +- **Purpose**: Sales operations, CRM management, and pipeline tracking +- **CRM Integration**: FluentCRM MCP for WordPress-based CRM **Related Agents**: -- `marketing.md` - Lead generation -- `content.md` - Sales collateral -- `services/accounting/quickfile.md` - Invoicing + +- `marketing.md` - Lead generation and campaigns +- `content.md` - Sales collateral and proposals +- `services/accounting/quickfile.md` - Invoicing and payments +- `.agent/services/crm/fluentcrm.md` - CRM operations (detailed) + +**FluentCRM MCP Tools**: + +| Category | Key Tools | +|----------|-----------| +| **Contacts** | `fluentcrm_list_contacts`, `fluentcrm_get_contact`, `fluentcrm_create_contact`, `fluentcrm_update_contact`, `fluentcrm_delete_contact`, `fluentcrm_find_contact_by_email` | +| **Tags** | `fluentcrm_list_tags`, `fluentcrm_create_tag`, `fluentcrm_delete_tag`, `fluentcrm_attach_tag_to_contact`, `fluentcrm_detach_tag_from_contact` | +| **Lists** | `fluentcrm_list_lists`, `fluentcrm_create_list`, `fluentcrm_delete_list`, `fluentcrm_attach_contact_to_list`, `fluentcrm_detach_contact_from_list` | +| **Campaigns** | `fluentcrm_list_campaigns`, `fluentcrm_create_campaign`, `fluentcrm_pause_campaign`, `fluentcrm_resume_campaign`, `fluentcrm_delete_campaign` | +| **Templates** | `fluentcrm_list_email_templates`, `fluentcrm_create_email_template` | +| **Automations** | `fluentcrm_list_automations`, `fluentcrm_create_automation` | +| **Webhooks** | `fluentcrm_list_webhooks`, `fluentcrm_create_webhook` | +| **Smart Links** | `fluentcrm_list_smart_links`, `fluentcrm_create_smart_link`, `fluentcrm_generate_smart_link_shortcode`, `fluentcrm_validate_smart_link_data` | +| **Reports** | `fluentcrm_dashboard_stats`, `fluentcrm_custom_fields` | **Typical Tasks**: -- Pipeline management -- Proposal creation -- Quote generation -- CRM operations + +- Lead capture and qualification +- Pipeline stage management +- Contact segmentation +- Sales automation setup +- Quote and proposal generation -## Sales Workflows +## CRM Integration + +### FluentCRM Setup + +FluentCRM provides a self-hosted WordPress CRM with full API access via MCP. + +**Prerequisites**: + +1. FluentCRM plugin installed on WordPress +2. Application password created for API access +3. FluentCRM MCP server configured + +**Environment Setup**: + +> **Security Note**: Never commit actual credentials to version control. Store environment variables in `~/.config/aidevops/mcp-env.sh` (600 permissions). Rotate application passwords regularly. + +```bash +# Add to ~/.config/aidevops/mcp-env.sh +export FLUENTCRM_API_URL="https://your-domain.com/wp-json/fluent-crm/v2" +export FLUENTCRM_API_USERNAME="your_username" +export FLUENTCRM_API_PASSWORD="your_application_password" +``` + +See `.agent/services/crm/fluentcrm.md` for detailed setup instructions. + +## Lead Management + +### Lead Capture + +When a new lead comes in: + +```text +1. Use fluentcrm_create_contact with lead details +2. Apply source tag: fluentcrm_attach_tag_to_contact with tagIds (numeric IDs) + - First use fluentcrm_list_tags to get tag IDs for tags like 'lead-source-website' +3. Add to nurture list: fluentcrm_attach_contact_to_list with listIds (numeric IDs) +4. Automation triggers welcome sequence +``` + +**Note**: FluentCRM MCP uses numeric IDs for tags and lists, not slugs. Use `fluentcrm_list_tags` or `fluentcrm_list_lists` to get IDs. + +### Lead Qualification + +Use tags to track qualification status: + +| Tag | Meaning | +|-----|---------| +| `lead-new` | Unqualified lead | +| `lead-mql` | Marketing Qualified Lead | +| `lead-sql` | Sales Qualified Lead | +| `lead-opportunity` | Active opportunity | +| `lead-customer` | Converted customer | +| `lead-lost` | Lost opportunity | + +### Lead Scoring + +Track engagement with behavior tags: + +| Tag | Trigger | +|-----|---------| +| `engaged-email-open` | Opened marketing email | +| `engaged-email-click` | Clicked email link | +| `engaged-website-visit` | Visited key pages | +| `engaged-content-download` | Downloaded content | +| `engaged-demo-request` | Requested demo | + +## Pipeline Management + +### Pipeline Stages + +Map pipeline stages to FluentCRM tags: + +| Stage | Tag | Actions | +|-------|-----|---------| +| **Prospect** | `stage-prospect` | Initial outreach | +| **Discovery** | `stage-discovery` | Needs assessment | +| **Proposal** | `stage-proposal` | Quote sent | +| **Negotiation** | `stage-negotiation` | Terms discussion | +| **Closed Won** | `stage-closed-won` | Deal completed | +| **Closed Lost** | `stage-closed-lost` | Deal lost | + +### Moving Through Pipeline + +```text +# Move contact to next stage +1. fluentcrm_detach_tag_from_contact with current stage tag +2. fluentcrm_attach_tag_to_contact with new stage tag +3. Update custom fields with stage date +``` + +### Pipeline Reporting + +```text +# Get pipeline overview +1. fluentcrm_list_contacts with search for each stage tag +2. Calculate totals and conversion rates +3. Use fluentcrm_dashboard_stats for overall metrics +``` + +## Sales Automation + +### Automated Follow-ups + +Create automations in FluentCRM for: + +| Trigger | Action | +|---------|--------| +| New lead created | Send welcome email | +| No response 3 days | Send follow-up | +| Email opened | Notify sales rep | +| Link clicked | Update engagement score | +| Demo requested | Create task for sales | + +### Sequence Management + +```text +# Create nurture sequence +1. fluentcrm_create_automation with trigger 'tag_added' +2. Configure email sequence in FluentCRM admin +3. Set delays between emails +4. Add exit conditions (replied, converted, unsubscribed) +``` + +## Contact Segmentation + +### Segment by Interest + +```text +# Tag contacts by product interest +fluentcrm_attach_tag_to_contact with: +- interest-product-a +- interest-product-b +- interest-enterprise +``` + +### Segment by Company Size + +```text +# Tag by company size +- company-size-smb +- company-size-mid-market +- company-size-enterprise +``` + +### Segment by Industry + +```text +# Tag by industry +- industry-saas +- industry-ecommerce +- industry-agency +- industry-healthcare +``` + +## Proposal Creation + +### Proposal Workflow + +1. **Gather requirements** from discovery calls +2. **Create proposal** using content templates +3. **Generate quote** with pricing +4. **Send proposal** via email or link +5. **Track engagement** with smart links +6. **Follow up** based on activity + +### Smart Link Tracking + +```text +# Create trackable proposal link +fluentcrm_create_smart_link with: +- title: "Proposal - {Company Name}" +- slug: "proposal-{company-slug}" +- target_url: proposal URL +- apply_tags: [tag_id] (numeric ID for 'proposal-viewed' tag) +``` + +## Quote Generation + +### Quote to Invoice Flow + +1. **Create quote** in proposal +2. **Get approval** from prospect +3. **Convert to invoice** via QuickFile integration +4. **Track payment** status + +See `.agent/services/accounting/quickfile.md` for invoice generation. + +## Sales Reporting + +### Key Metrics + +| Metric | How to Calculate | +|--------|------------------| +| **Lead Volume** | Count contacts with `lead-new` tag by date | +| **Conversion Rate** | `stage-closed-won` / total opportunities | +| **Pipeline Value** | Sum of opportunity values by stage | +| **Sales Velocity** | Average time from lead to close | +| **Win Rate** | Won deals / (Won + Lost deals) | + +### Dashboard Stats + +```text +# Get CRM dashboard stats +fluentcrm_dashboard_stats + +Returns: +- Total contacts +- New contacts this period +- Email engagement metrics +- Campaign performance +``` + +## Integration with Marketing + +### Lead Handoff + +When marketing qualifies a lead: + +```text +1. Marketing applies 'lead-mql' tag +2. Automation notifies sales team +3. Sales reviews and accepts/rejects +4. If accepted, apply 'lead-sql' tag +5. Begin sales sequence +``` + +### Feedback Loop + +```text +# Sales provides feedback to marketing +1. Tag leads with quality indicators + - lead-quality-high + - lead-quality-medium + - lead-quality-low +2. Tag with rejection reasons + - rejected-budget + - rejected-timing + - rejected-fit +``` + +## Best Practices + +### Contact Management + +- Keep contact data current +- Use consistent naming for tags +- Document custom field usage +- Regular data cleanup -### Pipeline Management +### Pipeline Hygiene -- Lead qualification -- Opportunity tracking -- Forecast modeling -- Win/loss analysis +- Update stages promptly +- Add notes to contact records +- Set follow-up reminders +- Review stale opportunities weekly -### Proposal Creation +### Automation -Integrate with content tools for: -- Proposal templates -- Pricing documents -- Case studies -- ROI calculators +- Test automations before activating +- Monitor automation performance +- Don't over-automate personal touches +- Review and update sequences quarterly -### CRM Integration +## Troubleshooting -*Add CRM-specific subagents as needed* +### Common Issues -### Accounting Integration +| Issue | Solution | +|-------|----------| +| Contact not found | Check email spelling, use `fluentcrm_find_contact_by_email` | +| Tag not applying | Verify tag ID exists with `fluentcrm_list_tags` | +| Automation not triggering | Check trigger conditions in FluentCRM admin | +| API errors | Verify credentials and API URL | -Use `services/accounting/quickfile.md` for: -- Invoice generation -- Quote to invoice conversion -- Payment tracking +### Getting Help -*Extend this agent with specific sales tools and CRM integrations as needed.* +- FluentCRM Docs: https://fluentcrm.com/docs/ +- FluentCRM REST API: https://rest-api.fluentcrm.com/ +- See `.agent/services/crm/fluentcrm.md` for detailed troubleshooting diff --git a/.agent/services/crm/fluentcrm.md b/.agent/services/crm/fluentcrm.md new file mode 100644 index 0000000000..4729d7d445 --- /dev/null +++ b/.agent/services/crm/fluentcrm.md @@ -0,0 +1,449 @@ +--- +description: FluentCRM MCP - WordPress CRM with email marketing, automation, and contact management +mode: subagent +tools: + read: true + write: false + edit: false + bash: true + glob: true + grep: true + webfetch: true + fluentcrm_*: true +--- + +# FluentCRM MCP Integration + + + +## Quick Reference + +- **Type**: WordPress CRM plugin with REST API +- **MCP Server**: `fluentcrm-mcp-server` (local build from GitHub) +- **Auth**: WordPress Basic Auth (username + application password) +- **API Base**: `https://your-domain.com/wp-json/fluent-crm/v2` +- **Capabilities**: Contacts, Tags, Lists, Campaigns, Automations, Email Templates, Webhooks, Smart Links + +**Environment Variables**: + +```bash +export FLUENTCRM_API_URL="https://your-domain.com/wp-json/fluent-crm/v2" +export FLUENTCRM_API_USERNAME="your_username" +export FLUENTCRM_API_PASSWORD="your_application_password" +``` + +**MCP Tools Available**: + +| Category | Tools | +|----------|-------| +| **Contacts** | `fluentcrm_list_contacts`, `fluentcrm_get_contact`, `fluentcrm_find_contact_by_email`, `fluentcrm_create_contact`, `fluentcrm_update_contact`, `fluentcrm_delete_contact` | +| **Tags** | `fluentcrm_list_tags`, `fluentcrm_create_tag`, `fluentcrm_delete_tag`, `fluentcrm_attach_tag_to_contact`, `fluentcrm_detach_tag_from_contact` | +| **Lists** | `fluentcrm_list_lists`, `fluentcrm_create_list`, `fluentcrm_delete_list`, `fluentcrm_attach_contact_to_list`, `fluentcrm_detach_contact_from_list` | +| **Campaigns** | `fluentcrm_list_campaigns`, `fluentcrm_create_campaign`, `fluentcrm_pause_campaign`, `fluentcrm_resume_campaign`, `fluentcrm_delete_campaign` | +| **Templates** | `fluentcrm_list_email_templates`, `fluentcrm_create_email_template` | +| **Automations** | `fluentcrm_list_automations`, `fluentcrm_create_automation` | +| **Webhooks** | `fluentcrm_list_webhooks`, `fluentcrm_create_webhook` | +| **Smart Links** | `fluentcrm_list_smart_links`, `fluentcrm_create_smart_link`, `fluentcrm_generate_smart_link_shortcode` | +| **Reports** | `fluentcrm_dashboard_stats`, `fluentcrm_custom_fields` | + + + +FluentCRM is a self-hosted WordPress CRM and email marketing automation plugin. This MCP integration enables AI-assisted contact management, campaign creation, and marketing automation. + +## Installation + +### MCP Server Setup + +**Note**: The FluentCRM MCP server is not published to npm. It requires cloning and building locally from GitHub. + +```bash +# Clone and build the MCP server +mkdir -p ~/.local/share/mcp-servers +cd ~/.local/share/mcp-servers +git clone https://github.com/netflyapp/fluentcrm-mcp-server.git +cd fluentcrm-mcp-server +npm install +npm run build + +# Verify build succeeded +ls dist/fluentcrm-mcp-server.js +``` + +### OpenCode Configuration + +Add to `~/.config/opencode/opencode.json` (disabled globally for token efficiency): + +```json +{ + "mcp": { + "fluentcrm": { + "type": "local", + "command": ["/bin/bash", "-c", "source ~/.config/aidevops/mcp-env.sh && node ~/.local/share/mcp-servers/fluentcrm-mcp-server/dist/fluentcrm-mcp-server.js"], + "enabled": false + } + } +} +``` + +**Per-Agent Enablement**: FluentCRM tools are enabled via `fluentcrm_*: true` in this subagent's `tools:` section. Main agents (`sales.md`, `marketing.md`) reference this subagent for CRM operations, ensuring the MCP is only loaded when needed. + +### Claude Desktop Configuration + +Add to Claude Desktop MCP settings: + +```json +{ + "mcpServers": { + "fluentcrm": { + "command": "node", + "args": ["~/.local/share/mcp-servers/fluentcrm-mcp-server/dist/fluentcrm-mcp-server.js"], + "env": { + "FLUENTCRM_API_URL": "https://your-domain.com/wp-json/fluent-crm/v2", + "FLUENTCRM_API_USERNAME": "your_username", + "FLUENTCRM_API_PASSWORD": "your_application_password" + } + } + } +} +``` + +### WordPress Setup + +1. **Install FluentCRM** plugin on your WordPress site +2. **Create Application Password**: + - Go to Users > Your Profile + - Scroll to "Application Passwords" + - Create new password for API access +3. **Enable REST API** (usually enabled by default) +4. **Configure CORS** if accessing from different domain + +## Contact Management + +### List Contacts + +```text +Use fluentcrm_list_contacts to get all contacts +Parameters: +- page: Page number (default: 1) +- per_page: Records per page (default: 10) +- search: Search by email/name +``` + +### Create Contact + +```text +Use fluentcrm_create_contact with: +- email (required): Contact email +- first_name: First name +- last_name: Last name +- phone: Phone number +- address_line_1: Address +- city: City +- country: Country +``` + +### Find by Email + +```text +Use fluentcrm_find_contact_by_email to search for a specific contact +``` + +### Update Contact + +```text +Use fluentcrm_update_contact with subscriberId and fields to update +``` + +## Tag Management + +Tags are used for segmentation and automation triggers. + +### Common Tag Patterns + +| Pattern | Use Case | +|---------|----------| +| `lead-source-*` | Track where leads came from | +| `interest-*` | Track product/service interests | +| `stage-*` | Sales pipeline stages | +| `campaign-*` | Campaign participation | +| `behavior-*` | User behavior tracking | + +### Tag Operations + +```text +# List all tags +fluentcrm_list_tags + +# Create tag +fluentcrm_create_tag with title, slug, description + +# Attach tag to contact +fluentcrm_attach_tag_to_contact with subscriberId and tagIds array + +# Detach tag from contact +fluentcrm_detach_tag_from_contact with subscriberId and tagIds array +``` + +## List Management + +Lists are used for organizing contacts into groups for campaigns. + +### List Operations + +```text +# List all lists +fluentcrm_list_lists + +# Create list +fluentcrm_create_list with title, slug, description + +# Add contact to list +fluentcrm_attach_contact_to_list with subscriberId and listIds array + +# Remove contact from list +fluentcrm_detach_contact_from_list with subscriberId and listIds array +``` + +## Email Campaigns + +### Campaign Workflow + +1. **Create email template** with content +2. **Create campaign** with subject and recipient lists +3. **Review and schedule** campaign +4. **Monitor** delivery and engagement + +### Campaign Operations + +```text +# List campaigns +fluentcrm_list_campaigns + +# Create campaign +fluentcrm_create_campaign with: +- title: Campaign name +- subject: Email subject line +- template_id: Email template ID +- recipient_list: Array of list IDs + +# Pause/Resume campaign +fluentcrm_pause_campaign / fluentcrm_resume_campaign with campaignId +``` + +### Email Templates + +```text +# List templates +fluentcrm_list_email_templates + +# Create template +fluentcrm_create_email_template with: +- title: Template name +- subject: Default subject +- body: HTML content +``` + +## Marketing Automation + +### Automation Funnels + +FluentCRM automations (funnels) trigger actions based on events. + +```text +# List automations +fluentcrm_list_automations + +# Create automation +fluentcrm_create_automation with: +- title: Automation name +- description: Description +- trigger: Trigger type (e.g., 'tag_added', 'list_added', 'form_submitted') +``` + +### Common Automation Triggers + +| Trigger | Use Case | +|---------|----------| +| `tag_added` | When tag is applied to contact | +| `list_added` | When contact joins a list | +| `form_submitted` | When form is submitted | +| `link_clicked` | When email link is clicked | +| `email_opened` | When email is opened | + +## Smart Links + +Smart Links are trackable URLs that can apply tags/lists when clicked. + +### Smart Link Operations + +```text +# Create smart link +fluentcrm_create_smart_link with: +- title: Link name +- slug: URL slug +- target_url: Destination URL +- apply_tags: Tag IDs to add on click +- apply_lists: List IDs to add on click +- remove_tags: Tag IDs to remove on click +- remove_lists: List IDs to remove on click +- auto_login: Auto-login user on click + +# Generate shortcode +fluentcrm_generate_smart_link_shortcode with slug and optional linkText +``` + +**Note**: Smart Links API may not be available in all FluentCRM versions. Use the admin panel if API returns 404. + +## Webhooks + +### Webhook Configuration + +```text +# List webhooks +fluentcrm_list_webhooks + +# Create webhook +fluentcrm_create_webhook with: +- name: Webhook name +- url: Webhook URL +- status: 'pending' or 'subscribed' +- tags: Tag IDs to filter +- lists: List IDs to filter +``` + +### Webhook Events + +FluentCRM can send webhooks for: + +- Contact created/updated +- Tag added/removed +- List subscription changes +- Email events (sent, opened, clicked) +- Form submissions + +## Reports & Analytics + +### Dashboard Stats + +```text +# Get dashboard statistics +fluentcrm_dashboard_stats + +Returns: +- Total contacts +- New contacts (period) +- Email stats +- Campaign performance +``` + +### Custom Fields + +```text +# List custom fields +fluentcrm_custom_fields + +Returns all custom field definitions for contacts +``` + +## Sales Integration + +### Lead Management Workflow + +1. **Capture lead** via form or API +2. **Apply tags** based on source/interest +3. **Add to nurture list** +4. **Trigger automation** for follow-up +5. **Track engagement** via email opens/clicks +6. **Update tags** as lead progresses + +### Example: New Lead Processing + +```text +1. fluentcrm_create_contact with lead details +2. fluentcrm_attach_tag_to_contact with ['lead-new', 'source-website'] +3. fluentcrm_attach_contact_to_list with nurture list ID +4. Automation triggers welcome sequence +``` + +## Marketing Integration + +### Campaign Workflow + +1. **Segment audience** using tags/lists +2. **Create email template** with content +3. **Create campaign** targeting segments +4. **Schedule or send** campaign +5. **Monitor** opens, clicks, conversions +6. **Apply tags** based on engagement + +### Example: Product Launch Campaign + +```text +1. fluentcrm_create_list for launch audience +2. fluentcrm_create_email_template with launch content +3. fluentcrm_create_campaign targeting launch list +4. Create automation to tag engaged contacts +``` + +## Best Practices + +### Contact Data Quality + +- Always validate email before creating contacts +- Use consistent tag naming conventions +- Regularly clean inactive contacts +- Merge duplicate contacts + +### Email Deliverability + +- Warm up new sending domains +- Monitor bounce rates +- Honor unsubscribe requests immediately +- Use double opt-in for marketing lists + +### Automation Design + +- Keep automations simple and focused +- Test automations with test contacts first +- Monitor automation performance +- Document automation logic + +### GDPR Compliance + +- Obtain explicit consent for marketing +- Provide easy unsubscribe options +- Honor data deletion requests +- Document consent sources + +## Troubleshooting + +### Authentication Errors + +```bash +# Verify credentials +curl -u "username:app_password" \ + "https://your-domain.com/wp-json/fluent-crm/v2/subscribers" +``` + +### API Not Available + +- Ensure FluentCRM plugin is active +- Check WordPress REST API is enabled +- Verify permalink settings (not "Plain") +- Check for security plugins blocking API + +### Rate Limiting + +FluentCRM may rate limit API requests. For bulk operations: + +- Use pagination for large datasets +- Add delays between requests +- Consider batch operations where available + +## Related Documentation + +- `sales.md` - Sales workflows with FluentCRM +- `marketing.md` - Marketing campaigns with FluentCRM +- `services/email/ses.md` - Email delivery via SES +- FluentCRM Docs: https://fluentcrm.com/docs/ +- FluentCRM REST API: https://rest-api.fluentcrm.com/ diff --git a/.agent/tools/build-agent/build-agent.md b/.agent/tools/build-agent/build-agent.md index 1bafce8e26..217fd2c638 100644 --- a/.agent/tools/build-agent/build-agent.md +++ b/.agent/tools/build-agent/build-agent.md @@ -146,6 +146,23 @@ tools: wordpress-mcp_*: true # WordPress MCP tools ``` +**CRITICAL: MCP Placement Rule** + +- **Enable MCPs in SUBAGENTS only** (files in subdirectories like `services/crm/`, `tools/wordpress/`) +- **NEVER enable MCPs in main agents** (`sales.md`, `marketing.md`, `seo.md`, etc.) +- Main agents reference subagents for MCP functionality +- This ensures MCPs only load when the specific subagent is invoked + +```yaml +# CORRECT: MCP in subagent (services/crm/fluentcrm.md) +tools: + fluentcrm_*: true + +# WRONG: MCP in main agent (sales.md) +tools: + fluentcrm_*: true # DON'T DO THIS - use subagent reference instead +``` + **MCP requirements with tool filtering** (documents intent for future `includeTools` support): ```yaml diff --git a/configs/mcp-templates/fluentcrm.json b/configs/mcp-templates/fluentcrm.json new file mode 100644 index 0000000000..868ec2a1c8 --- /dev/null +++ b/configs/mcp-templates/fluentcrm.json @@ -0,0 +1,12 @@ +{ + "fluentcrm": { + "type": "local", + "command": [ + "/bin/bash", + "-c", + "source ~/.config/aidevops/mcp-env.sh && node ~/.local/share/mcp-servers/fluentcrm-mcp-server/dist/fluentcrm-mcp-server.js" + ], + "enabled": false, + "_comment": "Disabled globally. Enabled via fluentcrm_*: true in services/crm/fluentcrm.md subagent. Requires local build - see .agent/services/crm/fluentcrm.md for setup." + } +}