Enables containerized deployment of the EspoCRM MCP server and chatbot with Docker and Docker Compose support
Allows configuration of the MCP server through environment variables stored in .env files for secure credential management
Provides calendar synchronization with Google Calendar, including meeting creation, attendee management, and event tracking with googleEventId field
Provides the runtime environment for the MCP server, requiring Node.js 18+ for operation
Offers optional integration with OpenAI for advanced natural language understanding in the chatbot interface
Powers the real-time bidirectional communication for the AI chatbot interface that embeds into EspoCRM
Provides full TypeScript support with strict typing for enhanced developer experience and type safety
Implements schema validation for all operations, ensuring data integrity and real-time validation
EspoCRM MCP Server
A comprehensive Model Context Protocol (MCP) server for seamless integration with EspoCRM. This server enables AI assistants to interact with your EspoCRM instance through a standardized interface, providing complete CRUD operations for Contacts, Accounts, Opportunities, Meetings, Users, Tasks, Leads, and advanced system management capabilities.
** NEW: AI Chatbot Integration** - Now includes a complete chatbot interface that embeds directly into your EspoCRM, providing natural language access to all 47 MCP tools!
Features
Core Capabilities
- Complete CRUD Operations - Create, read, update, and delete entities
- Multi-Entity Support - Contacts, Accounts, Opportunities, Meetings, Users, Tasks, and Leads
- Advanced Search & Filtering - Flexible search with date ranges, pagination, and complex filters
- Task Management - Complete task lifecycle with parent relationships and user assignment
- Lead Management - Full lead pipeline from creation to conversion
- Meeting Management - Full calendar integration with attendee management
- User Management - Comprehensive user search and lookup capabilities
- Real-time Validation - Zod-based schema validation for all operations
- Comprehensive Logging - Winston-powered logging with multiple levels
Authentication & Security
- Multiple Auth Methods - API Key and HMAC authentication support
- Secure Configuration - Environment-based configuration management
- Rate Limiting - Built-in rate limiting for API protection
- Error Handling - Robust error handling with detailed logging
Calendar Integration
- Meeting Operations - Create, search, update, and manage meetings
- Attendee Management - Link contacts and users to meetings
- Date/Time Filtering - Advanced date range search capabilities
- Google Calendar Sync Compatibility - Designed for calendar synchronization workflows
AI Chatbot Integration
- Floating Chat Widget - Beautiful, non-intrusive chat bubble interface
- Natural Language Processing - Chat in plain English to perform CRM operations
- Real-time Communication - WebSocket-powered instant responses
- 47 MCP Tools Access - Complete CRM functionality via chat
- EspoCRM Embedding - Integrates directly into your EspoCRM interface
- Mobile Responsive - Works seamlessly on all devices
Developer Experience
- TypeScript - Full TypeScript support with strict typing
- Docker Support - Containerized deployment ready
- Comprehensive Testing - Multiple test scripts and validation tools
- MCP 2024/2025 Compliant - Latest MCP specification support
Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
- EspoCRM instance with API access
- Valid API credentials
Installation
- Clone the repository
- Install dependencies
- Configure environment
- Build the project
- Test the connection
AI Chatbot Quick Start
Deploy Chatbot Interface
- Navigate to chatbot directory
- Install dependencies
- Configure environment
- Start chatbot server
- Integrate with EspoCRM Add to your EspoCRM footer template:
- Try the Demo
Visit
http://localhost:3001/widget
to see the chatbot in action!
Environment Configuration
Create a .env
file with your EspoCRM configuration:
Required Configuration
Variable | Description | Required | Default |
---|---|---|---|
ESPOCRM_URL | Your EspoCRM instance URL | Yes | - |
ESPOCRM_API_KEY | API key for authentication | Yes | - |
ESPOCRM_AUTH_METHOD | Authentication method (apikey or hmac ) | Yes | apikey |
ESPOCRM_SECRET_KEY | Secret key for HMAC auth | No | - |
MCP_TRANSPORT | MCP transport method | No | stdio |
RATE_LIMIT | Requests per minute limit | No | 100 |
REQUEST_TIMEOUT | Request timeout in milliseconds | No | 30000 |
LOG_LEVEL | Logging level | No | info |
Available Tools
The MCP server provides 47 comprehensive tools for EspoCRM integration:
Contact Management
create_contact
- Create new contacts with full field supportsearch_contacts
- Search and filter contacts with date range filteringget_contact
- Retrieve specific contact by ID
Account Management
create_account
- Create new company/organization accountssearch_accounts
- Search and filter accounts with date range filtering
Opportunity Management
create_opportunity
- Create new sales opportunitiessearch_opportunities
- Search opportunities with advanced filters including amount ranges
Meeting Management
create_meeting
- Create meetings with attendee management and calendar integrationsearch_meetings
- Search meetings with date ranges, status, and location filtersget_meeting
- Retrieve detailed meeting information including attendeesupdate_meeting
- Update existing meetings with support for all meeting fields
User Management
search_users
- Search users by username, email, name, type, and statusget_user_by_email
- Direct email-based user lookup for calendar sync operations
Task Management
create_task
- Create tasks with parent entity support (Lead, Account, Contact, Opportunity)search_tasks
- Search tasks by assignee, status, priority, parent entity, and due datesget_task
- Retrieve detailed task information including relationshipsupdate_task
- Update task properties including status, priority, and due dateassign_task
- Assign or reassign tasks to specific users
Lead Management
create_lead
- Create new leads with full field support and validationsearch_leads
- Search leads by status, source, assignee, and date rangesupdate_lead
- Update lead properties and statusconvert_lead
- Convert leads to contacts, accounts, and/or opportunitiesassign_lead
- Assign or reassign leads to specific users
Team & Role Management
add_user_to_team
- Add users to teams with optional position assignmentremove_user_from_team
- Remove users from teamsassign_role_to_user
- Assign roles to users for permissions managementget_user_teams
- Get all teams that a user belongs toget_team_members
- Get all members of a specific teamsearch_teams
- Search teams by name and descriptionget_user_permissions
- Get effective permissions for a user based on roles
Generic Entity Operations
create_entity
- Create records for any entity type (including custom entities)search_entity
- Search any entity type with flexible filters and field selectionupdate_entity
- Update any entity record by ID with flexible datadelete_entity
- Delete any entity record by IDget_entity
- Get specific entity records with optional field selection
Relationship Management
link_entities
- Create relationships between any two entity recordsunlink_entities
- Remove relationships between entity recordsget_entity_relationships
- Get all related records for an entity with relationship details
Communication Tools
create_call
- Create call records with status, direction, and duration trackingsearch_calls
- Search calls by status, direction, contact, and date rangescreate_case
- Create support cases with priority, type, and account linkingsearch_cases
- Search cases by status, priority, type, and assignmentadd_note
- Add notes to any entity record for documentation and follow-upsearch_notes
- Search notes by parent entity, author, and date rangescreate_document
- Create document records with file attachments and metadata
System Tools
health_check
- Verify server and EspoCRM connectivity across all entities
Enhanced Search Capabilities
All search tools now support advanced filtering options:
Date Range Filtering
createdFrom
/createdTo
- Filter by creation date rangemodifiedFrom
/modifiedTo
- Filter by modification date rangedateFrom
/dateTo
- Filter meetings by date range
Meeting-Specific Filters
status
- Filter by meeting status (Planned, Held, Not Held)location
- Filter by meeting locationassignedUserName
- Filter by assigned user
User-Specific Filters
userName
- Search by usernameemailAddress
- Search by email addressfirstName
/lastName
- Search by name componentsisActive
- Filter by active statustype
- Filter by user type (admin, regular, portal, api)
Usage Examples
Task Management
Lead Management
Team & Role Management
Generic Entity Operations
Relationship Management
Communication Tools
AI Chatbot Usage
The embedded chatbot understands natural language and can perform any CRM operation:
Meeting Management
User Management
Advanced Contact Search with Date Filtering
Calendar Integration Workflow
Testing
Automated Testing
The project includes comprehensive testing tools:
Manual Testing Scripts
Connection Testing
Tests basic connectivity, API endpoints, and authentication.
Enhanced Tools Testing
Comprehensive test of all enhanced features including meetings and users.
Random Contact Generation
Creates a random test contact to verify CRUD operations.
Development
Project Structure
Key Components
MCP Server (src/index.ts
)
Main server implementation with environment loading, graceful shutdown handling, and MCP protocol compliance.
EspoCRM Client (src/espocrm/client.ts
)
HTTP client with authentication, error handling, logging, and comprehensive CRUD operations.
Entity Types (src/espocrm/types.ts
)
Complete TypeScript interfaces for Contact, Account, Opportunity, Meeting, User, and related entities.
Tool Registry (src/tools/index.ts
)
Central registry for all MCP tools with proper type safety, validation, and error handling.
Formatting Utilities (src/utils/formatting.ts
)
Professional formatting functions for all entity types with consistent output formatting.
Development Workflow
- Make changes to source files in
src/
- Build the project with
npm run build
- Test changes with
npm run test:config
- Test enhanced features with
npm run test:client
- Lint code with
npm run lint
Docker Deployment
Build and Run with Docker
Docker Compose
Calendar Sync Integration
This MCP server is specifically designed to work seamlessly with calendar synchronization systems:
Google Calendar Sync Compatibility
- Meeting entities include
googleEventId
field for sync tracking - User lookup by email for attendee management
- Date range filtering for efficient sync operations
- Attendee linking through
contactsIds
andusersIds
Sync Prevention Features
- Comprehensive entity tracking to prevent duplicate creation
- Support for external system identifiers
- Robust error handling for sync operations
Workflow Integration
Troubleshooting
Common Issues
Connection Failures
Authentication Issues
- Verify API key is correct and active
- Check user permissions in EspoCRM
- Ensure API access is enabled for the user
- Verify the correct API endpoint format
Meeting Creation Issues
- Ensure required fields (name, dateStart, dateEnd) are provided
- Verify date format is ISO 8601 (YYYY-MM-DDTHH)
- Check user permissions for meeting creation
- Validate contact and user IDs exist before linking
User Search Issues
- Verify user has permission to access User entity
- Check if users exist in the system
- Ensure email addresses are correctly formatted
Debug Mode
Enable debug logging:
View detailed logs:
Connection Diagnostics
Test specific API endpoints:
API Reference
Tool Schemas
All tools use Zod schemas for validation. Key schemas include:
Contact Schema
Meeting Schema
User Schema
Task Schema
Lead Schema
Team Schema
Generic Entity Schema
Call Schema
Case Schema
Note Schema
Relationship Schema
Team Management Operations
Search Parameters
Response Formats
Standard List Response
Meeting Response
Performance Considerations
Pagination
- Default limit: 20 results
- Maximum limit: 200 results
- Use offset for pagination through large datasets
Rate Limiting
- Default: 100 requests per minute
- Configurable via RATE_LIMIT environment variable
- Implements exponential backoff for rate limit handling
Caching
- No built-in caching (recommended to implement at application level)
- EspoCRM API responses are not cached to ensure data freshness
Bulk Operations
- Individual entity operations only
- For bulk operations, iterate through arrays at the application level
- Consider rate limiting when processing large datasets
Security Best Practices
API Key Management
- Store API keys in environment variables only
- Rotate API keys regularly
- Use dedicated API users with minimal required permissions
- Monitor API usage logs
Network Security
- Use HTTPS for all EspoCRM connections
- Consider VPN or private networks for sensitive data
- Implement IP whitelisting if supported by your EspoCRM instance
Data Validation
- All inputs are validated using Zod schemas
- Sanitization is applied to prevent injection attacks
- Error messages do not expose sensitive system information
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/enhanced-search
) - Commit your changes (
git commit -m 'Add enhanced search capabilities'
) - Push to the branch (
git push origin feature/enhanced-search
) - Open a Pull Request
Development Guidelines
- Follow TypeScript best practices with strict typing
- Add comprehensive tests for new functionality
- Update documentation for any new features
- Ensure all tests pass before submitting
- Follow existing code formatting and structure
- Add appropriate error handling and logging
Testing Requirements
- Unit tests for new functionality
- Integration tests with mock EspoCRM responses
- Manual testing with real EspoCRM instances
- Documentation updates for new features
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: Check the
docs/
directory for additional documentation - EspoCRM API: Official EspoCRM API Documentation
- MCP Specification: Model Context Protocol Documentation
Changelog
Version 2.0.0 - AI Chatbot Integration 🤖
- Complete Chatbot Interface: Floating chat bubble that embeds in EspoCRM
- Natural Language Processing: Chat in plain English to perform CRM operations
- WebSocket Communication: Real-time bidirectional communication
- 47 MCP Tools Access: Full CRM functionality via conversational interface
- Security & Rate Limiting: Production-ready security with input validation
- Docker Deployment: Containerized chatbot server alongside MCP server
- Mobile Responsive: Beautiful interface that works on all devices
- EspoCRM Integration: Simple 3-line integration with existing EspoCRM instances
- AI-Powered: Optional OpenAI integration for advanced natural language understanding
- Production Testing: Comprehensive test suite and demo interface
Version 1.5.0 - Phase 3 Complete Communication & Relationship Management
- Relationship Management: 3 new tools for linking/unlinking entities and managing relationships
- Communication Tools: 7 new tools for calls, cases, notes, and document management
- Entity Relationship Operations: Link/unlink any entities, get relationship details
- Call Management: Create and search call records with duration and direction tracking
- Case Management: Create and search support cases with priority and type categorization
- Note System: Add notes to any entity with internal/external visibility control
- Document Management: Create document records with file attachment support
- Advanced Formatting: Added specialized formatting for calls, cases, and notes
- Tool Count: Expanded from 39 to 47 comprehensive tools (+8 new tools)
Version 1.4.0 - Phase 2 Complete Enterprise Solution
- Team & Role Management: 7 new tools for complete user/team/role administration
- Generic Entity Operations: 5 new tools for manipulating any EspoCRM entity (including custom entities)
- Team Administration: Add/remove users from teams, assign positions, get team members
- Role Assignment: Assign roles to users and get effective permissions
- Universal Entity Support: Create, read, update, delete, and search any entity type
- Custom Entity Support: Full support for custom EspoCRM entities and fields
- Enhanced Type Safety: Added Team, Role, and GenericEntity TypeScript interfaces
- Tool Count: Expanded from 27 to 39 comprehensive tools (+12 new tools)
Version 1.3.0 - Phase 1 Expansion
- Task Management: Complete task lifecycle with 5 new tools (create, search, get, update, assign)
- Lead Management: Full lead pipeline with 5 new tools (create, search, update, convert, assign)
- Parent Relationships: Tasks can be linked to Leads, Accounts, Contacts, or Opportunities
- Lead Conversion: Convert leads to contacts, accounts, and opportunities in one operation
- Advanced Task Features: Priority levels, due dates, status tracking, and user assignment
- Expanded Search: Task and lead search with comprehensive filtering options
- Type Safety: Enhanced TypeScript interfaces for all new entities
- Tool Count: Expanded from 17 to 27 comprehensive tools
Version 1.2.0
- Enhanced Meeting Management: Complete CRUD operations for meetings
- User Management: Search and lookup functionality for users
- Advanced Date Filtering: Date range support for all search operations
- Calendar Sync Compatibility: Google Calendar integration support
- Improved Error Handling: Better error messages and debugging
- Connection Fix: Resolved API endpoint compatibility issues
Version 1.1.0
- Extended Entity Support: Added comprehensive type definitions
- Enhanced Search: Advanced filtering capabilities
- Performance Improvements: Optimized API client and error handling
Version 1.0.0
- Initial release with full MCP 2024/2025 support
- Complete CRUD operations for Contacts, Accounts, Opportunities
- Docker support and comprehensive testing
- Multiple authentication methods
- Production-ready logging and error handling
Enterprise-grade EspoCRM integration for modern AI applications
This server cannot be installed
Open source MCP server for EspoCRM
Related MCP Servers
- Python
- TypeScriptMIT License
- TypeScript
- PythonAGPL 3.0