使用说明
MCP(模型上下文协议) 是Anthropic引入的一种开放协议,它规范了大型语言模型如何与外部工具、资源或远程服务进行通信。
[!小心] Beta软件通知:此软件目前处于测试阶段,按原样提供,不提供任何保证。
- 特性、API和功能可能随时更改,恕不另行通知
- 不建议用于生产或关键工作负载
- 测试期间的支持有限
- 问题和反馈可以通过以下方式报告 GitHub问题跟踪器
使用此测试版软件即表示您承认并接受这些条件。
Okta MCP Server与LLM和AI代理集成,允许您使用自然语言执行各种Okta管理操作。例如,您可以简单地让Claude Desktop执行Okta管理操作:
-
创建新用户并将其添加到工程组
-
显示过去24小时内所有失败的登录尝试
-
列出过去一个月内未使用的所有应用程序
授权您的法学硕士代理人管理您的Okta组织
此服务器是 模型上下文协议 该服务器提供与Okta的管理API的无缝集成。它允许LLM代理以编程方式与Okta交互,实现自动化和增强的管理功能。
主要特点
- LLM驱动的Okta管理: 允许您的LLM代理根据自然语言指令在Okta环境中执行管理任务。
- 安全身份验证: 支持交互式使用的设备授权授予和用于安全、自动化服务器到服务器通信的私钥JWT。
- 与Okta管理API集成: 利用官方Okta API确保与您的Okta组织进行安全可靠的交互。
- 可扩展架构: 设计为使用新功能轻松扩展,并支持额外的Okta API端点。
- 全面的工具支持: 用户、组、应用程序、策略等的完整CRUD操作。
此MCP服务器利用 Okta的Python SDK 与Okta API通信,确保强大且支持良好的集成。
🚀 入门指南
先决条件:
- Python 3.8+
- 紫外线 包管理器
- 克劳德桌面 或任何其他 MCP客户端
- 八月 具有适当权限的帐户
安装Okta MCP服务器
安装Okta MCP服务器并将其配置为与您首选的MCP客户端一起工作。
带所有工具的Claude桌面
-
克隆并安装服务器:
git clone https://github.com/okta/okta-mcp-server.git cd okta-mcp-server uv sync -
通过将以下内容添加到您的
claude_desktop_config.json:{ "mcpServers": { "okta-mcp-server": { "command": "uv", "args": [ "run", "--directory", "/path/to/okta-mcp-server", "okta-mcp-server" ], "env": { "OKTA_ORG_URL": "<OKTA_ORG_URL>", "OKTA_CLIENT_ID": "<OKTA_CLIENT_ID>", "OKTA_SCOPES": "<OKTA_SCOPES>", "OKTA_PRIVATE_KEY": "<PRIVATE_KEY_IF_NEEDED>", "OKTA_KEY_ID": "<KEY_ID_IF_NEEDED>" } } } }
VS代码
将以下内容添加到您的VS代码中 settings.json:
{
"mcp": {
"inputs": [
{
"type": "promptString",
"description": "Okta Organization URL (e.g., https://dev-123456.okta.com)",
"id": "OKTA_ORG_URL"
},
{
"type": "promptString",
"description": "Okta Client ID",
"id": "OKTA_CLIENT_ID",
"password": true
},
{
"type": "promptString",
"description": "Okta Scopes (separated by whitespace, e.g., 'okta.users.read okta.groups.manage')",
"id": "OKTA_SCOPES"
},
{
"type": "promptString",
"description": "Okta Private Key. Required for 'browserless' auth.",
"id": "OKTA_PRIVATE_KEY",
"password": true
},
{
"type": "promptString",
"description": "Okta Key ID (KID) for the private key. Required for 'browserless' auth.",
"id": "OKTA_KEY_ID",
"password": true
}
],
"servers": {
"okta-mcp-server": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/the/okta-mcp-server",
"okta-mcp-server"
],
"env": {
"OKTA_ORG_URL": "${input:OKTA_ORG_URL}",
"OKTA_CLIENT_ID": "${input:OKTA_CLIENT_ID}",
"OKTA_SCOPES": "${input:OKTA_SCOPES}",
"OKTA_PRIVATE_KEY": "${input:OKTA_PRIVATE_KEY}",
"OKTA_KEY_ID": "${input:OKTA_KEY_ID}"
}
}
}
}
}
其他MCP客户端
要将Okta MCP Server与任何其他MCP客户端一起使用,您可以手动将此配置添加到客户端,然后重新启动以使更改生效:
{
"mcpServers": {
"okta-mcp-server": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/okta-mcp-server",
"okta-mcp-server"
],
"env": {
"OKTA_ORG_URL": "<OKTA_ORG_URL>",
"OKTA_CLIENT_ID": "<OKTA_CLIENT_ID>",
"OKTA_SCOPES": "<OKTA_SCOPES>",
"OKTA_PRIVATE_KEY": "<PRIVATE_KEY_IF_NEEDED>",
"OKTA_KEY_ID": "<KEY_ID_IF_NEEDED>"
}
}
}
}
与Okta进行身份验证
服务器支持两种身份验证方法。选择最适合您用例的一个。
方法1:设备授权授予(交互式)
- 在你的Okta组织中,创建一个 新应用程序集成.
- 选择 OIDC-OpenID连接 和 本机应用程序.
- 在...之下 资助类型,确保 设备授权 已检查。
- 转到Okta API Scopes选项卡并授予所需API的权限(例如,Okta.users.read、Okta.groups.manage)。
- 保存应用程序并复制 客户端ID.
- 文档: Okta设备授权授予指南
方法2:私钥JWT(无浏览器)
- 创建应用程序: 在你的Okta组织中,创建一个 新应用程序集成。选择 API 服务.保存应用程序并复制 客户端ID.
- 配置客户端身份验证:
- 在应用程序上 将军 选项卡,查找 客户端凭据 部分并单击 编辑.
- 禁用 要求在令牌请求中演示占有证明(DPoP)标头.
- 选择 公钥/私钥 对于身份验证方法。
- 添加公钥: 添加密钥有两个选项。
- 选项A:在Okta中生成密钥(推荐)
- 在 公钥 部分,单击 添加密钥.
- 在对话框中,选择 生成新密钥.
- Okta将立即生成密钥对。 下载或保存私钥 (
private.pem)并安全地储存。 - 复制 密钥ID(KID) 为新生成的密钥显示。
- 选项B:使用自己的密钥
- 使用以下方法在本地生成密钥对
openssl命令:# Generate a 2048-bit RSA private key openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048 # Extract the public key from the private key openssl rsa -in private.pem -pubout -out public.pem - 点击 添加密钥 并粘贴您的内容 公钥 (
public.pem)进入对话。 - 复制 密钥ID(KID) 显示您添加的密钥。
- 使用以下方法在本地生成密钥对
- 选项A:在Okta中生成密钥(推荐)
- 授予API范围: 去 Okta API范围 选项卡和 授予 您需要的API的权限。
- 分配管理员角色: 以避免
403 Forbidden错误,请转到 管理员角色 选项卡并分配 超级管理员 此应用程序的角色。
验证您的集成
重新启动MCP客户端(Claude Desktop、VS Code等),并让它帮助您管理Okta租户:
显示我Okta组织中的用户
🛠️ 支持的工具
Okta MCP服务器为LLM提供了以下工具,以便与Okta租户进行交互:
用户
| 工具 | 说明 | 使用示例 |
|---|---|---|
list_users |
列出Okta组织中的所有用户 | - Show me the users in my Okta org - Find users with 'john' in their name - What users do I have in the Engineering department? |
get_user |
获取特定用户的详细信息 | - Show me details for user john.doe@company.com - Get information about user ID 00u1234567890 - What groups is Jane Smith a member of? |
create_user |
在Okta组织中创建新用户 | - Create a new user named John Doe with email john.doe@company.com - Add a new employee to the Sales department - Set up a contractor account |
update_user |
更新现有用户的个人资料信息 | - Update John Doe's department to Engineering - Change the phone number for user jane.smith@company.com - Update the manager for this user |
deactivate_user |
停用用户,使其处于非活动状态 | - Deactivate the user john.doe@company.com - Disable access for former employee Jane Smith - Suspend the contractor account temporarily |
delete_deactivated_user |
永久删除已停用的用户 | - Delete the deactivated user john.doe@company.com - Remove former employee Jane Smith permanently - Clean up old contractor accounts |
get_user_profile_attributes |
检索所有支持的用户配置文件属性 | - What user profile fields are available? - Show me all the custom attributes we can set - List the standard Okta user attributes |
群组
| 工具 | 说明 | 使用示例 |
|---|---|---|
list_groups |
列出Okta组织中的所有组 | - Show me the groups in my Okta org - Find groups with 'Engineering' in their name - What security groups do we have? |
get_group |
获取特定组的详细信息 | - Show me details for the Engineering group - How many members are in the Administrators group? - What applications are assigned to Sales? |
create_group |
创建新组 | - Create a new group called DevOps Team - Set up a security group for the Finance department - Add a group for temporary contractors |
update_group |
更新现有组的信息 | - Update the description for the Engineering group - Change the name of the Sales group to Revenue Team - Modify the Finance group settings |
delete_group |
删除组(需要确认) | - Delete the old Marketing group - Remove the temporary project group - Clean up unused security groups |
list_group_users |
列出属于某个组的所有用户 | - Who are the members of the Engineering group? - Show me all administrators - List users in the Finance department |
list_group_apps |
列出分配给组的所有应用程序 | - What applications does the Engineering group have access to? - Show apps assigned to Sales team - List all applications for Administrators |
add_user_to_group |
将用户添加到组 | - Add john.doe@company.com to the Engineering group - Give Jane Smith access to the Finance applications - Add the new hire to the Sales team |
remove_user_from_group |
从组中删除用户 | - Remove john.doe@company.com from the Engineering group - Revoke Jane's admin privileges - Remove the contractor from the Finance group |
应用程序
| 工具 | 说明 | 使用示例 |
|---|---|---|
list_applications |
列出Okta组织中的所有应用程序 | - Show me the applications in my Okta org - Find applications with 'API' in their name - What SSO applications do we have configured? |
get_application |
获取特定应用程序的详细信息 | - Show me details for the Salesforce application - What are the callback URLs for our mobile app? - Get the client ID for our web application |
create_application |
创建新应用程序 | - Create a new SAML application for our HR system - Set up a new API service application - Add a mobile app integration |
update_application |
更新现有应用程序 | - Update the callback URLs for our web app - Change the logo for the Salesforce application - Modify the SAML settings for our HR system |
delete_application |
删除应用程序(需要确认) | - Delete the old legacy application - Remove the unused test application - Clean up deprecated integrations |
activate_application |
激活应用程序 | - Activate the new HR application - Enable the Salesforce integration - Turn on the mobile app for users |
deactivate_application |
停用应用程序 | - Deactivate the legacy CRM application - Temporarily disable the mobile app - Turn off access to the test environment |
政策
| 工具 | 说明 | 使用示例 |
|---|---|---|
list_policies |
列出Okta组织中的所有政策 | - Show me the security policies - What password policies do we have? - List all MFA enrollment policies |
get_policy |
获取有关策略的详细信息 | - Show me the details of our password policy - What are the MFA requirements? - Display the sign-on policy for contractors |
create_policy |
创建新策略 | - Create a new password policy for contractors - Set up MFA requirements for high-risk applications - Add a sign-on policy for remote workers |
update_policy |
更新现有策略 | - Update the password complexity requirements - Modify the MFA policy for executives - Change the session timeout for contractors |
delete_policy |
删除策略 | - Delete the old password policy - Remove the deprecated MFA policy - Clean up unused security policies |
activate_policy |
激活策略 | - Activate the new password policy - Enable the MFA requirements - Turn on the contractor sign-on policy |
deactivate_policy |
停用策略 | - Deactivate the old security policy - Temporarily disable MFA for testing - Turn off the strict password requirements |
list_policy_rules |
列出特定策略的所有规则 | - Show me all rules for the password policy - What MFA rules are configured? - List the exceptions in our sign-on policy |
get_policy_rule |
获取有关策略规则的详细信息 | - Show me the details of the contractor MFA rule - What are the conditions for the VPN access rule? - Display the emergency access rule |
create_policy_rule |
为策略创建新规则 | - Add an exception rule for executives - Create a rule for contractor access - Set up emergency access rules for IT admins |
update_policy_rule |
更新现有策略规则 | - Update the location restrictions for remote workers - Modify the device trust requirements - Change the risk-based authentication settings |
delete_policy_rule |
从策略中删除规则 | - Delete the old contractor exception - Remove the deprecated VPN rule - Clean up unused policy exceptions |
activate_policy_rule |
激活策略规则 | - Activate the new emergency access rule - Enable the contractor restrictions - Turn on the location-based access rule |
deactivate_policy_rule |
停用策略规则 | - Deactivate the old emergency rule - Temporarily disable location restrictions - Turn off the device trust requirements for testing |
日志
| 工具 | 说明 | 使用示例 |
|---|---|---|
get_logs |
从Okta组织检索系统日志 | - Show me recent login attempts - Find failed logins from the past 24 hours - Get authentication logs for user john.doe@company.com |
🔐 认证
Okta MCP服务器使用Okta Management API,需要身份验证才能访问您的Okta租户。
身份验证流程
服务器使用OAuth 2.0设备授权流与Okta进行安全身份验证,或使用私钥JWT进行无浏览器身份验证。您的凭据得到安全管理,永远不会以纯文本形式公开。
初始设置
MCP服务器将根据您的配置自动启动适当的身份验证流程:
- 设备授权授予:基于浏览器的交互式身份验证
- 私钥JWT:使用客户端凭据的无浏览器身份验证
[!注意] 不支持设备授权流 私有云 租户。私有云用户应使用带有客户端凭据的私钥JWT身份验证。
[!重要] 根据您的订阅计划,使用MCP服务器将消耗Management API费率限制。请参阅 利率限制政策 了解更多信息。
🩺 故障排除
当遇到Okta MCP服务器的问题时,有几个故障排除选项可用于帮助诊断和解决问题。
🐞 调试模式
启用调试模式以进行更详细的日志记录:
export OKTA_LOG_LEVEL=DEBUG
[!提示] 调试模式在解决连接或身份验证问题时特别有用。
🚨 常见问题
-
身份验证失败
- 确保您在Okta租户中拥有正确的权限
- 验证您的
OKTA_ORG_URL,OKTA_CLIENT_ID,以及OKTA_SCOPES是正确的 - 检查您的应用程序是否已授予必要的API作用域
-
MCP客户端无法连接到服务器
- 安装后重新启动MCP客户端
- 验证配置中的服务器路径是否正确
- 检查一下
uv已安装并可在PATH中访问
-
API错误或权限问题
- 启用调试模式
export OKTA_LOG_LEVEL=DEBUG - 验证您的Okta应用程序是否具有所需的作用域
- 确保您的应用程序分配了适当的管理员角色
- 检查Okta系统日志以获取详细的错误信息
- 启用调试模式
-
“克劳德的响应被中断…”错误
- 这通常发生在Claude达到上下文长度限制时
- 尽量更具体,保持查询简洁
- 将大型请求分解为更小、更集中的操作
[!提示] 大多数连接问题都可以通过重新启动服务器和MCP客户端来解决。
📋 除错记录
启用调试模式以查看详细日志:
export OKTA_LOG_LEVEL=DEBUG
您还可以指定日志文件:
export OKTA_LOG_FILE="/path/to/okta-mcp.log"
👨💻 发展
从源头构建
# Clone the repository
git clone https://github.com/okta/okta-mcp-server.git
cd okta-mcp-server
# Install dependencies
uv sync
# Run the server directly
uv run okta-mcp-server
开发脚本
# Run with debug logs enabled
OKTA_LOG_LEVEL=DEBUG uv run okta-mcp-server
# Run tests
uv run pytest
# Install in development mode
uv pip install -e .
[!注意] 此服务器需要 Python 3.8或更高版本 和 紫外线.
🔒 安全
Okta MCP服务器优先考虑安全性:
- 凭据通过安全的身份验证流进行管理
- 没有敏感信息以纯文本形式存储
- 身份验证使用OAuth 2.0设备授权流或私钥JWT
- 支持细粒度的API范围权限
- 通过环境变量轻松管理凭据
[!重要] 对于安全最佳实践,请始终查看身份验证过程中请求的权限,以确保它们符合您的安全要求。
[!小心] 向您的Okta应用程序授予API作用域时,请始终使用最小权限原则。
🧪 安全扫描
我们建议使用内置的社区工具定期扫描此服务器以及您部署的任何其他MCP兼容服务器,以发现协议级风险和配置错误。
这些扫描程序有助于识别关键漏洞类别中的问题,包括:服务器实现错误、工具定义和生命周期风险、交互和数据流弱点,以及配置或环境差距。
如果您发现漏洞,请按照我们的 负责任的披露过程.
💬 反馈和贡献
我们感谢对这个项目的反馈和贡献!在开始之前,请参阅:
报告问题
要提供反馈或报告错误,请 在我们的问题跟踪器上提出问题.
漏洞报告
请不要在公共GitHub问题跟踪器上报告安全漏洞。请遵循 负责任的披露过程.
📄 许可证
此项目根据Apache 2.0许可证获得许可。请参阅 许可证 文件以获取更多信息。
Okta是什么?
Okta is the leading independent identity provider. To learn more checkout Why Okta?
版权所有©2025-Present,Okta,股份有限公司。
根据Apache许可证2.0版(“许可证”)许可;除非遵守许可证,否则您不得使用此文件。您可以在以下网址获得许可证副本http://www.apache.org/licenses/LICENSE-2.0.除非适用法律要求或书面同意,否则根据许可证分发的软件按“原样”分发,不附带任何明示或暗示的保证或条件。有关许可证下管理权限和限制的具体语言,请参阅许可证。
