MCP Template
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Templatecheck the server status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Template
Better Authのパスキー認証と、認証済み接続を確認するMCP Toolを備えたCloudflare Workers用テンプレートです。公開サインアップは行わず、手動登録したUserだけが利用できます。
含まれるもの
Cloudflare Workers、Hono、TypeScript strict
Better Auth、Passkey、OAuth、CIMD
Cloudflare D1のBetter Auth用Migration
認証済みUserだけが実行できる
get_server_status初回パスキー登録用の24時間・一度限りURL
Related MCP server: GitHub OAuth MCP Server
事前準備
Node.js 24以上とpnpm 11
CloudflareアカウントとWranglerのログイン
Passkeyで使うHTTPS公開URL
セットアップ
1. サービス名と公開URLを決める
以下を実際のサービスに合わせて変更します。
ファイル | 変更内容 |
| パッケージ名 |
| Worker名、 |
| Passkey表示名とCookie prefix |
PUBLIC_ORIGINにはHTTPSの公開URLを設定します。Passkeyを使う際は、設定値と実際にアクセスするURLを一致させてください。
2. 依存関係とD1を準備する
pnpm install
pnpm wrangler d1 create mcp-template-db作成結果のdatabase_idをwrangler.jsoncへ設定します。D1名を変更した場合は、以降のコマンドにも同じ名前を使います。
3. SecretとMigrationを設定する
ローカル開発用に.dev.vars.exampleを.dev.varsへ複製し、十分にランダムなBETTER_AUTH_SECRETを設定します。
Copy-Item .dev.vars.example .dev.vars
pnpm wrangler d1 migrations apply mcp-template-db --remote
pnpm wrangler secret put BETTER_AUTH_SECRETリモートのBETTER_AUTH_SECRETには、ローカルと同じ値を設定します。
4. デプロイする
pnpm deployデプロイ後の主なエンドポイントです。
MCP:
https://mcp.example.com/mcpヘルスチェック:
https://mcp.example.com/health認証:
https://mcp.example.com/auth/*パスキー登録:
https://mcp.example.com/passkey/register?token=...
初回Userとパスキー登録
公開サインアップはありません。D1へUserを手動登録してから、登録URLを発行します。User作成は要件ごとに安全な運用手順を決めるため、テンプレには自動作成スクリプトを含めていません。
pnpm user:issue-passkey-url user@example.com mcp-template-db https://mcp.example.comURLは1回だけ使用でき、24時間で失効します。
ローカル開発
pnpm dev/healthでWorkerの起動を確認できます。Passkeyを使うローカル検証では、PUBLIC_ORIGINとアクセスURLを一致させてください。
開発時の確認
pnpm format
pnpm format:check
pnpm lint
pnpm lines:check
pnpm typecheckpnpm formatは対象ファイルを整形します。pnpm format:checkはフォーマット済みか確認します。pnpm lintはlintとimport整理を確認します。pnpm lines:checkはsrc/・scripts/の500行上限を検証します。GitHub ActionsはpushとPull Requestでフォーマット、lint、行数、型を確認します。
ドキュメント
実装・ドキュメント更新時のルールは AGENTS.md を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Cloudflare Workers MCP server: ai-provider-status
Cloudflare Workers MCP server: blog
Cloudflare Workers MCP server: a11y-scorer
Cloudflare Workers MCP server: ai-gateway
Related MCP Servers
- 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.-
- FlicenseNot gradedqualityCmaintenanceA 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-
- FlicenseNot gradedqualityCmaintenanceA 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.-
- FlicenseNot gradedqualityCmaintenanceThis is an MCP server deployed on Cloudflare Workers with OAuth authentication, enabling remote MCP clients to connect and use tools.-