模型上下文协议 (MCP) 服务器 + WorkOS AuthKit
这是一个示例模型上下文协议 (MCP)服务器,允许远程客户端使用WorkOS AuthKit进行连接和身份验证。
AuthKit 支持用户管理功能,包括以组织为中心的身份验证模型,允许您根据用户和组织权限控制工具访问。
入门
首先通过登录WorkOS 仪表板创建 WorkOS 帐户。
接下来,在***“重定向***->***登录回调”***下,将 MCP 服务器的回调 URL 添加为重定向 URI。如果您在本地测试,则为http://localhost:8788/callback
;如果已部署,则为已部署 Worker 的域名,且该域名与/callback
路径相同。
接下来,您必须设置WORKOS_CLIENT_ID
和WORKOS_CLIENT_SECRET
环境变量。这些变量可以从 WorkOS 仪表板的API 密钥下获取。
您可以在 Cloudflare 仪表板中或使用wrangler
CLI 设置这些:
注意: WORKOS_CLIENT_ID
从技术上来说并非秘密,因此您也可以选择通过wrangler.jsonc
配置文件进行设置。但WORKOS_CLIENT_SECRET
并非公开,应在其他安全的地方进行设置。
就这样!现在你可以使用下面的示例游乐场测试你的远程 MCP 服务器了。
测试 MCP 身份验证
访问Cloudflare Workers AI 游乐场并输入您的工作者的 URL:
单击***“连接”***后,您将被重定向到您的 WorkOS AuthKit 域,您可以在其中登录,然后以 WorkOS AuthKit 用户身份返回到游乐场。
在演示代码中, generateImage
工具需要image_generation
权限的支持。您可以点击此处了解更多关于 AuthKit 权限的信息。尝试为您的用户分配一个带有image_generation
权限的权限,看看它如何在 Playground 中启用其他工具。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
一个示例 MCP 服务器,允许远程客户端使用 WorkOS AuthKit 进行连接和身份验证,为工具提供以组织为中心的身份验证和基于权限的访问控制。
Related MCP Servers
- -securityAlicense-qualityA lightweight MCP server allowing agents to interact with the WorkOS API for streamlined WorkOS operations through natural language commands.Last updated -5MIT License
- -securityAlicense-qualityA lightweight MCP server that enables Cursor Agents to interact with the WorkOS API, providing access to WorkOS functionality directly from within the editor.Last updated -14MIT License
- AsecurityFlicenseAqualityA server based on the MCP framework that provides remote server management capabilities through SSH, supporting features like connection pooling, file transfers, and remote command execution.Last updated -7
- -securityFlicense-qualityA remote MCP server that can be deployed on Cloudflare Workers without requiring authentication, allowing users to add and use custom tools through the Model Context Protocol.Last updated -