Remote MCP Server with WorkOS AuthKit

by sleepypandu

Integrations

  • Enables testing the MCP server with the Cloudflare Workers AI playground, providing a UI for connecting to and interacting with the MCP server.

  • Allows deploying and hosting the MCP server as a Cloudflare Worker, with instructions for setting environment variables using wrangler CLI and testing the server locally or deployed.

Model Context Protocol (MCP) Server + WorkOS AuthKit

This is an example Model Context Protocol (MCP) server that allows remote clients to connect and authenticate using WorkOS AuthKit.

AuthKit supports user management features including an organization-centric authentication model allowing you to control tool access based on user and organization permissions.

Getting Started

First to create a WorkOS account by signing into the WorkOS Dashboard.

Next, add the MCP server's callback URL as a Redirect URI under Redirects -> Sign in callback. If you are testing locally, this will be http://localhost:8788/callback, or if deployed, the domain of your deployed worker with the same /callback path.

Next, you must set the WORKOS_CLIENT_ID and WORKOS_CLIENT_SECRET environment variables. These can be obtained from the WorkOS Dashboard under API Keys.

You can set these in the Cloudflare dashboard or using the wrangler CLI:

$ npx wrangler secret put WORKOS_CLIENT_ID <your_workos_client_id> $ npx wrangler secret put WORKOS_CLIENT_SECRET <your_workos_client_secret>

Note: The WORKOS_CLIENT_ID isn't technically a secret and so you may also choose to set it via your wrangler.jsonc configuration file. But WORKOS_CLIENT_SECRET is not public and should be securely set elsewhere.

And that's it! You can now test out your remote MCP server using the example playground below.

Testing MCP Authentication

Visit the Cloudflare Workers AI playground and enter the URL of your worker:

# Local http://localhost:8788/sse # Deployed https://<your-worker-domain>/sse

After clicking Connect, you'll be redirected to your WorkOS AuthKit domain, where you can sign-in, and be returned to the playground authenticated as a WorkOS AuthKit user.

In the demo code, the generateImage tool is gated behind the image_generation permission. You can read more about Permissions in AuthKit here. Try assigning a permission with the image_generation slug to your user to see how it enables additional tools in the playground.

-
security - not tested
F
license - not found
-
quality - not tested

An example MCP server that allows remote clients to connect and authenticate using WorkOS AuthKit, providing organization-centric authentication with permission-based access control for tools.

  1. Getting Started
    1. Testing MCP Authentication

      Related MCP Servers

      • -
        security
        F
        license
        -
        quality
        A personal MCP server for securely storing and accessing API keys across projects using the macOS Keychain, letting AI assistants and applications retrieve credentials through natural language.
        Last updated -
        10
        TypeScript
        • Apple
      • -
        security
        -
        license
        -
        quality
        A MCP server that requires user authentication via Auth0, allowing it to call protected APIs on behalf of authenticated users.
        Last updated -
        TypeScript
      • -
        security
        A
        license
        -
        quality
        The Auth0 MCP Server integrates with LLMs and AI agents, allowing you to perform various Auth0 management operations using natural language. For instance, you could simply ask Claude to "Create a new Auth0 app and get the domain and client ID"
        Last updated -
        79
        46
        TypeScript
        MIT License
        • Apple
        • Linux
      • -
        security
        A
        license
        -
        quality
        The m2m-mcp-server-ssh-client provides a unified MCP server interface, securely connecting via SSH to the m2m-mcp-server-ssh-server back-end which aggregates MCP servers. This setup offers secure, single-point access to diverse remote tools using robust SSH key-based authentication.
        Last updated -
        3
        Python
        MIT License
        • Linux
        • Apple

      View all related MCP servers

      ID: 8gumnf3rwb