cloudflare-starter MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
cloudflare-starter
A Cloudflare Worker with tests that run in workerd and GitHub Actions workflows for CI, pull request Previews, and production deploys.
It serves a Model Context Protocol (MCP) server at /mcp.
MCP clients sign in with GitHub through OAuth.
It serves a server-rendered web app, which Cloudflare Access can make private.
To create a new project from this template, give a coding agent the runbook in SETUP.md.
What you get
MCP endpoint. /mcp runs the stateless createMcpHandler from agents, with two example
tools and a defineTool wrapper that sets annotations, checks scopes, and maps errors.
OAuth. An OAuth 2.1 authorization server in the same Worker, from
@cloudflare/workers-oauth-provider, handles discovery, dynamic client registration, Client ID
Metadata Documents, a consent page, and GitHub sign-in with an allowlist.
Web app. A React Router 8 app rendered on the server, behind Hono. Cloudflare Access identity reaches loaders and API routes.
Tooling. Hono serves /healthz and maps errors to responses. Tests run in workerd, the same
runtime as production, with no network access. GitHub Actions run CI on every pull request, deploy
a Worker Preview per pull request, and deploy to production on every push to main. Renovate
groups and pins dependency updates.
Related MCP server: GitHub MCP Server
Stack
package.json pins the exact version of every package.
Runtime and CLI:
wranglerHTTP:
honoBuild:
vite,@cloudflare/vite-pluginLanguage:
typescriptLint and format:
oxlint,oxlint-tsgolint,oxfmtTests:
vitest,@cloudflare/vitest-plugin,@vitest/coverage-istanbulNetwork mocks:
msw,@msw/cloudflareTooling: Node.js 24, pnpm 12
MCP:
agents,@modelcontextprotocol/server,zod
OAuth:
@cloudflare/workers-oauth-provider
Web app:
react-router,react,react-dom,isbotAccess tokens:
jose
Run it locally
You need Node.js 24 and pnpm 12. Install the dependencies. The install also generates the TypeScript types for the Worker.
pnpm installFor MCP sign-in, set up GitHub OAuth before you start the dev server:
Create your local secrets file from the example.
cp .dev.vars.example .dev.varsFill in
.dev.vars.GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETcome from a GitHub OAuth app whose callback URLs includehttp://localhost:5173/callback. docs/auth.md describes the app. GenerateCOOKIE_SECRETwithopenssl rand -hex 32.In
wrangler.jsonc, setALLOWED_GITHUB_LOGINSundervarsto your GitHub login. The empty default admits no one, and.dev.varscan't override a var.
Without a GitHub OAuth app, everything except MCP sign-in works.
Start the dev server:
pnpm devThe dev server listens on port 5173 and stops if another process holds that port. It serves:
http://localhost:5173/healthz: the health check.
http://localhost:5173/: the web app's home page.http://localhost:5173/account: the signed-in Access identity, or a public-mode note.http://localhost:5173/api/me: the same identity as JSON.
http://localhost:5173/mcp: the MCP endpoint.
http://localhost:5173/.well-known/oauth-protected-resource/mcp: protected resource metadata.http://localhost:5173/.well-known/oauth-authorization-server: authorization server metadata.
Connect an MCP client
Use the URL of the deployed /mcp endpoint, such as https://<host>/mcp, or
http://localhost:5173/mcp for a client on your own machine.
Each client opens a browser for the consent page and the GitHub sign-in.
claude.ai and Claude Desktop: go to Settings > Connectors > Add custom connector, and enter the URL. claude.ai connects from Anthropic's servers, so it needs a deployed URL, not
localhost.Claude Code: add the server, then run
/mcpin Claude Code to sign in.claude mcp add --transport http <name> https://<host>/mcpMCP Inspector: start it, choose the Streamable HTTP transport, and enter the URL.
npx @modelcontextprotocol/inspector
To check the connection, call the example_echo_message tool.
Deploy
CI runs pnpm verify on every pull request. Once the repository has its Cloudflare secrets and
the variable DEPLOY_ENABLED set to true, each pull request also gets a Worker Preview, and each
push to main deploys to production. To deploy by hand, run pnpm run deploy. The run is
required, because pnpm deploy is a built-in pnpm command.
docs/deploy.md covers secrets, Previews, custom domains, and the API token.
Documentation
AGENTS.md: commands, checklists, and invariants for changing the code.
CLAUDE.mdis a symlink to it.docs/conventions.md: the opinions on structure, naming, comments, errors, logging, dependencies, and writing style.
docs/deploy.md: secrets, Previews, custom domains, Renovate, and observability.
docs/testing.md: how tests run in workerd and the test helpers.
docs/mcp.md: tool design and how to add and test a tool.
docs/auth.md: how MCP clients authenticate.
docs/web.md: the React Router app, identity in loaders, public mode, and the Cloudflare Access applications.
License
This project is licensed under MIT No Attribution (MIT-0).
This server cannot be deployed
Maintenance
Related MCP Connectors
OAuth-protected, read-only-by-default MCP server for provenance-labeled QuillCaddie project memory.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
Experimental MCP server for current empirical verification of explicit public HTTPS endpoint claims.
Guarded MCP server for agent-readable business truth, provenance, readiness, and discovery.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables MCP client interaction via streamable HTTP, providing example tools (echo, getPostsByUser) and resources (posts, users) with pluggable authentication providers.6MIT
- AlicenseNot gradedqualityDmaintenanceStateless Streamable HTTP MCP server exposing 5 GitHub tools (user info, repository metadata, file contents, issue listing, and issue creation) with token-based authentication required only for tool calls.281 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables end-to-end testing of OAuth authorization for an MCP server, exposing scoped tools like whoami and echo over streamable HTTP.ISC
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to connect over stateless Streamable HTTP and authenticate through an existing OAuth 2.1 / OpenID Connect authorization server, with JWT validation, per-tool scope enforcement, and step-up challenges. It ships example scoped tools for reading and creating per-user notes that developers replace with their own.MIT