Skip to main content
Glama
epsilon-labs-llc

MCP Template

MCP Template

MCP Cloudflare Workers Hono TypeScript pnpm

Eine Cloudflare-Workers-Vorlage mit Passkey-Authentifizierung über Better Auth und einem MCP-Tool zur Überprüfung authentifizierter Verbindungen.

Endpunkte

  • MCP: https://mcp.example.com/mcp

  • Healthcheck: https://mcp.example.com/health

  • Authentifizierung: https://mcp.example.com/auth/*

  • Passkey-Registrierung: https://mcp.example.com/passkey/register?token=...

https://mcp.example.com ist entsprechend der PUBLIC_ORIGIN in wrangler.jsonc anzupassen.

Related MCP server: GitHub OAuth MCP Server

Technologie-Stack

  • Cloudflare Workers

  • Hono

  • TypeScript

  • pnpm

  • Model Context Protocol

  • Better Auth

  • Cloudflare D1

Enthalten

  • Cloudflare Workers, Hono, TypeScript strict

  • Better Auth, Passkey, OAuth, CIMD

  • Migration für Better Auth in Cloudflare D1

  • get_server_status, das nur von authentifizierten Benutzern ausgeführt werden kann

  • Einmalige, 24 Stunden gültige URL für die erstmalige Passkey-Registrierung

Setup

  1. Ändern Sie den Dienstnamen und die öffentliche URL in package.json, wrangler.jsonc und src/auth.ts.

  2. Erstellen Sie eine D1-Datenbank und legen Sie die database_id in wrangler.jsonc fest.

  3. Führen Sie pnpm install aus.

  4. Führen Sie pnpm wrangler d1 migrations apply mcp-template-db --remote aus.

  5. Kopieren Sie für die lokale Entwicklung .dev.vars.example nach .dev.vars und legen Sie BETTER_AUTH_SECRET fest.

  6. Legen Sie in der Remote-Umgebung dasselbe Secret mit pnpm wrangler secret put BETTER_AUTH_SECRET fest.

  7. Starten Sie mit pnpm dev.

PUBLIC_ORIGIN muss eine öffentliche HTTPS-URL sein. Wenn Sie Passkeys in der lokalen Entwicklung verwenden möchten, müssen der Wert in wrangler.jsonc und die aufgerufene URL übereinstimmen.

Erstbenutzer und Passkey-Registrierung

Es gibt keine öffentliche Anmeldung. Registrieren Sie den Benutzer manuell in D1 und stellen Sie dann die Registrierungs-URL aus.

pnpm user:issue-passkey-url user@example.com mcp-template-db https://mcp.example.com

Die URL kann nur einmal verwendet werden und läuft nach 24 Stunden ab.

Überprüfung

pnpm format:check
pnpm typecheck
pnpm build

Dokumentation

Die Regeln für Implementierung und Dokumentationsupdates finden Sie in AGENTS.md.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    A remote MCP server for Cloudflare Workers featuring built-in GitHub OAuth for secure user authentication and identity-based access control to tools. It provides a reference implementation for managing remote MCP connections with persistent state and OAuth provider integration.
    1
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    A Cloudflare Workers-based MCP server that enables secure remote connections using built-in OAuth authentication via Cloudflare Access. It provides identity-based access control for MCP tools and supports persistent state management through Durable Objects and SSE.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    This is an MCP server deployed on Cloudflare Workers with OAuth authentication, enabling remote MCP clients to connect and use tools.
    -