Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CRM MCP ServerList the recent activity and open todos for Jane Cooper"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CRM MCP Server
A production-ready Model Context Protocol (MCP) server for Customer Relationship Management (CRM) functionality, built with TypeScript and SQLite.
๐ Features
Core CRM Tools (18 Total)
Contact Management: Add, update, search, list, and archive contacts
Organization Management: Filter contacts by organization
Contact History: Track, update, and manage interactions, calls, emails, meetings, and notes
Entry Management: Full CRUD operations on contact history entries
Todo Management: Add, update, filter, and track action items for contacts
Data Export: CSV exports for contacts, history, and full CRM data
Recent Activities: Track and retrieve recent CRM activities
Technical Excellence
โ 100% Test Coverage - Comprehensive 3-phase test suite with database isolation
โ Production Ready - Robust error handling and input validation
โ High Performance - Optimized for bulk operations and large datasets
โ Security Focused - SQL injection protection and input sanitization
โ Edge Case Handling - Thoroughly tested boundary conditions
โ Database Management - Safe archive/restore system with zero data loss
โ Entry Management - Complete contact history CRUD with database scripts
โ Modular Testing - Isolated test phases with automatic state management
๐ฆ Installation
Prerequisites
Node.js 18+
npm or yarn
Setup
# Clone the repository
git clone <repository-url>
cd mcp-crm
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm run start:crm๐ง Configuration
MCP Integration
Add to your .cursor/mcp.json or MCP client configuration:
{
"mcpServers": {
"mcp-crm": {
"command": "node",
"args": ["./build/crm-server.js"],
"cwd": "/path/to/mcp-crm"
}
}
}Database
Location:
data/crm.sqliteType: SQLite 3
Auto-created: Database and tables are automatically initialized
Git Ignored: Database files and archives are excluded from version control for security and size reasons
๐๏ธ Database Management
The CRM system includes powerful database management commands for safely resetting, archiving, and restoring your data.
Quick Commands
# Reset database (archive current, create fresh)
npm run db:reset
# Archive current database (backup without reset)
npm run db:archive
# List all archived databases
npm run db:list
# Show current database statistics
npm run db:stats
# Contact entry management
npm run db:list-entries # List all contact entries
npm run db:list-entries 1 # List entries for contact ID 1
npm run db:list-entries "" 10 # List 10 most recent entries (all contacts)
npm run db:view-entry 1 # View detailed entry
npm run db:delete-entry 1 # Delete entry by ID
npm run db:update-entry 1 content "Updated content" # Update entry field
# Show help for database commands
npm run db:helpDetailed Usage
Reset Database
Safely archives your current database and creates a fresh empty one.
# Basic reset
npm run db:reset
# Reset with reason (helpful for tracking)
npm run db:reset cleanup
npm run db:reset "testing-new-features"What happens:
๐ฆ Current database is archived with timestamp
๐๏ธ Current database is removed
โ Fresh empty database is created
๐ก๏ธ Your data is safely preserved in archives
Archive Database
Create a backup without resetting (keeps current database).
# Basic archive
npm run db:archive
# Archive with reason
npm run db:archive "before-major-update"List Archives
View all your database backups.
npm run db:listExample output:
๐ฆ Database Archives
==================================================
๐ crm-backup-2025-06-04T19-15-35-cleanup.sqlite
Created: 6/4/2025, 7:15:35 PM
Size: 45.32 KB
Path: /data/archives/crm-backup-2025-06-04T19-15-35-cleanup.sqlite
๐ crm-backup-2025-06-03T14-22-18.sqlite
Created: 6/3/2025, 2:22:18 PM
Size: 42.17 KB
Path: /data/archives/crm-backup-2025-06-03T14-22-18.sqliteRestore from Archive
Restore a previous database from archive.
npm run db:list # First, see available archives
# Then restore specific archive (replace with actual filename):
npx tsx scripts/database-manager.ts restore crm-backup-2025-06-04T19-15-35.sqliteWhat happens:
๐ฆ Current database is archived (safety backup)
๐ Selected archive is restored as current database
โ Your data is back to the archived state
Database Statistics
Check your current database status.
npm run db:statsExample output:
๐ Current Database Statistics
==================================================
Contacts: 546
Entries: 1,234
Size: 45.32 KBContact Entry Management
Manage contact history entries with full CRUD operations.
# List contact entries
npm run db:list-entries # All entries (newest first)
npm run db:list-entries 1 # All entries for contact 1
npm run db:list-entries "" 10 # 10 most recent entries (all contacts)
npm run db:list-entries 1 5 # 5 most recent entries for contact 1
# View detailed entry
npm run db:view-entry 2 # View entry ID 2 with full content
# Update entry
npm run db:update-entry 2 content "New content here" # Update content
npm run db:update-entry 2 subject "New subject" # Update subject
npm run db:update-entry 2 entry_type note # Update type
# Delete entry
npm run db:delete-entry 2 # Delete entry ID 2 (with confirmation)Entry fields you can update:
entry_type: call, email, meeting, note, tasksubject: Brief title/subject of the entrycontent: Detailed content of the entry
Example entry list output:
๐ Contact Entries
Showing 3 most recent entries (limited to 10)
================================================================================
Entry #5 (Jane Smith)
Type: CALL
Subject: Follow-up discussion
Date: 2025-06-04 15:30:00
Content: Discussed project requirements and timeline. Next meeting scheduled...
Entry #4 (John Doe)
Type: EMAIL
Subject: Proposal sent
Date: 2025-06-04 14:15:00
Content: Sent project proposal via email. Awaiting feedback by Friday...Archive Structure
Archives are stored in data/archives/ with descriptive names:
crm-backup-2025-06-04T19-15-35.sqlite(automatic timestamp)crm-backup-2025-06-04T19-15-35-cleanup.sqlite(with reason)crm-backup-2025-06-04T19-15-35-before-restore.sqlite(automatic safety backup)
Safety Features
โ Never Deletes Data: All operations archive before making changes
โ Automatic Timestamps: Every archive is uniquely named
โ Safety Backups: Restore operations backup current state first
โ Reason Tracking: Optional reasons help track why archives were made
โ Easy Recovery: Simple commands to restore any previous state
๐ ๏ธ Available Tools
Contact Management
Tool | Description | Parameters |
| Create a new contact |
|
| Update existing contact |
|
| Get detailed contact information |
|
| List all contacts |
|
| Search contacts by name, email, or organization |
|
| Filter contacts by organization |
|
| Archive a contact (soft delete) |
|
Contact History
Tool | Description | Parameters |
| Add interaction history entry |
|
| Update existing contact entry |
|
| Get all history for a contact |
|
| Get recent CRM activities |
|
Todo Management
Tool | Description | Parameters |
| Add todo for a contact |
|
| Update existing todo |
|
| Get todos with advanced filtering |
|
Data Export
Tool | Description | Parameters |
| Export contacts to CSV with todo summaries |
|
| Export contact history to CSV with todo details |
|
| Export complete CRM data with todo columns | None |
| Export all todos to CSV | None |
๐ Usage Examples
Adding a Contact
// Via MCP call
{
"name": "add_contact",
"arguments": {
"name": "John Doe",
"organization": "Acme Corp",
"job_title": "Software Engineer",
"email": "john.doe@acme.com",
"phone": "+1-555-0123",
"notes": "Interested in our enterprise solution"
}
}Searching Contacts
{
"name": "search_contacts",
"arguments": {
"query": "Acme"
}
}Adding Contact History
{
"name": "add_contact_entry",
"arguments": {
"contact_id": 1,
"entry_type": "call",
"subject": "Discovery Call",
"content": "Discussed requirements and pricing. Follow up in 1 week."
}
}Adding Todos
{
"name": "add_todo",
"arguments": {
"contact_id": 1,
"todo_text": "Follow up on pricing discussion",
"target_date": "2025-06-15T10:00:00Z"
}
}Getting Todos
// Get all incomplete todos
{
"name": "get_todos",
"arguments": {}
}
// Get todos due in next 7 days
{
"name": "get_todos",
"arguments": {
"days_ahead": 7
}
}
// Get todos for specific contact
{
"name": "get_todos",
"arguments": {
"contact_id": 1,
"include_completed": true
}
}Exporting Todos
// Export all todos to CSV
{
"name": "export_todos_csv",
"arguments": {}
}Updating Contact History
{
"name": "update_contact_entry",
"arguments": {
"entry_id": 2,
"subject": "Updated Discovery Call",
"content": "Discussed requirements and pricing. Client requested additional features. Follow up scheduled for next Tuesday."
}
}๐งช Testing
Run All Tests
# Comprehensive test suite (recommended) - uses database isolation
npm run test:comprehensive
# Individual test phases:
# Database management tests
npm run test:db
# Core functionality tests (Phase B)
cd tests && npx tsx run-phase-b-tests.ts
# Advanced tests - edge cases and performance (Phase C)
cd tests && npx tsx run-phase-c-tests.ts
# Legacy comprehensive test runner
cd tests && npx tsx run-all-tests.tsModular Testing with Database Isolation
The new comprehensive test suite leverages our database management scripts for:
๐ Complete Isolation: Each test phase gets a fresh database
๐ฆ Automatic Archiving: All test data is preserved in timestamped archives
๐ State Management: Clean setup and teardown between test phases
๐ Comprehensive Reporting: Detailed reports with performance metrics
Test Coverage
Infrastructure Testing: Database Management (6/6 tests, 100% coverage)
Core Features Testing: All 13 CRM tools (3 suites, 100% coverage)
Quality Assurance Testing: Edge cases and performance validation (2 suites, 100% coverage)
Overall: 3 test phases with complete database isolation and lifecycle testing
Test Phases
๐๏ธ Infrastructure - Database management, archiving, and state control
โ๏ธ Core Features - Contact management, history tracking, and data export
๐ Quality Assurance - Edge cases, error handling, and performance validation
Performance Benchmarks
Test Suite Execution: ~20 seconds for complete comprehensive testing
Database Operations: Sub-second response times for all management commands
Test Isolation: Complete database reset between phases in <1 second
Archive Operations: Automatic timestamped backups with zero data loss
Contact Creation: 2100+ contacts/second
Search Operations: <1ms average response time
Bulk Operations: 100% success rate across all batch sizes
Export Operations: 40+ KB/ms throughput
๐๏ธ Development
Project Structure
mcp-crm/
โโโ src/
โ โโโ crm-server.ts # Main MCP server implementation
โโโ scripts/
โ โโโ database-manager.ts # Database management utilities
โโโ tests/
โ โโโ scenarios/ # Test scenarios (including DB management)
โ โโโ client/ # Test client utilities
โ โโโ run-*.ts # Test runners
โโโ data/
โ โโโ crm.sqlite # SQLite database
โ โโโ archives/ # Database archive backups
โโโ build/ # Compiled JavaScript
โโโ docs/ # DocumentationBuild Commands
npm run build # Compile TypeScript
npm run watch # Watch mode for development
npm run clean # Clean build directory
npm run dev # Development mode
# Database management
npm run db:reset # Reset database (archive + fresh)
npm run db:archive # Archive current database
npm run db:list # List archived databases
npm run db:stats # Show database statistics
npm run db:help # Database management help
# Contact entry management
npm run db:list-entries # List contact entries (with optional contact_id and limit)
npm run db:view-entry # View detailed contact entry by ID
npm run db:delete-entry # Delete contact entry by ID
npm run db:update-entry # Update contact entry by ID
# Testing
npm run test:db # Run database management tests
npm run test:comprehensive # Run all tests with database isolation (recommended)
npm run test:all # Alias for comprehensive testsDatabase Schema
contacts: Core contact information with soft delete support
contact_entries: Interaction tracking with timestamps
Archives: Automatic timestamped backups in
data/archives/Indexes: Optimized for search and retrieval operations
Git Configuration
Database files: All
.sqlitefiles are excluded from version controlArchives: The
data/archives/directory contents are ignored but structure is preservedLocal development: Each developer maintains their own database and archives locally
Fresh setup: Run
npm run db:resetto create a clean database on new installations
๐ Security Features
Input Validation: Comprehensive parameter validation using Zod
SQL Injection Protection: Parameterized queries throughout
XSS Prevention: Input sanitization for special characters
Error Handling: Graceful error responses without sensitive data exposure
Boundary Testing: Extensive edge case validation
๐ Production Readiness
Scalability
Efficient SQLite operations with proper indexing
Bulk operation support for large datasets
Consistent sub-100ms response times
Memory-efficient design
Reliability
Comprehensive error handling
Input validation and sanitization
Graceful degradation for edge cases
Extensive test coverage (100%)
Database integrity protection with automatic archiving
Zero data loss guarantee through safe backup/restore system
Monitoring
Performance metrics collection
Detailed logging for debugging
Test result reporting and analysis
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Fork the repository
Create a feature branch
Run the comprehensive test suite:
npm run test:allEnsure all 3 test phases pass (Infrastructure, Core Features, Quality Assurance)
Commit your changes
Submit a pull request
๐ Support
For issues and questions:
Run
npm run test:allto verify system healthCheck the test results in
tests/results/test-reports/Review the comprehensive test scenarios including database management
Use
npm run db:helpfor database management commandsAll 13 CRM tools plus database management are documented and tested
Status: โ Production Ready | ๐งช 3-Phase Testing | ๐ Performance Optimized | ๐๏ธ Database Management | ๐ Complete Isolation
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.