mcp-crm
mcp-crm
学習用プロジェクトです。Model Context Protocol サーバーで、CRM を stdio 経由で MCP クライアントに公開します。
サインインはデバイスコードフローを利用して Microsoft Entra で行われます。取得した ID トークンは CRM アクセストークンに交換され、CRM クエリはサインインしたユーザーとして実行されます。そのため、返されるのは、そのユーザーが閲覧を許可されたデータだけです。
要件
Node.js 20+
デバイスコード(パブリッククライアント)フローを有効にした Entra アプリの登録
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.com3 つすべて必須です。いずれかが欠けていると、サーバーは起動時に例外をスローします。.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 アカウントを名前で検索します。完了したサインインが必要です。 |
| ハードコードされた小さなサンプルアカウントのリストを検索します。認証は不要です。実 CRM を使わずに接続のテストのために使用します。 |
サインインの流れ
start_crm_login は Entra が完了するまでブロックできないため、次の 2 つに分かれています:
start_crm_loginを呼び出します。デバイスコードとアクセス先の URL が返されます。ブラウザーでサインインを完了します。
確認のために
crm_login_statusを呼び出します。サインインしたユーザーが報告されたら、search_crm_accountsが動作します。
トークンはメモリ内のみに保持されます。サーバーを再起動すると、再びサインインする必要があります。
ライセンス
ISC
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.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Authenticated MCP server for ClearPolicy policy and compliance workflows.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables 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.2Apache 2.0
- AlicenseBqualityFmaintenanceEnables 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.16152 npmMIT
- 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.24 npmMIT