Back to Home
codewithpassion icon

cf-mcp-server-clerk

Verified Safe

by codewithpassion

Overview

A Model Context Protocol (MCP) server that provides remote OAuth authentication using Clerk, enabling LLM agents to access tools with role-based access control.

Installation

Run Command
npm run dev

Environment Variables

  • CLERK_CLIENT_ID
  • CLERK_CLIENT_SECRET
  • CLERK_SECRET_KEY
  • CLERK_FRONTEND_API
  • COOKIE_ENCRYPTION_KEY

Security Notes

The server implements robust OAuth 2.1 authorization with strong security controls, including one-time use CSRF tokens (`__Host-CSRF_TOKEN`), state binding to user sessions (`__Host-CONSENTED_STATE`), and cryptographic cookie signing for approved clients (`__Host-APPROVED_CLIENTS`). All secrets (Clerk API keys, cookie encryption key) are loaded from environment variables/Wrangler secrets, preventing hardcoding. Input URLs and text are sanitized to mitigate XSS risks. The architecture separates OAuth concerns from MCP tool logic, and it correctly uses Cloudflare's platform features like KV storage for ephemeral state and Durable Objects for persistent MCP state. The README explicitly warns that it is a demo and requires further production hardening (e.g., rate limiting, advanced monitoring) which is sound advice for any production system.

Similar Servers

Stats

Interest Score0
Security Score9
Cost ClassMedium
Avg Tokens750
Stars0
Forks0
Last Update2025-12-01

Tags

Cloudflare WorkersMCPOAuth 2.1ClerkAIServerlessRBAC