Skip to main content
Glama
mcp-crm

mcp-crm

by Saipranoy

mcp-crm

학습용 프로젝트: Model Context Protocol 서버로, stdio를 통해 CRM을 MCP 클라이언트에 노출합니다.

로그인은 Microsoft Entra를 통해 device-code 흐름을 사용해 진행됩니다. 결과로 얻은 ID 토큰은 CRM 액세스 토큰과 교환되므로, CRM 쿼리는 로그인한 사용자로 실행되며 해당 사용자에게 허용되는 데이터만 반환됩니다.

요구 사항

  • Node.js 20+

  • Entra 앱 등록에서 device-code(공용 클라이언트) 흐름이 활성화되어 있어야 합니다.

  • POST /api/auth/entra에서 Entra 토큰을 받아들이고 GET /api/accounts를 제공하는 CRM API

Related MCP server: Relay 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 프로토콜을 운반하기 때문입니다.

도구

Tool

Description

start_crm_login

Entra device-code 로그인을 시작하고 방문할 코드와 URL을 반환합니다. 즉시 반환되며, 로그인은 백그라운드에서 완료됩니다.

crm_login_status

해당 로그인이 완료되었는지, 아직 진행 중인지, 실패했는지 보고합니다.

search_crm_accounts

실제 CRM 계정을 이름으로 검색합니다. 로그인 완료가 필요합니다. id, name, status, sales_rep와 함께 최대 25개의 일치 항목을 반환합니다.

search_accounts

보통 하드코딩된 샘플 계정 목록을 검색합니다. 인증이 필요 없습니다. 실제 CRM 없이 연결을 테스트할 때 사용됩니다.

로그인 흐름

start_crm_login은 Entra 인증이 끝날 때까지 기다릴 수 없으므로 두 단계로 나뉩니다:

  1. start_crm_login을 호출합니다. 디바이스 코드가 반환됩니다.

  2. 브라우저에서 로그인을 완료하면 URL이 제공됩니다.

  3. crm_login_status를 호출해 확인합니다. 로그인된 사용자가 확인되면 search_crm_accounts가 작동합니다.

토큰은 메모리에만 저장되므로, 서버를 재시작하면 다시 로그인해야 합니다.

라이선스

ISC

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    F
    maintenance
    Enables local MCP clients to manage messaging workflows via stdio: list and read chats/messages, send messages, react to messages, manage typing/read state, and handle contact cards and requests.
    16
    152 npm
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides 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.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    24 npm
    MIT