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.
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/entraand servesGET /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:
- Call
start_crm_login. It returns the device code and the URL to open. - Complete sign-in in the browser.
- Call
crm_login_statusto confirm. Once it reports a signed-in user,search_crm_accountswill work.
The token is held in memory only — restarting the server means signing in again.
License
ISC
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.