mcp-crm

mcp-crm

Enables MCP clients to access a CRM over stdio, with Microsoft Entra device-code sign-in so queries run as the signed-in user, and tools to start/check login and search CRM accounts.

Category
Visit Server

README

mcp-crm

A learning project: a Model Context Protocol server that exposes a CRM to an MCP client over stdio.

Sign-in goes through Microsoft Entra using the device-code flow. The resulting identity token is exchanged for a CRM access token, so CRM queries run as the signed-in user and return only what that user is allowed to see.

Requirements

  • Node.js 20+
  • An Entra app registration with the device-code (public client) flow enabled
  • A CRM API that accepts an Entra token at POST /api/auth/entra and serves GET /api/accounts

Setup

npm install

Create a .env in the project root:

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

All three are required — the server throws on startup if any is missing. .env is gitignored; never commit it.

Running

npx tsx src/index.ts     # run directly
npx tsc                  # type-check and build to dist/

The server speaks MCP over stdio, so it is normally launched by a client rather than by hand. To register it with Claude Code:

{
  "mcpServers": {
    "crm": {
      "command": "npx",
      "args": ["tsx", "/absolute/path/to/mcp-crm/src/index.ts"]
    }
  }
}

Log output goes to stderr, since stdout carries the MCP protocol.

Tools

Tool Description
start_crm_login Begins Entra device-code sign-in and returns the code and URL to visit. Returns immediately; the sign-in completes in the background.
crm_login_status Reports whether that sign-in has finished, is still pending, or failed.
search_crm_accounts Searches real CRM accounts by name. Requires a completed sign-in. Returns up to 25 matches with id, name, status, and sales_rep.
search_accounts Searches a small hardcoded list of sample accounts. No auth needed — used for testing the wiring without a live CRM.

Sign-in flow

start_crm_login cannot block until Entra finishes, so it is split in two:

  1. Call start_crm_login. It returns the device code and the URL to open.
  2. Complete sign-in in the browser.
  3. Call crm_login_status to confirm. Once it reports a signed-in user, search_crm_accounts will work.

The token is held in memory only — restarting the server means signing in again.

License

ISC

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured