auth0-mcp-server

auth0-mcp-server

Auth0 MCP 服务器与 LLM 和 AI 代理集成,允许您使用自然语言执行各种 Auth0 管理操作。例如,您可以简单地要求 Claude “创建一个新的 Auth0 应用程序并获取域名和客户端 ID”。

Category
访问服务器

README

Auth0 的 MCP 服务器

<div align="center">

License: MIT Node.js Version Downloads </div>

<div align="center">

📚 文档 • 🚀 快速开始 • 💻 支持的工具 • 💬 反馈 </div>

</br>

MCP (模型上下文协议) 是 Anthropic 引入的一个开放协议,它标准化了大型语言模型与外部工具、资源或远程服务通信的方式。

⚠ Beta 功能提示: 此功能目前处于 Beta 阶段。调用工具时请谨慎使用,因为功能可能不稳定或会发生更改。

Auth0 MCP 服务器与 LLM 和 AI 代理集成,允许您使用自然语言执行各种 Auth0 管理操作。 例如,您可以简单地要求 Claude 执行 Auth0 管理操作:

  • 创建一个新的 Auth0 应用程序并获取域名和客户端 ID

  • 创建并部署一个新的 Auth0 action 以生成 JWT 令牌

  • 你能帮我检查 Auth0 日志中来自 192.108.92.3 IP 地址的登录吗?

<br/>

<div align="center"> <img src="https://cdn.auth0.com/website/mcp/assets/auth0-mcp-example-demo.gif" alt="Auth0 MCP Server Demo" width="800"> </div>

🚀 快速开始

前提条件:

<br/>

安装 Auth0 MCP 服务器

安装 Auth0 MCP 服务器并将其配置为与您首选的 MCP 客户端一起使用。

Claude Desktop

npx @auth0/auth0-mcp-server init

Windsurf

npx @auth0/auth0-mcp-server init --client windsurf

Cursor

npx @auth0/auth0-mcp-server init --client cursor

其他 MCP 客户端

要将 Auth0 MCP 服务器与任何其他 MCP 客户端一起使用,您可以手动将此配置添加到客户端并重新启动以使更改生效:

{
  "mcpServers": {
    "auth0": {
      "command": "npx",
      "args": ["-y", "@auth0/auth0-mcp-server", "run"],
      "capabilities": ["tools"],
      "env": {
        "DEBUG": "auth0-mcp"
      }
    }
  }

</br>

使用 Auth0 进行身份验证

您的浏览器将自动打开以启动 OAuth 2.0 设备授权流程。 登录到您的 Auth0 帐户并授予请求的权限。

[!NOTE] 凭据安全地存储在您系统的密钥链中。 您可以选择通过密钥链管理工具验证存储。 查看 身份验证 了解更多信息。

</br>

验证您的集成

重新启动您的 MCP 客户端(Claude、Windsurf、Cursor 等...)并要求它帮助您管理您的 Auth0 租户

<div align="left"> <img src="https://cdn.auth0.com/website/mcp/assets/help-image-01.png" alt="Claude installed Help Image" width="300"> </div>

</br>

🛠️ 支持的工具

Auth0 MCP 服务器为 Claude 提供了以下工具来与您的 Auth0 租户交互:

<div align="center" style="display: flex; justify-content: center; gap: 20px;"> <img src="https://cdn.auth0.com/website/mcp/assets/help-image-02.png" alt="Supported Tools img" width="400"> <img src="https://cdn.auth0.com/website/mcp/assets/help-image-03.png" alt="Supported Tools img" width="400"> </div>

应用程序

工具 描述 使用示例
auth0_list_applications 列出 Auth0 租户中的所有应用程序或按名称搜索 - Show me all my Auth0 applications <br> - Find applications with 'api' in their name <br> - What applications do I have in my Auth0 tenant?
auth0_get_application 获取有关特定 Auth0 应用程序的详细信息 - Show me details for the application called 'Customer Portal' <br> - Get information about my application with client ID abc123 <br> - What are the callback URLs for my 'Mobile App'?
auth0_create_application 创建一个新的 Auth0 应用程序 - Create a new single-page application called 'Analytics Dashboard' <br> - Set up a new native mobile app called 'iOS Client' <br> - Create a machine-to-machine application for our background service
auth0_update_application 更新现有的 Auth0 应用程序 - Update the callback URLs for my 'Web App' to include https://staging.example.com/callback <br> - Change the logout URL for the 'Customer Portal' <br> - Add development environment metadata to my 'Admin Dashboard' application

资源服务器

工具 描述 使用示例
auth0_list_resource_servers 列出 Auth0 租户中的所有资源服务器 (API) - Show me all the APIs in my Auth0 tenant <br> - List my resource servers <br> - What APIs have I configured in Auth0?
auth0_get_resource_server 获取有关特定 Auth0 资源服务器的详细信息 - Show me details for the 'User API' <br> - What scopes are defined for my 'Payment API'? <br> - Get information about the resource server with identifier https://api.example.com"
auth0_create_resource_server 创建一个新的 Auth0 资源服务器 (API) - Create a new API called 'Inventory API' with read and write scopes <br> - Set up a resource server for our customer data API <br> - Create an API with the identifier https://orders.example.com"
auth0_update_resource_server 更新现有的 Auth0 资源服务器 - Add an 'admin' scope to the 'User API' <br> - Update the token lifetime for my 'Payment API' to 1 hour <br> - Change the signing algorithm for my API to RS256

Actions

工具 描述 使用示例
auth0_list_actions 列出 Auth0 租户中的所有 action - Show me all my Auth0 actions <br> - What actions do I have configured? <br> - List the actions in my tenant
auth0_get_action 获取有关特定 Auth0 action 的详细信息 - Show me the code for my 'Enrich User Profile' action <br> - Get details about my login flow action <br> - What does my 'Add Custom Claims' action do?
auth0_create_action 创建一个新的 Auth0 action - Create an action that adds user roles to tokens <br> - Set up an action to log failed login attempts <br> - Create a post-login action that checks user location
auth0_update_action 更新现有的 Auth0 action - Update my 'Add Custom Claims' action to include department information <br> - Modify the IP filtering logic in my security action <br> - Fix the bug in my user enrichment action
auth0_deploy_action 部署 Auth0 action - Deploy my 'Add Custom Claims' action to production <br> - Make my new security action live <br> - Deploy the updated user enrichment action

日志

工具 描述 使用示例
auth0_list_logs 列出 Auth0 租户中的日志 - Show me recent login attempts <br> - Find failed logins from the past 24 hours <br> - Get authentication logs from yesterday <br> - Show me successful logins for user john@example.com
auth0_get_log 按 ID 获取特定日志条目 - Show me details for log entry abc123 <br> - Get more information about this failed login attempt <br> - What caused this authentication error?

表单

工具 描述 使用示例
auth0_list_forms 列出 Auth0 租户中的所有表单 - Show me all my Auth0 forms <br> - What login forms do I have configured? <br> - List the custom forms in my tenant
auth0_get_form 获取有关特定 Auth0 表单的详细信息 - Show me the details of my 'Corporate Login' form <br> - What does my password reset form look like? <br> - Get the configuration for my signup form
auth0_create_form 创建一个新的 Auth0 表单 - Create a new login form with our company branding <br> - Set up a custom signup form that collects department information <br> - Create a password reset form with our logo
auth0_update_form 更新现有的 Auth0 表单 - Update the colors on our login form to match our new brand guidelines <br> - Add a privacy policy link to our signup form <br> - Change the logo on our password reset form
auth0_publish_form 发布 Auth0 表单 - Publish my updated login form <br> - Make the new signup form live <br> - Deploy the password reset form to production

🕸️ 架构

Auth0 MCP 服务器实现了模型上下文协议,允许 Claude:

  1. 请求可用 Auth0 工具的列表
  2. 使用参数调用特定工具
  3. 接收来自 Auth0 Management API 的结构化响应

服务器处理身份验证、请求验证以及与 Auth0 Management API 的安全通信。

<div align="centre"> <img src="https://cdn.auth0.com/website/mcp/assets/auth0-mcp-server-hld.png" alt="Auth0 MCP Server HLD" width="800"> </div>

[!NOTE] 该服务器作为连接到 Claude Desktop 的本地进程运行,从而实现安全通信,而不会暴露您的 Auth0 凭据。

</br>

🔐 身份验证

Auth0 MCP 服务器使用 Auth0 Management API,并且需要身份验证才能访问您的 Auth0 租户。

初始设置

要验证 MCP 服务器的身份:

npx @auth0/auth0-mcp-server init

这将启动设备授权流程,允许您登录到您的 Auth0 帐户并选择您要使用的租户。

[!IMPORTANT] 在以下情况下,需要运行 init 命令:

  • 您是第一次设置 MCP 服务器
  • 您已从之前的会话中注销
  • 您想要切换到其他租户
  • 您的令牌已过期

会话管理

要查看有关当前身份验证会话的信息:

npx @auth0/auth0-mcp-server session

注销

为了安全起见,在完成会话后始终使用注销命令:

npx @auth0/auth0-mcp-server logout

这可确保您的身份验证令牌已从系统密钥链中正确删除。

身份验证流程

该服务器使用 OAuth 2.0 设备授权流程,以便与 Auth0 进行安全身份验证。 您的凭据安全地存储在您系统的密钥链中,并且永远不会以纯文本形式公开。

<div align="centre"> <img src="https://cdn.auth0.com/website/mcp/assets/mcp-server-auth.png" alt="Authentication Sequence Diagram" width="800"> </div>

</br>

🩺 故障排除

获取命令行帮助:查看支持的命令和使用示例的列表

# 命令帮助
npx @auth0/auth0-mcp-server help

# 初始化服务器(身份验证和配置)
npx @auth0/auth0-mcp-server init

# 使用特定范围初始化(支持 glob 模式)
npx @auth0/auth0-mcp-server init --scopes 'read:*,create:clients'

# 运行服务器
npx @auth0/auth0-mcp-server run

# 显示当前会话信息
npx @auth0/auth0-mcp-server session

# 从密钥链中删除 Auth0 令牌
npx @auth0/auth0-mcp-server logout

🚥 运行模式

🐞 调试模式

  • 更详细的日志记录
  • 通过设置环境变量启用:export DEBUG=auth0-mcp

[!TIP] 调试模式在对连接或身份验证问题进行故障排除时特别有用。

🔑 范围选择

服务器在初始化期间提供交互式范围选择界面:

  • 交互式选择:使用箭头键导航,使用空格键切换选择
  • 无默认范围:默认情况下,不选择任何范围以实现最大安全性
  • Glob 模式支持:使用模式快速选择多个相关范围:
    # 选择所有读取范围
    npx @auth0/auth0-mcp-server init --scopes 'read:*'
    
    # 选择多个范围模式(逗号分隔)
    npx @auth0/auth0-mcp-server init --scopes 'read:*,create:clients,update:actions'
    

[!NOTE] 选择的范围决定了 MCP 服务器可以在您的 Auth0 租户上执行哪些操作。

⚙️ 配置

其他 MCP 客户端:

要将 Auth0 MCP 服务器与任何其他 MCP 客户端一起使用,您可以将此配置添加到客户端并重新启动以使更改生效:

{
  "mcpServers": {
    "auth0": {
      "command": "npx",
      "args": ["-y", "@auth0/auth0-mcp-server", "run"],
      "capabilities": ["tools"],
      "env": {
        "DEBUG": "auth0-mcp"
      }
    }
  }
}

[!NOTE] 如果需要或在 npx init 命令期间发生任何意外错误,您可以手动更新。

🚨 常见问题

  1. 身份验证失败

    • 确保您在 Auth0 租户中具有正确的权限
    • 尝试使用 npx @auth0/auth0-mcp-server init 重新初始化
  2. Claude 无法连接到服务器

    • 安装后重新启动 Claude Desktop
    • 检查服务器是否正在运行,使用 ps aux | grep auth0-mcp
  3. API 错误或权限问题

    • 使用 export DEBUG=auth0-mcp 启用调试模式
    • 检查您的 Auth0 令牌权限和到期时间
    • 使用特定范围重新初始化:npx @auth0/auth0-mcp-server init --scopes 'read:*,update:*,create:*'
    • 如果特定操作失败,您可能缺少所需的范围

[!TIP] 大多数连接问题可以通过重新启动服务器和 Claude Desktop 来解决。

</br>

📋 调试日志

启用调试模式以查看详细日志:

export DEBUG=auth0-mcp

从 Claude Desktop 获取详细的 MCP 客户端日志:

# 实时跟踪日志
tail -n 20 -F ~/Library/Logs/Claude/mcp*.log

对于高级故障排除,请使用 MCP Inspector:

npx @modelcontextprotocol/inspector -e DEBUG='auth0-mcp' @auth0/auth0-mcp-server run

对于详细的 MCP 服务器日志,请在调试模式下运行服务器:

DEBUG=auth0-mcp npx @auth0/auth0-mcp-server run

</br>

👨‍💻 开发

从源代码构建

# 克隆存储库
git clone https://github.com/auth0/auth0-mcp-server.git
cd auth0-mcp-server

# 安装依赖项
npm install

# 构建项目
npm run build

# 启动设备身份验证流程
npx . init

# 使用 MCP 服务器路径配置您的 MCP 客户端(Claude Desktop)
npm run local-setup

# 重新启动 MCP 客户端,在本例中为 claude desktop app

[!NOTE] 此服务器需要 Node.js v18 或更高版本

</br>

🔒 安全

Auth0 MCP 服务器优先考虑安全性:

  • 凭据存储在系统的安全密钥链中
  • 没有敏感信息以纯文本形式存储
  • 身份验证使用 OAuth 2.0 设备授权流程
  • 默认情况下不请求任何权限(范围)
  • 交互式范围选择允许您准确选择要授予的权限
  • 支持 glob 模式以快速选择相关范围(例如,read:*
  • 通过 logout 命令轻松删除令牌,在不再需要时

[!IMPORTANT] 为了安全起见,在完成会话或在租户之间切换时,始终使用 npx @auth0/auth0-mcp-server logout。 这可确保您的身份验证令牌已从系统密钥链中正确删除。

[!CAUTION] 始终查看身份验证过程中请求的权限,以确保它们符合您的安全要求。

</br>

💬 反馈和贡献

我们感谢对该项目的反馈和贡献! 在您开始之前,请参阅:

报告问题

要提供反馈或报告错误,请在我们的问题跟踪器上提出问题

漏洞报告

请不要在公共 GitHub 问题跟踪器上报告安全漏洞。 负责任的披露计划 详细说明了披露安全问题的程序。

</br>

📄 许可证

本项目根据 MIT 许可证获得许可。 有关更多信息,请参阅 LICENSE 文件。

什么是 Auth0?

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/auth0-logos/2023-branding/favicon/auth0-icon-ondark.svg" width="150" height="75"> <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/auth0-logos/2023-branding/favicon/auth0-icon-onlight.svg" width="150" height="75"> <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150"> </picture> </p> <p align="center"> Auth0 是一个易于实施、适应性强的身份验证和授权平台。 要了解更多信息,请查看 <a href="https://auth0.com/why-auth0">为什么选择 Auth0?</a> </p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选