A production-ready MCP server for Customer Relationship Management (CRM) functionality, built with TypeScript and SQLite.
A production-ready Model Context Protocol (MCP) server for Customer Relationship Management (CRM) functionality, built with TypeScript and SQLite.
# 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
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"
}
}
}
data/crm.sqlite
The CRM system includes powerful database management commands for safely resetting, archiving, and restoring your data.
# 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:help
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:
Create a backup without resetting (keeps current database).
# Basic archive
npm run db:archive
# Archive with reason
npm run db:archive "before-major-update"
View all your database backups.
npm run db:list
Example 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.sqlite
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.sqlite
What happens:
Check your current database status.
npm run db:stats
Example output:
๐ Current Database Statistics
==================================================
Contacts: 546
Entries: 1,234
Size: 45.32 KB
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 entryExample 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...
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)Tool | Description | Parameters |
---|---|---|
add_contact | Create a new contact | name (required), organization , job_title , email , phone , notes |
update_contact | Update existing contact | id (required), optional: name , organization , job_title , email , phone , notes |
get_contact_details | Get detailed contact information | id (required) |
list_contacts | List all contacts | include_archived (optional, default: false) |
search_contacts | Search contacts by name, email, or organization | query (required) |
list_contacts_by_organization | Filter contacts by organization | organization (required) |
archive_contact | Archive a contact (soft delete) | id (required) |
Tool | Description | Parameters |
---|---|---|
add_contact_entry | Add interaction history entry | contact_id , entry_type (call/email/meeting/note/task), subject , content |
update_contact_entry | Update existing contact entry | entry_id (required), optional: entry_type , subject , content |
get_contact_history | Get all history for a contact | contact_id (required), limit (optional) |
get_recent_activities | Get recent CRM activities | limit (optional, default: 10) |
Tool | Description | Parameters |
---|---|---|
add_todo | Add todo for a contact | contact_id (required), todo_text (required), target_date (optional) |
update_todo | Update existing todo | todo_id (required), optional: todo_text , target_date , is_completed |
get_todos | Get todos with advanced filtering | contact_id (optional), include_completed (optional), days_ahead (optional), days_old (optional) |
Tool | Description | Parameters |
---|---|---|
export_contacts_csv | Export contacts to CSV with todo summaries | include_archived (optional) |
export_contact_history_csv | Export contact history to CSV with todo details | contact_id (optional, exports all if not specified) |
export_full_crm_csv | Export complete CRM data with todo columns | None |
export_todos_csv | Export all todos to CSV | None |
// 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"
}
}
{
"name": "search_contacts",
"arguments": {
"query": "Acme"
}
}
{
"name": "add_contact_entry",
"arguments": {
"contact_id": 1,
"entry_type": "call",
"subject": "Discovery Call",
"content": "Discussed requirements and pricing. Follow up in 1 week."
}
}
{
"name": "add_todo",
"arguments": {
"contact_id": 1,
"todo_text": "Follow up on pricing discussion",
"target_date": "2025-06-15T10:00:00Z"
}
}
// 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
}
}
// Export all todos to CSV
{
"name": "export_todos_csv",
"arguments": {}
}
{
"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."
}
}
# 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.ts
The new comprehensive test suite leverages our database management scripts for:
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/ # Documentation
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 tests
data/archives/
.sqlite
files are excluded from version controldata/archives/
directory contents are ignored but structure is preservednpm run db:reset
to create a clean database on new installationsMIT License - see LICENSE file for details.
npm run test:all
For issues and questions:
npm run test:all
to verify system healthtests/results/test-reports/
npm run db:help
for database management commandsStatus: โ Production Ready | ๐งช 3-Phase Testing | ๐ Performance Optimized | ๐๏ธ Database Management | ๐ Complete Isolation
Access Israeli Government Open Data from the data.gov.il portal.
Knowledge graph-based persistent memory system
Immutable ledger database with live synchronization
A memory system for the Cursor code editor, providing persistent context awareness for Claude via a Turso database.
An MCP server that provides tools to interact with Powerdrill datasets, enabling smart AI data analysis and insights.
Leverages your Schemas and Access Patterns to interact with your DynamoDB Database using natural language.
Connect to any relational database, and be able to get valid SQL, and ask questions like what does a certain column prefix mean.
Access comprehensive B2B data on companies, employees, and job postings for your LLMs and AI workflows.
MCP server for libSQL databases with comprehensive security and management tools. Supports file, local HTTP, and remote Turso databases with connection pooling, transaction support, and 6 specialized database tools.
Read and write access to your Baserow tables.