mcp-crm
mcp-crm
一个学习项目:一个基于 stdio 向 MCP 客户端暴露 CRM 的 Model Context Protocol 服务器。
登录通过 Microsoft Entra 使用设备码流程完成。生成的身份令牌会交换为 CRM 访问令牌,因此 CRM 查询会以已登录用户的身份运行,并且只返回该用户有权查看的内容。
要求
Node.js 20+
一个已启用设备码(公共客户端)流程的 Entra 应用注册
一个可在
POST /api/auth/entra接受 Entra 令牌,并在GET /api/accounts提供数据的 CRM API
Related MCP server: ff-crm-mcp
设置
npm install在项目根目录创建 .env 文件:
ENTRA_CLIENT_ID=<your app registration's client id>
ENTRA_TENANT_ID=<your directory tenant id>
CRM_API_BASE_URL=https://your-crm.example.com以下三项都是必需的——服务器启动时若缺少任何一项都会抛出异常。.env 已被 gitignore;切勿提交它。
运行
npx tsx src/index.ts # run directly
npx tsc # type-check and build to dist/服务器通过 stdio 进行 MCP 协议通信,因此通常由客户端启动,而不是手动运行。要将其注册到 Claude Code:
{
"mcpServers": {
"crm": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/mcp-crm/src/index.ts"]
}
}
}日志输出进入 stderr,因为 stdout 承载着 MCP 协议。
工具
工具 | 说明 |
| 开始 Entra 设备码登录,并返回需要访问的验证码和 URL。该调用会立即返回;登录在后台完成。 |
| 报告那一次登录是否已完成、仍在等待,还是已失败。 |
| 按名称搜索真实 CRM 账户。需要先完成登录。最多返回 25 条匹配结果,包含 |
| 在一个小型硬编码示例账户列表中搜索。无需认证——用于在没有真实 CRM 的情况下测试整套连接是否正常。 |
登录流程
start_crm_login 无法阻塞等待 Entra 完成,因此被拆成两个部分:
调用
start_crm_login。它会返回设备代码和需要打开的 URL。在浏览器中完成登录。
调用
crm_login_status进行确认。一旦它报告了已登录用户,search_crm_accounts即可正常工作。
令牌仅保存在内存中——重启服务器后需要重新登录。
许可证
ISC
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Unofficial remote MCP server for Less Annoying CRM: OAuth 2.1, read-only grants, 10 tools.
Manage contacts, organizations and their recorded relationships in your workspace. Setup: In a remote MCP client that supports Streamable HTTP and OAuth, add https://platform.samuelz.com/api/v1/mcp/operator?toolset=crm. Sign in to Samuelz and select your authorized workspace. An active workspace membership and the relevant module permissions are required. Review the requested permissions before authorizing. Existing approval requirements continue to apply.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables managing Onde Inference accounts and model catalog operations through MCP tools such as login, app management, model registration, and assignment. Returns structured JSON over stdio for use with any MCP client.6Apache 2.0
- FlicenseNot gradedqualityBmaintenanceProvides a one-shot CLI to open an MCP session, run a single CRM gateway tool, and exit, plus a stdio-to-Streamable-HTTP bridge for registering the gateway as an MCP connector.-
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to query projects, fetch findings, trigger analysis, upload CycloneDX BOMs, and check async token status against an OWASP Dependency-Track instance via stdio.MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to interact with the Crewmeister API over local stdio, covering operations for members, teams, time tracking, salary exports, and related platform resources.Apache 2.0