auth0-mcp-server

Official

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Enables management of Auth0 resources through natural language, including creating and updating applications, resource servers (APIs), actions, forms, and accessing Auth0 logs. Allows performing operations like creating new Auth0 apps, deploying actions, and checking authentication logs.

📚文档• 🚀入门• 💻支持的工具• 💬反馈

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

**⚠ Beta 功能通知:**此功能目前处于 Beta 阶段。调用工具时请谨慎使用,因为功能可能不稳定或随时可能更改。

Auth0 MCP 服务器集成了 LLM 和 AI 代理,允许您使用自然语言执行各种 Auth0 管理操作。例如,您可以直接让 Claude 执行 Auth0 管理操作:

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

  • 创建并部署新的 Auth0 操作以生成 JWT 令牌

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

🚀 入门

先决条件:

安装 Auth0 MCP 服务器

安装 Auth0 MCP 服务器并将其配置为与您的首选 MCP 客户端配合使用。-- --tools参数指定可用的工具(如果未提供,则默认为* )。

带有所有工具的 Claude Desktop

npx @auth0/auth0-mcp-server init

带有只读工具的 Claude Desktop

npx @auth0/auth0-mcp-server init --tools 'auth0_list_*,auth0_get_*'

风帆冲浪

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

光标

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

工具访问权限有限

npx @auth0/auth0-mcp-server init --client cursor --tools 'auth0_list_applications,auth0_get_application'

其他 MCP 客户端

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

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

您可以将--tools '<pattern>'添加到 args 数组中,以控制可用的工具。请参阅安全最佳实践,了解推荐的模式。

使用 Auth0 进行身份验证

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

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

验证您的集成

重启你的 MCP 客户端(Claude、Windsurf、Cursor 等...)并让它帮助你管理你的 Auth0 租户

🛠️ 支持的工具

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

应用

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

资源服务器

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

行动

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

日志

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

表格

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

🔒 工具访问安全最佳实践

配置 Auth0 MCP 服务器时,务必遵循安全最佳实践,根据您的具体需求限制工具访问权限。服务器提供灵活的配置选项,让您可以控制 AI 助手可以访问哪些工具。

您可以在启动服务器时使用--tools标志轻松限制工具访问:

# Enable only read-only operations npx @auth0/auth0-mcp-server run --tools 'auth0_list_*,auth0_get_*' # Limit to just application-related tools npx @auth0/auth0-mcp-server run --tools 'auth0_*_application*' # Restrict to only log viewing capabilities npx @auth0/auth0-mcp-server run --tools 'auth0_list_logs,auth0_get_log' # Run the server with all tools enabled npx @auth0/auth0-mcp-server run --tools '*'

这种方法有几个重要的好处:

  1. 增强的安全性:通过将可用工具限制为仅需要的工具,您可以减少潜在的攻击面并防止对 Auth0 租户进行意外修改。
  2. 更佳性能:为 AI 助手提供更少的工具实际上可以提升性能。当模型能够访问多种工具时,它们会更多地利用上下文窗口来判断应该使用哪些工具。使用一套专注的工具,您将获得更快、更相关的响应。
  3. 基于资源的访问控制:您可以根据特定需求使用不同的工具集配置 MCP 服务器的不同实例 - 开发环境可能需要完全访问权限,而生产环境可能仅限于读取操作。
  4. 简化审计:使用有限的工具,可以更轻松地跟踪通过 AI 助手执行的操作。

对于大多数用例,请从所需的最少工具集开始,仅在需要时添加更多工具。这遵循最小特权原则——一项基本的安全最佳实践。

🕸️ 建筑

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

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

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

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

🔐 身份验证

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

初始设置

要验证 MCP 服务器:

npx @auth0/auth0-mcp-server init

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

重要提示:每当出现以下情况时,都需要运行init命令:

  • 您正在首次设置 MCP 服务器
  • 您已从上一个会话中退出
  • 您想切换到其他租户
  • 您的令牌已过期

会话管理

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

npx @auth0/auth0-mcp-server session

注销

为了确保最佳安全,请在会话结束后始终使用注销命令:

npx @auth0/auth0-mcp-server logout

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

身份验证流程

服务器使用 OAuth 2.0 设备授权流程通过 Auth0 进行安全身份验证。您的凭据安全地存储在系统的钥匙串中,绝不会以纯文本形式泄露。

🩺 故障排除

当遇到 Auth0 MCP 服务器问题时,可以使用多种故障排除选项来帮助诊断和解决问题。

通过探索所有可用的命令和选项开始故障排除:

npx @auth0/auth0-mcp-server help

🚥 操作模式

🐞 调试模式

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

[!TIP] 在解决连接或身份验证问题时,调试模式特别有用。

🔑 范围选择

服务端在初始化时提供交互式的作用域选择界面:

  • 交互式选择:使用箭头键导航并使用空格键切换选择
  • 无默认范围:默认情况下,不选择任何范围以实现最大安全性
  • Glob 模式支持:使用模式快速选择多个相关范围:
    # Select all read scopes npx @auth0/auth0-mcp-server init --scopes 'read:*' # Select multiple scope patterns (comma-separated) 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" } } } }

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

🚨常见问题

  1. 身份验证失败
    • 确保您在 Auth0 租户中拥有正确的权限
    • 尝试使用npx @auth0/auth0-mcp-server init重新初始化
  2. 克劳德无法连接到服务器
    • 安装后重新启动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 来解决。

📋 调试日志

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

export DEBUG=auth0-mcp

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

# Follow logs in real-time 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

👨‍💻 开发

从源代码构建

# Clone the repository git clone https://github.com/auth0/auth0-mcp-server.git cd auth0-mcp-server # Install dependencies npm install # Build the project npm run build # Initiate device auth flow npx . init # Configure your MCP client(Claude Desktop) with MCP server path npm run local-setup # Restart MCP client, in this case claude desktop app

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

🔒 安全

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

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

重要提示:为了确保最佳安全做法,请在完成会话或在租户之间切换后始终使用npx @auth0/auth0-mcp-server logout 。这可确保你的身份验证令牌已从系统钥匙串中正确删除。

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

匿名分析披露

在使用本 MCP 服务器期间,我们会收集匿名数据点。这些数据包括 MCP 版本、操作系统、时间戳以及其他不会识别您个人身份的技术细节。

Auth0 使用这些数据来更好地了解此工具的使用情况,以便优先考虑对我们的用户最重要的功能、增强功能和修复。

退出此收集,请将AUTH0_MCP_ANALYTICS环境变量设置为false

💬 反馈和贡献

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

报告问题

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

漏洞报告

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

📄 许可证

本项目采用 MIT 许可证。更多信息请参阅LICENSE文件。

什么是 Auth0?

ID: lz9vzh2y5r