Skip to main content
Glama
Saipranoy

mcp-crm

by Saipranoy

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: M365 Copilot Web Bridge

设置

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 协议。

工具

工具

说明

start_crm_login

开始 Entra 设备码登录,并返回需要访问的验证码和 URL。该调用会立即返回;登录在后台完成。

crm_login_status

报告那一次登录是否已完成、仍在等待,还是已失败。

search_crm_accounts

按名称搜索真实 CRM 账户。需要先完成登录。最多返回 25 条匹配结果,包含 idnamestatussales_rep

search_accounts

在一个小型硬编码示例账户列表中搜索。无需认证——用于在没有真实 CRM 的情况下测试整套连接是否正常。

登录流程

start_crm_login 无法阻塞等待 Entra 完成,因此被拆成两个部分:

  1. 调用 start_crm_login。它会返回设备代码和需要打开的 URL。

  2. 在浏览器中完成登录。

  3. 调用 crm_login_status 进行确认。一旦它报告了已登录用户,search_crm_accounts 即可正常工作。

令牌仅保存在内存中——重启服务器后需要重新登录。

许可证

ISC

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Bridges stdio-based LLM harnesses to OAuth-protected remote MCP servers via Streamable HTTP, handling PKCE browser login and token refresh automatically.
    9
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides MCP tools to interact with GoHighLevel CRM data, including contacts, conversations, call transcripts, broker lead overviews, pipelines/opportunities, and task creation. Supports both stdio and HTTP transports for local and remote use.

View all related MCP servers

Related MCP Connectors

  • Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.

  • Official Microsoft MCP Server to query Microsoft Entra data using natural language

  • Query SEC EDGAR filings, XBRL financials, and company data through MCP. STDIO & Streamable HTTP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Saipranoy/mcp-crm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server