mcp-server-crm

zeeshan8281/mcp-server-crm

3.3

If you are the rightful owner of mcp-server-crm and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a comprehensive overview of a Model Context Protocol (MCP) server designed for CRM operations with AI intelligence.

Tools
10
Resources
0
Prompts
0

šŸš€ Real MCP Server - CRM Assistant with AI Intelligence

A complete Model Context Protocol (MCP) server implementation for CRM operations with advanced AI features


šŸ“‹ What is This?

This is a real MCP server that implements the Model Context Protocol specification. It provides AI-powered CRM functionality through standardized MCP tools that can be used by AI agents, Cursor, and other MCP-compatible clients.

Key Features:

  • āœ… Real MCP Server - Follows Model Context Protocol specification
  • 🧠 AI-Powered Analytics - Revenue prediction, contact scoring, relationship mapping
  • šŸ”Œ MCP Tool Integration - 10 comprehensive tools for CRM operations
  • šŸ“Š Advanced Insights - Company analysis, trend detection, smart recommendations
  • šŸ’¬ AI Chat Interface - Natural language queries for CRM data
  • šŸ•øļø Relationship Mapping - Visual network of contact connections

šŸ—ļø Architecture

MCP Server Components:

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                    MCP Server Layer                        │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  • ListToolsRequestSchema  • CallToolRequestSchema         │
│  • StdioServerTransport    • Server Instance               │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                  AI Analytics Engine                        │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  • Revenue Prediction      • Contact Scoring               │
│  • Relationship Mapping    • Smart Recommendations         │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                    Supabase Backend                        │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  • PostgreSQL Database     • Real-time Subscriptions       │
│  • Row Level Security     • API Authentication            │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸ› ļø Setup & Installation

1. Prerequisites

  • Node.js 18+
  • Supabase account and project
  • MCP-compatible client (Cursor, Claude Desktop, etc.)

2. Install Dependencies

npm install

3. Environment Setup

Create .env file:

# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key

# Optional: Server Configuration
PORT=3000

4. Database Setup

Create the contacts table in Supabase:

CREATE TABLE contacts (
  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT NOT NULL,
  company TEXT,
  revenue INTEGER DEFAULT 0,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Enable Row Level Security
ALTER TABLE contacts ENABLE ROW LEVEL SECURITY;

-- Create policy for public access (adjust as needed)
CREATE POLICY "Allow public access" ON contacts FOR ALL USING (true);

šŸ”§ MCP Tools Available

Core CRM Operations

  1. get_contacts - Retrieve contacts with AI scoring
  2. add_contact - Add new contact with AI insights
  3. get_top_clients - Get top clients by revenue
  4. search_contacts - Search contacts by name/email

AI-Powered Analytics

  1. get_ai_insights - Comprehensive AI analytics
  2. predict_revenue - AI revenue prediction for contacts
  3. get_relationship_map - Network visualization data
  4. get_analytics - Detailed performance metrics
  5. get_recommendations - AI-powered action suggestions

Natural Language Interface

  1. ai_chat - Chat with AI assistant for CRM queries

šŸš€ Usage Examples

Using with Cursor

Add to your Cursor MCP configuration:

{
  "mcpServers": {
    "crm-assistant": {
      "command": "node",
      "args": ["/path/to/crm-mcp/server.js"],
      "env": {
        "SUPABASE_URL": "your-supabase-url",
        "SUPABASE_KEY": "your-supabase-key"
      }
    }
  }
}

Tool Usage Examples

Get Contacts with AI Scoring
// MCP Tool Call
{
  "name": "get_contacts",
  "arguments": {
    "limit": 10
  }
}
Add Contact with AI Insights
// MCP Tool Call
{
  "name": "add_contact",
  "arguments": {
    "name": "John Doe",
    "email": "john@techcorp.com",
    "company": "TechCorp",
    "revenue": 15000
  }
}
AI Chat Interface
// MCP Tool Call
{
  "name": "ai_chat",
  "arguments": {
    "message": "Who are my top 5 tech clients?"
  }
}

🧠 AI Features Deep Dive

Revenue Prediction Algorithm

// Factors considered:
- Company size (length > 10 chars = 1.5x multiplier)
- Email domain (business vs personal)
- Name length (longer names = higher potential)
- Current revenue (base for prediction)

// Formula:
basePrediction = currentRevenue * 1.2
multiplier = companySize * emailDomain * nameLength
predictedRevenue = basePrediction * multiplier

Contact Scoring System (0-100 scale)

// Scoring breakdown:
- Revenue Factor: 40% weight (max 40 points)
- Company Factor: 30% weight (tech companies get bonus)
- Email Domain: 20% weight (business domains preferred)
- Name Length: 10% weight (longer names = higher score)

Relationship Mapping

// Connection types detected:
- Colleague: Same company (strength: 0.9)
- Domain: Same email domain (strength: 0.7)
- High-value: Similar revenue ranges (strength: 0.6)
- Tech-network: Both in tech companies (strength: 0.5)
- Strategic: Random connections (strength: 0.3)

šŸ“Š AI Chat Capabilities

The AI chat interface understands natural language queries:

Supported Query Types:

  • Count Queries: "How many contacts do I have?"
  • Revenue Analysis: "What's my total revenue?"
  • Top Clients: "Who is my most profitable client?"
  • Tech Filtering: "Show me my top 10 tech clients"
  • Analytics: "Give me AI insights on my contacts"
  • Recommendations: "What should I focus on?"

Example Conversations:

User: "Who is my most profitable person?"
AI: "šŸ’° Your most profitable person is John Smith with $25,000 in revenue!"

User: "Show me my top 5 tech clients"
AI: "šŸš€ Your top 5 tech clients:
1. Jane Doe - $15,000
2. Bob Wilson - $12,000
3. Alice Brown - $8,500
..."

User: "How many contacts do I have?"
AI: "šŸ“Š You have 47 contacts in your CRM!"

šŸ”Œ MCP Protocol Implementation

Server Configuration

const server = new Server(
  {
    name: 'crm-assistant-mcp',
    version: '1.0.0',
  },
  {
    capabilities: {
      tools: {},
    },
  }
);

Tool Definition

{
  name: 'get_contacts',
  description: 'Get all contacts from the CRM with AI scoring and insights',
  inputSchema: {
    type: 'object',
    properties: {
      limit: {
        type: 'number',
        description: 'Maximum number of contacts to return (default: 50)',
        default: 50
      }
    }
  }
}

Request Handling

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { name, arguments: args } = request.params;
  // Tool implementation...
});

šŸŽÆ Key Differences from Express API

FeatureExpress APIMCP Server
ProtocolHTTP RESTModel Context Protocol
TransportHTTP/WebSocketStdioServerTransport
Client IntegrationCustom frontendAI agents, Cursor, Claude
Tool DiscoveryManual documentationAutomatic via ListTools
Error HandlingHTTP status codesMCP error responses
Data FormatJSON responsesMCP content format

šŸš€ Running the Server

Development Mode

npm run dev

Production Mode

npm start

Expected Output

šŸš€ MCP CRM Assistant Server Started! šŸš€
🧠 AI Features: Analytics, Predictions, Relationship Mapping
⚔ Real-time: Live updates, notifications, smart insights
šŸŽÆ Ready for INSANE CRM operations via MCP!

šŸ”§ Troubleshooting

Common Issues:

  1. "Please set SUPABASE_URL and SUPABASE_KEY"

    • Ensure .env file exists with correct values
    • Check Supabase project is active
  2. "Unknown tool" errors

    • Verify MCP client is properly configured
    • Check tool names match exactly
  3. Database connection errors

    • Verify Supabase URL and key are correct
    • Ensure contacts table exists
    • Check RLS policies allow access

Debug Mode

DEBUG=mcp* node server.js

šŸ“ˆ Performance & Scalability

Current Limits:

  • Contacts: 50 per request (configurable)
  • Search Results: 50 per query
  • AI Processing: Real-time (no caching)

Optimization Opportunities:

  • Implement caching for AI insights
  • Add pagination for large datasets
  • Optimize relationship mapping algorithm
  • Add database indexing

šŸ”® Future Enhancements

Planned Features:

  • Real-time Updates: WebSocket integration for live data
  • Advanced AI: Machine learning models for predictions
  • Integration APIs: Connect with external CRM systems
  • Custom Scoring: User-defined scoring algorithms
  • Bulk Operations: Batch contact operations
  • Export/Import: Data migration tools

šŸ“š Resources

MCP Documentation:

Supabase Resources:

AI & Analytics:


šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes
  4. Add tests if applicable
  5. Submit a pull request

šŸ“„ License

MIT License - see LICENSE file for details


šŸŽ‰ Conclusion

This MCP server transforms your CRM into an AI-powered intelligence platform. By implementing the Model Context Protocol, it seamlessly integrates with AI agents and development tools, providing powerful CRM operations through a standardized interface.

Ready to revolutionize your CRM with AI? Let's get started! šŸš€