Auth0 MCP Server Demo — CRM

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.

Category
Visit Server

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) vs sales-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

  1. MCP client connects to http://localhost:3010/mcp
  2. FastMCP redirects to Auth0 Universal Login
  3. User authenticates — FastMCP validates the token and extracts permissions
  4. On each tool call, the MCP server performs RFC 8693 Token Exchange to get a CRM-scoped token
  5. Every tool response includes a delegation block 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

Email 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

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