Skip to main content
Glama

Auth0 的 MCP 服务器

许可证:MIT Node.js 版本 NPM 下载 NPM 版本

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

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

CAUTION

Beta 软件通知:此软件目前处于测试阶段,按“原样”提供,不提供任何担保。

  • 特性、API 和功能可能随时更改,恕不另行通知

  • 不建议用于生产用途或关键工作负载

  • 测试期间的支持有限

  • 可以通过GitHub 问题跟踪器报告问题和反馈

通过使用此测试版软件,您承认并接受这些条件。

Auth0 MCP 服务器集成了 LLM 和 AI 代理,允许您使用自然语言执行各种 Auth0 管理操作。例如,您可以直接让 Claude Desktop 执行 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 --read-only

您还可以明确选择只读工具:

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 Desktop、Windsurf、Cursor 等)并要求它帮助您管理 Auth0 租户

Related MCP server: Auth0 OIDC MCP Server

🛠️ 支持的工具

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--read-only标志轻松限制工具访问:

# Enable only read-only operations npx @auth0/auth0-mcp-server run --read-only # Alternative way to 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*' # Limit to read-only application-related tools # Note: --read-only takes priority when used with --tools npx @auth0/auth0-mcp-server run --tools 'auth0_*_application*' --read-only # 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 '*'

重要提示:当同时使用--read-only--tools标志时,出于安全考虑, --read-only标志优先。这意味着即使你的--tools模式匹配非只读工具,也只能进行只读操作。这确保你可以依赖--read-only标志作为安全防护。

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

  1. 增强的安全性:通过将可用工具限制为仅需要的工具,您可以减少潜在的攻击面并防止对 Auth0 租户进行意外修改。

  2. 更佳性能:为 AI 助手提供更少的工具实际上可以提升性能。当模型能够访问多种工具时,它们会更多地利用上下文窗口来判断应该使用哪些工具。使用一套专注的工具,您将获得更快、更相关的响应。

  3. 基于资源的访问控制:您可以根据特定需求使用不同的工具集配置 MCP 服务器的不同实例 - 开发环境可能需要完全访问权限,而生产环境可能仅限于读取操作。

  4. 简化审计:使用有限的工具,可以更轻松地跟踪通过 AI 助手执行的操作。

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

🧪 安全扫描

我们建议定期扫描此服务器以及您部署的任何其他 MCP 兼容服务器,并使用社区工具来发现协议级风险和错误配置。

这些扫描器有助于识别关键漏洞类别中的问题,包括:服务器实施错误、工具定义和生命周期风险、交互和数据流弱点以及配置或环境差距。

有用的工具包括:

  • mcpscan.ai
    基于 Web 的扫描器,可检查实时 MCP 端点是否存在暴露的工具、模式执行差距和其他问题。

  • mcp扫描
    CLI 工具,可模拟攻击路径并从客户端角度评估服务器行为。

这些工具并不能替代全面的审计,但它们提供了有效的防护措施和预警。我们建议将它们纳入您的常规安全审查流程。

如果您发现漏洞,请遵循我们负责任的披露流程

🕸️ 建筑

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 服务器

  • 您已从上一个会话中退出

  • 您想切换到其他租户

  • 您的令牌已过期

run命令将在启动服务器之前自动检查令牌有效性,如果需要身份验证,则会提供有用的错误消息。

会话管理

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

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无法连接到服务器

    • 安装后重新启动Claude Desktop

    • 使用ps aux | grep auth0-mcp检查服务器是否正在运行

  3. API 错误或权限问题

    • 使用export DEBUG=auth0-mcp启用调试模式

    • 检查您的 Auth0 令牌状态: npx @auth0/auth0-mcp-server session

    • 使用特定范围重新初始化: npx @auth0/auth0-mcp-server init --scopes 'read:*,update:*,create:*'

    • 如果特定操作失败,您可能缺少所需的范围

  4. 无效的 Auth0 配置错误

    • 这通常发生在您的授权令牌丢失或过期时

    • 运行npx @auth0/auth0-mcp-server session来检查你的令牌状态

    • 如果过期或丢失,请运行npx @auth0/auth0-mcp-server init进行身份验证

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 (e.g. Claude Desktop) with MCP server path npm run setup

开发脚本

# Run directly with TypeScript (no build needed) npm run dev # Run with debug logs enabled npm run dev:debug # Run with MCP inspector for debugging npm run dev:inspect # Run the compiled JavaScript version npm run start
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?

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/auth0/auth0-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server