@ai-staff/crm-mcp-server
v2.0.4
Published
MCP Server for Build Your App CRM — provides AI agents with typed access to leads, companies, proposals, analysis, and more
Downloads
669
Readme
@ai-staff/crm-mcp-server
MCP Server for Build Your App CRM — provides AI agents with typed access to leads, companies, proposals, analysis, and more.
Overview
This package implements a Model Context Protocol (MCP) server that connects AI agents (e.g., Paperclip) to the Build Your App CRM system. It exposes 8 dispatcher tools + 1 standalone health check covering all CRM domains: leads, companies, proposals, analysis, tasks, notifications, and admin.
Each dispatcher uses an action + params pattern: one tool per domain, with action selecting the specific operation. This reduces context tokens by ~89% compared to exposing all operations as individual tools.
The server uses stdio transport and is configured via environment variables. A single server instance serves all API roles (CEO, ManagerAPI, AnalystAPI) — the role is determined from the JWT token in CRM_API_KEY.
Installation
npx -y @ai-staff/crm-mcp-serverOr install globally:
npm install -g @ai-staff/crm-mcp-server
crm-mcp-serverConfiguration
Set environment variables before starting:
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| CRM_API_URL | No | https://crm.ai-staff.pro/api/v1 | Base URL of the CRM API |
| CRM_API_KEY | Yes | — | JWT API key with appropriate role (CEO, MANAGER_API, ANALYST_API) |
Paperclip Configuration
Add to your Paperclip agent's adapterConfig:
{
"mcpServers": {
"crm": {
"command": "npx",
"args": ["-y", "@ai-staff/crm-mcp-server@latest"],
"env": {
"CRM_API_URL": "https://crm.ai-staff.pro/api/v1",
"CRM_API_KEY": "<your-api-key>"
}
}
}
}Role-Based Access
| Role | CRM_API_KEY | Access Level |
|------|-------------|--------------|
| CEO | Token with apiRole: CEO | Full access (except delete operations) |
| ManagerAPI | Token with apiRole: MANAGER_API | Own leads only, limited write |
| AnalystAPI | Token with apiRole: ANALYST_API | Read all data, run analyses, no business writes |
Tools (9 total)
Dispatchers (8)
Each dispatcher accepts action + params. Call with action: "list" to discover all available actions.
crm_leads — Leads & Notes (14 actions)
list_leads— List leads with filtering and paginationget_lead— Get lead details by IDcreate_lead— Create a new leadupdate_lead— Update lead fieldsupdate_lead_status— Change lead statusarchive_lead— Archive a leaddelete_lead— Soft-delete a lead (ADMIN only)get_lead_history— Get lead change historyadd_lead_manual_event— Add manual event to historyget_users_for_lead_assignment— Get users for assignmentlist_lead_notes— List notes for a leadadd_lead_note— Add a note to a leadupdate_lead_note— Update a notedelete_lead_note— Delete a note
crm_companies — Companies & Search (11 actions)
search_companies— Search companies directorysearch_companies_full— Advanced company search with filtersget_company— Get company by IDcount_companies— Count companies by filtersautocomplete— Company name autocompleteget_taxonomy— Get all categories (niches)get_locations— Get cities/regionsadd_companies_to_leads— Add companies as leadslink_company_to_lead— Link company to leadunlink_company_from_lead— Unlink company from leadcopy_company_data_to_lead— Copy company data to lead
crm_proposals — Proposals, Research & Generation (12 actions)
list_proposals_by_lead— List proposals for a leadget_proposal_context— Get context for proposal creationcreate_proposal— Create a new proposalupdate_proposal— Update a proposalpreview_proposal— Preview a proposalstart_proposal_research— Start research for a proposalget_research_job_status— Check research job statusget_research_steps— Get research step cacheget_research_step_history— Get step version historyinvalidate_research_cache— Invalidate research cache (ADMIN only)generate_proposal_draft— Generate proposal draft via AIregenerate_proposal_section— Regenerate a proposal section
crm_analysis — Analysis & SEO (9 actions)
run_lead_structure_analysis— Run structure analysis (sitemap, crawl)run_ai_scoring— Run AI scoring for a leadrun_pagespeed_analysis— Run PageSpeed analysisgenerate_ai_audit— Generate AI audit for a sitestart_seo_research— Start SEO researchget_seo_results— Get SEO resultsget_seo_history— Get SEO analysis historysave_seo_results— Save SEO resultsget_analysis_job_status— Check analysis job status
crm_batch — Batch Operations & Uploads (9 actions)
batch_lead_structure— Batch structure analysis for leadsbatch_lead_programmatic— Batch programmatic analysis for leadsbatch_lead_ai_score— Batch AI scoring for leadsbatch_company_programmatic— Batch programmatic analysis for companiesbatch_company_structure— Batch structure analysis for companiesreanalyze_lead— Re-analyze a lead (selective: tech, mobile, speed)start_batch_analysis— Start batch URL analysisupload_screenshot— Upload a screenshot (base64)upload_prototype— Upload a prototype file (base64)
crm_tasks — Tasks (5 actions)
list_tasks— List tasks with filteringcreate_task— Create a taskupdate_task— Update a taskdelete_task— Delete a taskget_leads_for_task_select— Get leads for task assignment
crm_notifications — Notifications (4 actions)
list_notifications— List user notificationsget_unread_notification_count— Get unread countmark_all_notifications_read— Mark all as readmark_notification_read— Mark one as read
crm_admin — Users, Settings & Audit (9 actions)
register_user— Register a new user (ADMIN only)update_user— Update user data (ADMIN only)list_users— List all usersget_ai_settings— Get AI settings (ADMIN/CEO/AnalystAPI)update_ai_settings— Update AI settings (ADMIN/CEO only)list_audit_logs— List audit logs with filteringget_audit_log— Get audit log detailscleanup_audit_logs— Cleanup old audit logs (ADMIN only)cleanup_audit_log_details— Cleanup old audit log details (ADMIN only)
Standalone (1)
crm_health_check — Health Check
- No params. Returns
{ status, latency, version }.
Discovery
Call any dispatcher with action: "list" (and empty params) to see all available actions with their HTTP methods and endpoints:
{
"tool": "crm_leads",
"params": {
"action": "list",
"params": {}
}
}Response:
{
"available_actions": [
{ "name": "list_leads", "description": "...", "method": "GET", "endpoint": "/leads" },
...
],
"hint": "Pass action='name' and params={...} to execute."
}Migration from v1.x
Before (v1.x):
{ "tool": "crm_list_leads", "params": { "status": "NEW", "limit": 20 } }After (v2.0):
{ "tool": "crm_leads", "params": { "action": "list_leads", "params": { "status": "NEW", "limit": 20 } } }See CHANGELOG.md for full migration guide.
Development
cd packages/crm-mcp-server
npm install
npm run build
npm run inspect # Test with MCP InspectorError Handling
All errors are transformed into actionable messages for AI agents:
| HTTP Code | Message | |-----------|---------| | 400 | Invalid request: [details]. Check the parameters and try again. | | 401 | Authentication failed. The API key is invalid or expired. | | 403 | You don't have permission to perform this action. | | 404 | Resource not found. | | 409 | This resource is locked by another user or has been modified. | | 429 | Rate limit exceeded. Retry after N seconds. | | 500 | CRM is temporarily unavailable. Please try again later. |
Pagination
All list endpoints support pagination with page and limit parameters. Default limit is 20, maximum is 100. Responses exceeding 25,000 characters are truncated with a message indicating how to get more data.
License
Private — Internal use only.
