高性能Perfex CRM服务器

MCP Perfex CRM是一个高性能的Model Context Protocol (MCP)服务器,提供对Perfex CRM MySQL数据库的直接和优化访问,适用于需要高效CRM数据管理的企业。

  • by Descomplicar-Marketing-e-Tecnologia
  • TypeScript
  • 本地部署
  • 34 星标
  • 更新于
在 GitHub 查看 Descomplicar-Marketing-e-Tecnologia/mcp-perfex-crm

使用说明

MCP Perfex CRM-用于Perfex CRM的高性能MCP服务器

🎯 概述

MCP Perfex CRM 是一个高性能的模型上下文协议(MCP)服务器,提供对Perfex CRM MySQL数据库的直接和优化访问。该项目提供了传统REST API的高性能替代方案,重点关注代码质量、安全性和可维护性。

✅ 当前状态-v1.0.0稳定版

  • 14个功能模块 拥有186多种经过测试的工具,涵盖全面的Perfex CRM功能
  • 零警告 ESLint和TypeScript
  • 完整的CI/CD GitHub操作
  • 稳健型系统 实施
  • 完整的API文件

🚀 特性

  • 🔥 演出:MySQL直接访问,比REST API快10-100倍
  • 🛡️ 安全:准备好的语句、输入验证、只读连接
  • 📊 模块化:具有独立模块的可扩展架构
  • 🧪 已测试:覆盖范围不断扩大的Jest测试框架
  • 📝 已记录:完整的API文档及示例
  • 🔄 CI/CD:带质量门的自动化管道

📦 可用模块

核心(100%功能性)

  • 客户 -全面的客户管理
  • 估计 -估算和建议
  • 发票 -完整的发票管理,包括付款和统计(8个工具)
  • 潜在客户 -潜在客户管理、转化和生命周期跟踪(9个工具)
  • 项目 -项目管理
  • 任务 -任务控制
  • 合同 -合同管理
  • 支付 -付款处理
  • 开支 -费用控制
  • 门票 -具有删除/导出工具的完整支持系统

报告

  • 财务报告 -高级财务报告
  • 资源管理 -资源管理
  • 时间表 -时间追踪

公用事业

  • 订阅 -订阅管理
  • 贷项凭单 -贷方票据

🛠️ 安装

选项1:NPM安装(推荐)

npm install -g mcp-perfex-crm

选项2:本地安装

# Clone repository
git clone https://github.com/YOUR_USERNAME/mcp-perfex-crm
cd mcp-perfex-crm

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your MySQL settings

# Compile project
npm run build

# Run tests
npm test

⚙️ 配置

1.数据库配置

# .env
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=perfex_readonly
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=perfex_crm

# Log optimization for production
LOG_LEVEL=error
NODE_ENV=production
ENABLE_AUDIT_LOG=false

2.N8N集成

MCP Perfex CRM 与N8N完全兼容,实现工作流自动化:

# Install as N8N tool
npm install -g mcp-perfex-crm

# Or use in N8N Docker
FROM n8nio/n8n:latest
RUN npm install -g mcp-perfex-crm

N8N工作流示例:

{
  "nodes": [
    {
      "parameters": {
        "command": "mcp-perfex-crm",
        "options": {
          "env": {
            "MYSQL_HOST": "your-db-host",
            "MYSQL_USER": "readonly_user",
            "MYSQL_PASSWORD": "secure_password",
            "MYSQL_DATABASE": "perfex_crm"
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [250, 300],
      "id": "perfex-crm-tool"
    }
  ]
}

3.克劳德桌面集成

{
  "mcpServers": {
    "mcp-perfex-crm": {
      "command": "mcp-perfex-crm",
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "perfex_readonly",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "perfex_crm"
      }
    }
  }
}

对于本地安装:

{
  "mcpServers": {
    "mcp-perfex-crm": {
      "command": "node",
      "args": ["/path/to/mcp-perfex-crm/dist/index.js"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "perfex_readonly",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "perfex_crm"
      }
    }
  }
}

📖 用法

示例:列出客户

// Via MCP
const result = await use_mcp_tool({
  server_name: "mcp-perfex-crm",
  tool_name: "get_customers",
  arguments: {
    limit: 10,
    active: true
  }
});

示例:创建项目

const result = await use_mcp_tool({
  server_name: "mcp-perfex-crm",
  tool_name: "create_project",
  arguments: {
    name: "New Website",
    client_id: 123,
    start_date: "2025-02-01",
    billing_type: "fixed_rate",
    project_cost: 5000
  }
});

🧪 发展

# Development mode with hot reload
npm run dev

# Run linter
npm run lint

# Format code
npm run format

# Run tests with coverage
npm run test:coverage

# Production build
npm run build

📊 代码质量

  • ✅ TypeScript:坚固型系统
  • ✅ ESLint:零警告,严格配置
  • ✅ 更漂亮:格式一致
  • ✅ 开玩笑:已配置的测试框架
  • ✅ GitHub操作:自动化CI/CD
  • ✅ 优化日志记录:对环境影响最小的生产配置

🔒 安全

  • 所有查询都使用预先准备好的语句
  • 所有工具的输入验证
  • 默认情况下为只读连接
  • 敏感操作的审计日志
  • 日志中敏感数据的掩码

🤝 贡献

欢迎投稿!拜托:

  1. 分叉项目
  2. 创建要素分支(git checkout -b feature/AmazingFeature)
  3. 提交您的更改(git commit -m 'Add some AmazingFeature')
  4. 推到分支(git push origin feature/AmazingFeature)
  5. 打开拉取请求

代码规范

  • 遵循配置的Types/ESLint风格
  • 添加新功能的测试
  • 保持文档更新
  • 零警告是强制性的

📈 路线图

v1.0.1(2025年2月)

  • []增强的错误处理
  • []性能指标仪表板
  • []自动生成文档
  • []扩展测试覆盖范围

v1.1.0(2025年第一季度)

  • []测试覆盖率>80%
  • []完全TypeScript严格模式
  • [ ] Webhook支持
  • []智能缓存

v1.2.0(2025年第二季度)

  • []分析仪表板
  • []批量操作
  • []GraphQL网关
  • []增强的多租户支持

📝 文档

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

👨‍💻 作者

伊曼纽尔·阿尔梅达

🙏 致谢

  • 模型上下文协议的拟人团队
  • Perfex CRM社区
  • 所有贡献者

📊 性能基准

操作 REST API MCP Direct 改进
获得客户(100) 2.3秒 0.23秒 快10倍
创建项目 1.8秒 0.18秒 快10倍
复杂查询 5.2秒 0.52秒 快10倍

🏗️ 建筑

mcp-perfex-crm/
├── src/
│   ├── modules/          # Business logic modules
│   ├── tools/            # MCP tools implementation
│   ├── types/            # TypeScript definitions
│   ├── utils/            # Utility functions
│   └── connections/      # Database connections
├── tests/                # Test suites
├── docs/                 # Documentation
└── examples/             # Usage examples

⭐ 如果这个项目对你有帮助,请考虑给它一颗星!

🚀 准备好增强您的Perfex CRM集成了吗?现在就开始吧!