mirror of
https://github.com/hanzoai/mcp-server-cloudflare.git
synced 2026-10-30 18:28:06 +00:00
1.5 KiB
1.5 KiB
Setup
If you'd like to iterate and test your MCP server, you can do so in local development.
Local Development
-
Create a
.dev.varsfile in your project root:If you're a Cloudflare employee:
CLOUDFLARE_CLIENT_ID=your_development_cloudflare_client_id CLOUDFLARE_CLIENT_SECRET=your_development_cloudflare_client_secretIf you're an external contributor, you can provide a development API token:
DEV_DISABLE_OAUTH=true # This is your global api token DEV_CLOUDFLARE_API_TOKEN=your_development_api_token -
Start the local development server:
npx wrangler dev -
To test locally, open Inspector, and connect to
http://localhost:8976/sse. Once you follow the prompts, you'll be able to "List Tools". You can also connect with any MCP client.
Deploying the Worker ( Cloudflare employees only )
Set secrets via Wrangler:
npx wrangler secret put CLOUDFLARE_CLIENT_ID -e <ENVIRONMENT>
npx wrangler secret put CLOUDFLARE_CLIENT_SECRET -e <ENVIRONMENT>
Set up a KV namespace
Create the KV namespace:
npx wrangler kv namespace create "OAUTH_KV"
Then, update the Wrangler file with the generated KV namespace ID.
Deploy & Test
Deploy the MCP server to make it available on your workers.dev domain:
npx wrangler deploy -e <ENVIRONMENT>
Test the remote server using Inspector:
npx @modelcontextprotocol/inspector@latest