Remote MCP Server with WorkOS AuthKit
模型上下文协议 (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 设置这些:
$ npx wrangler secret put WORKOS_CLIENT_ID <your_workos_client_id>
$ npx wrangler secret put WORKOS_CLIENT_SECRET <your_workos_client_secret>注意: WORKOS_CLIENT_ID从技术上来说并非秘密,因此您也可以选择通过wrangler.jsonc配置文件进行设置。但WORKOS_CLIENT_SECRET并非公开,应在其他安全的地方进行设置。
就这样!现在你可以使用下面的示例游乐场测试你的远程 MCP 服务器了。
Related MCP server: Remote MCP AuthKit
测试 MCP 身份验证
访问Cloudflare Workers AI 游乐场并输入您的工作者的 URL:
# Local
http://localhost:8788/sse
# Deployed
https://<your-worker-domain>/sse单击***“连接”***后,您将被重定向到您的 WorkOS AuthKit 域,您可以在其中登录,然后以 WorkOS AuthKit 用户身份返回到游乐场。
在演示代码中, generateImage工具需要image_generation权限的支持。您可以点击此处了解更多关于 AuthKit 权限的信息。尝试为您的用户分配一个带有image_generation权限的权限,看看它如何在 Playground 中启用其他工具。
This server cannot be deployed
Maintenance
Related MCP Connectors
- StytchOAuthdev.stytch.mcp
The Stytch MCP server is a reference implementation that demonstrates remote MCP server authentication and authorization using Stytch Connected Apps. It provides OAuth 2.1-compliant authorization (including PKCE), Dynamic Client Registration, and validates Stytch-issued access tokens to enable AI agents to securely interact with external services through permissioned access, supporting scopes like openid, email, profile, and manage:project_data.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
- ArcjetOAuthcom.arcjet
An MCP server for Arcjet - the runtime security platform that ships with your AI code.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceA lightweight MCP server allowing agents to interact with the WorkOS API for streamlined WorkOS operations through natural language commands.5-
- FlicenseNot gradedqualityCmaintenanceEnables remote MCP server connections with WorkOS AuthKit authentication and user management. Supports organization-centric authentication and permission-based tool access control.-
- FlicenseNot gradedqualityCmaintenanceEnables remote MCP client connections with WorkOS AuthKit authentication and organization-based permission controls. Demonstrates permission-gated tool access, such as image generation tools restricted by user permissions.-
- FlicenseNot gradedqualityDmaintenanceA reference MCP server for Cloudflare Workers that provides remote connection support with integrated GitHub OAuth authentication. It enables developers to build and deploy authenticated remote tools with user-specific access controls and persistent state management.-