Auth0 MCP Server Demo — CRM
A secure MCP server for CRM operations (contacts and deals) with Auth0 OIDC authentication, role-based access control (sales-rep read-only vs sales-manager full access), and on-behalf-of token exchange.
README
Auth0 MCP Server Demo — CRM
A demo showing how to secure an MCP server with Auth0 using:
- FastMCP Auth0Provider — OIDC proxy so any MCP client (Claude Desktop, MCP Inspector) gets a standard browser-based OAuth login without manual token handling
- Role-Based Access Control —
sales-rep(read-only) vssales-manager(full access) - On-Behalf-Of Token Exchange — MCP server exchanges the user's token for a CRM API-scoped token, proving the agent acts with delegated user identity
MCP Client → FastMCP (OIDC proxy) → Auth0 Universal Login
↓
JWT validated, permissions checked
↓
OBO exchange → CRM API token
↓
Tool result + delegation proof
Architecture
| Package | Port | Stack | Purpose |
|---|---|---|---|
packages/mcp-server |
3010 | Python + FastMCP | MCP server with Auth0 OAuth proxy + OBO |
packages/crm-api |
3011 | Node.js + Express | Mock CRM REST API (downstream service) |
Auth Flow
- MCP client connects to
http://localhost:3010/mcp - FastMCP redirects to Auth0 Universal Login
- User authenticates — FastMCP validates the token and extracts
permissions - On each tool call, the MCP server performs RFC 8693 Token Exchange to get a CRM-scoped token
- Every tool response includes a
delegationblock proving who the agent is acting as
Demo Roles
| Role | Permissions | Can Do |
|---|---|---|
sales-rep |
crm:read |
List/view contacts and deals |
sales-manager |
crm:read + crm:write |
Full CRUD |
Prerequisites
- Node.js 20+
- Python 3.11+
- An Auth0 tenant
- AWS CLI (for CIMD hosting on S3/CloudFront)
Setup
1. Install dependencies
npm install
pip3 install -r packages/mcp-server/requirements.txt
2. Host the CIMD document
The CIMD document proves domain ownership when registering the MCP server with Auth0:
npm run deploy:cimd # provisions S3 + CloudFront + Route53 at mcp.authgatekeeper.com
3. Configure Auth0
# Get a Management API token from:
# Auth0 Dashboard → Applications → APIs → Auth0 Management API → API Explorer
AUTH0_MANAGEMENT_TOKEN=<token> npm run setup:auth0
Copy the printed values into your root .env.
4. Configure OBO token exchange
# After creating the Custom API client in Auth0:
AUTH0_MANAGEMENT_TOKEN=<token> npx tsx scripts/setup-obo.ts
5. Start
npm run dev
Testing
MCP Inspector
npx @modelcontextprotocol/inspector
Connect to http://localhost:3010/mcp — FastMCP handles the Auth0 login automatically.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"crm": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:3010/mcp"]
}
}
}
Available Tools
| Tool | Permission | Description |
|---|---|---|
whoami |
any | Show identity + full delegation chain |
list_contacts |
crm:read |
List contacts, filter by status |
get_contact |
crm:read |
Get contact by ID |
create_contact |
crm:write |
Create a new contact |
list_deals |
crm:read |
List deals, filter by stage or contact |
get_deal |
crm:read |
Get deal by ID |
create_deal |
crm:write |
Create a new deal |
Test Users
| Password | Role | |
|---|---|---|
sarah.rep@demo.com |
DemoPass1! |
sales-rep (crm:read) |
mike.manager@demo.com |
DemoPass1! |
sales-manager (crm:read + crm:write) |
Scripts
| Script | Purpose |
|---|---|
npm run setup:auth0 |
Provision Auth0 tenant (APIs, apps, roles, users) |
npm run deploy:cimd |
Deploy CIMD document to S3/CloudFront |
npm run update:cimd |
Re-upload CIMD document after changes |
npx tsx scripts/setup-obo.ts |
Configure OBO token exchange client |
npx tsx scripts/fix-permissions.ts |
Re-assign role permissions (run after audience change) |
Project Structure
mcp-server-auth/
├── packages/
│ ├── mcp-server/
│ │ ├── server.py # FastMCP server — tools + Auth0 OIDC proxy + OBO
│ │ └── requirements.txt
│ └── crm-api/
│ └── src/
│ ├── index.ts # Express API with JWT validation
│ └── data.ts # In-memory contacts and deals
├── scripts/
│ ├── setup.ts # Auth0 tenant provisioning
│ ├── setup-obo.ts # OBO client configuration
│ ├── fix-permissions.ts # Role permission repair utility
│ └── deploy-cimd.sh # AWS S3/CloudFront/Route53 deployment
└── .env.example
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。