This is page 1 of 25. Use http://codebase.md/cloudflare/mcp-server-cloudflare?lines=false&page={x} to view the full context. # Directory Structure ``` ├── .changeset │ ├── config.json │ └── README.md ├── .dockerignore ├── .editorconfig ├── .eslintrc.cjs ├── .github │ ├── actions │ │ └── setup │ │ └── action.yml │ ├── ISSUE_TEMPLATE │ │ └── bug_report.md │ └── workflows │ ├── branches.yml │ ├── main.yml │ └── release.yml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc.cjs ├── .syncpackrc.cjs ├── .vscode │ ├── extensions.json │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── apps │ ├── ai-gateway │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── ai-gateway.app.ts │ │ │ ├── ai-gateway.context.ts │ │ │ ├── tools │ │ │ │ └── ai-gateway.tools.ts │ │ │ └── types.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── auditlogs │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── auditlogs.app.ts │ │ │ ├── auditlogs.context.ts │ │ │ └── tools │ │ │ └── auditlogs.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── autorag │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── autorag.app.ts │ │ │ ├── autorag.context.ts │ │ │ ├── tools │ │ │ │ └── autorag.tools.ts │ │ │ └── types.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── browser-rendering │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── browser.app.ts │ │ │ ├── browser.context.ts │ │ │ └── tools │ │ │ └── browser.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── cloudflare-one-casb │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── cf1-casb.app.ts │ │ │ ├── cf1-casb.context.ts │ │ │ └── tools │ │ │ └── integrations.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── demo-day │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── frontend │ │ │ ├── index.html │ │ │ ├── public │ │ │ │ ├── anthropic.svg │ │ │ │ ├── asana.svg │ │ │ │ ├── atlassian.svg │ │ │ │ ├── canva.svg │ │ │ │ ├── cloudflare_logo.svg │ │ │ │ ├── cloudflare.svg │ │ │ │ ├── dina.jpg │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ ├── favicon.ico │ │ │ │ ├── favicon.png │ │ │ │ ├── intercom.svg │ │ │ │ ├── linear.svg │ │ │ │ ├── matt.jpg │ │ │ │ ├── mcp_demo_day.svg │ │ │ │ ├── mcpog.png │ │ │ │ ├── more.svg │ │ │ │ ├── paypal.svg │ │ │ │ ├── pete.jpeg │ │ │ │ ├── sentry.svg │ │ │ │ ├── special_guest.png │ │ │ │ ├── square.svg │ │ │ │ ├── stripe.svg │ │ │ │ ├── sunil.jpg │ │ │ │ └── webflow.svg │ │ │ ├── script.js │ │ │ └── styles.css │ │ ├── package.json │ │ ├── src │ │ │ └── demo-day.app.ts │ │ ├── tsconfig.json │ │ ├── worker-configuration.d.ts │ │ └── wrangler.json │ ├── dex-analysis │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── dex-analysis.app.ts │ │ │ ├── dex-analysis.context.ts │ │ │ ├── tools │ │ │ │ └── dex-analysis.tools.ts │ │ │ └── warp_diag_reader.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── dns-analytics │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── dns-analytics.app.ts │ │ │ ├── dns-analytics.context.ts │ │ │ └── tools │ │ │ └── dex-analytics.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── docs-autorag │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── docs-autorag.app.ts │ │ │ ├── docs-autorag.context.ts │ │ │ └── tools │ │ │ └── docs-autorag.tools.ts │ │ ├── tsconfig.json │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── docs-vectorize │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── docs-vectorize.app.ts │ │ │ └── docs-vectorize.context.ts │ │ ├── tsconfig.json │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── graphql │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── graphql.app.ts │ │ │ ├── graphql.context.ts │ │ │ └── tools │ │ │ └── graphql.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── logpush │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── logpush.app.ts │ │ │ ├── logpush.context.ts │ │ │ └── tools │ │ │ └── logpush.tools.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── radar │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── radar.app.ts │ │ │ ├── radar.context.ts │ │ │ ├── tools │ │ │ │ ├── radar.tools.ts │ │ │ │ └── url-scanner.tools.ts │ │ │ ├── types │ │ │ │ ├── radar.ts │ │ │ │ └── url-scanner.ts │ │ │ └── utils.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── sandbox-container │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── container │ │ │ ├── fileUtils.spec.ts │ │ │ ├── fileUtils.ts │ │ │ ├── sandbox.container.app.ts │ │ │ └── tsconfig.json │ │ ├── CONTRIBUTING.md │ │ ├── Dockerfile │ │ ├── evals │ │ │ ├── exec.eval.ts │ │ │ ├── files.eval.ts │ │ │ ├── initialize.eval.ts │ │ │ └── utils.ts │ │ ├── package.json │ │ ├── README.md │ │ ├── server │ │ │ ├── containerHelpers.ts │ │ │ ├── containerManager.ts │ │ │ ├── containerMcp.ts │ │ │ ├── metrics.ts │ │ │ ├── prompts.ts │ │ │ ├── sandbox.server.app.ts │ │ │ ├── sandbox.server.context.ts │ │ │ ├── userContainer.ts │ │ │ ├── utils.spec.ts │ │ │ └── utils.ts │ │ ├── shared │ │ │ ├── consts.ts │ │ │ └── schema.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.evals.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── workers-bindings │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── evals │ │ │ ├── accounts.eval.ts │ │ │ ├── hyperdrive.eval.ts │ │ │ ├── kv_namespaces.eval.ts │ │ │ ├── types.d.ts │ │ │ └── utils.ts │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── bindings.app.ts │ │ │ └── bindings.context.ts │ │ ├── tsconfig.json │ │ ├── vitest.config.evals.ts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── workers-builds │ │ ├── .dev.vars.example │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── tools │ │ │ │ └── workers-builds.tools.ts │ │ │ ├── workers-builds.app.ts │ │ │ └── workers-builds.context.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vite.config.mts │ │ ├── vitest.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ └── workers-observability │ ├── .dev.vars.example │ ├── .eslintrc.cjs │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── package.json │ ├── README.md │ ├── src │ │ ├── tools │ │ │ └── workers-observability.tools.ts │ │ ├── workers-observability.app.ts │ │ └── workers-observability.context.ts │ ├── tsconfig.json │ ├── types.d.ts │ ├── vitest.config.ts │ ├── worker-configuration.d.ts │ └── wrangler.jsonc ├── CONTRIBUTING.md ├── implementation-guides │ ├── evals.md │ ├── tools.md │ └── type-validators.md ├── LICENSE ├── package.json ├── packages │ ├── eslint-config │ │ ├── CHANGELOG.md │ │ ├── default.cjs │ │ ├── package.json │ │ └── README.md │ ├── eval-tools │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── src │ │ │ ├── runTask.ts │ │ │ ├── scorers.ts │ │ │ └── test-models.ts │ │ ├── tsconfig.json │ │ ├── worker-configuration.d.ts │ │ └── wrangler.json │ ├── mcp-common │ │ ├── .eslintrc.cjs │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── api │ │ │ │ ├── account.api.ts │ │ │ │ ├── cf1-integration.api.ts │ │ │ │ ├── workers-builds.api.ts │ │ │ │ ├── workers-observability.api.ts │ │ │ │ ├── workers.api.ts │ │ │ │ └── zone.api.ts │ │ │ ├── api-handler.ts │ │ │ ├── api-token-mode.ts │ │ │ ├── cloudflare-api.ts │ │ │ ├── cloudflare-auth.ts │ │ │ ├── cloudflare-oauth-handler.ts │ │ │ ├── config.ts │ │ │ ├── constants.ts │ │ │ ├── durable-kv-store.ts │ │ │ ├── durable-objects │ │ │ │ └── user_details.do.ts │ │ │ ├── env.ts │ │ │ ├── format.spec.ts │ │ │ ├── format.ts │ │ │ ├── get-props.ts │ │ │ ├── mcp-error.ts │ │ │ ├── poll.ts │ │ │ ├── prompts │ │ │ │ └── docs-vectorize.prompts.ts │ │ │ ├── scopes.ts │ │ │ ├── sentry.ts │ │ │ ├── server.ts │ │ │ ├── tools │ │ │ │ ├── account.tools.ts │ │ │ │ ├── d1.tools.ts │ │ │ │ ├── docs-vectorize.tools.ts │ │ │ │ ├── hyperdrive.tools.ts │ │ │ │ ├── kv_namespace.tools.ts │ │ │ │ ├── r2_bucket.tools.ts │ │ │ │ ├── worker.tools.ts │ │ │ │ └── zone.tools.ts │ │ │ ├── types │ │ │ │ ├── cf1-integrations.types.ts │ │ │ │ ├── cloudflare-mcp-agent.types.ts │ │ │ │ ├── d1.types.ts │ │ │ │ ├── hyperdrive.types.ts │ │ │ │ ├── kv_namespace.types.ts │ │ │ │ ├── r2_bucket.types.ts │ │ │ │ ├── shared.types.ts │ │ │ │ ├── tools.types.ts │ │ │ │ ├── workers-builds.types.ts │ │ │ │ ├── workers-logs.types.ts │ │ │ │ └── workers.types.ts │ │ │ ├── utils.spec.ts │ │ │ ├── utils.ts │ │ │ └── v4-api.ts │ │ ├── tests │ │ │ └── utils │ │ │ └── cloudflare-mock.ts │ │ ├── tsconfig.json │ │ ├── types.d.ts │ │ ├── vitest.config.ts │ │ └── worker-configuration.d.ts │ ├── mcp-observability │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── src │ │ │ ├── analytics-engine.ts │ │ │ ├── index.ts │ │ │ └── metrics.ts │ │ ├── tsconfig.json │ │ └── worker-configuration.d.ts │ ├── tools │ │ ├── .eslintrc.cjs │ │ ├── bin │ │ │ ├── run-changeset-new │ │ │ ├── run-eslint-workers │ │ │ ├── run-fix-deps │ │ │ ├── run-tsc │ │ │ ├── run-turbo │ │ │ ├── run-vitest │ │ │ ├── run-vitest-ci │ │ │ ├── run-wrangler-deploy │ │ │ ├── run-wrangler-types │ │ │ └── runx │ │ ├── CHANGELOG.md │ │ ├── package.json │ │ ├── README.md │ │ ├── src │ │ │ ├── bin │ │ │ │ └── runx.ts │ │ │ ├── changesets.spec.ts │ │ │ ├── changesets.ts │ │ │ ├── cmd │ │ │ │ └── deploy-published-packages.ts │ │ │ ├── proc.ts │ │ │ ├── test │ │ │ │ ├── fixtures │ │ │ │ │ └── changesets │ │ │ │ │ ├── empty │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ ├── invalid-json │ │ │ │ │ │ └── published-packages.json │ │ │ │ │ ├── invalid-schema │ │ │ │ │ │ └── published-packages.json │ │ │ │ │ └── valid │ │ │ │ │ └── published-packages.json │ │ │ │ └── setup.ts │ │ │ └── tsconfig.ts │ │ ├── tsconfig.json │ │ └── vitest.config.ts │ └── typescript-config │ ├── CHANGELOG.md │ ├── package.json │ ├── tools.json │ ├── workers-lib.json │ └── workers.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── README.md ├── server.json ├── tsconfig.json ├── turbo.json └── vitest.workspace.ts ``` # Files -------------------------------------------------------------------------------- /packages/tools/src/test/fixtures/changesets/empty/.gitkeep: -------------------------------------------------------------------------------- ``` ``` -------------------------------------------------------------------------------- /apps/dns-analytics/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_CLOUDFLARE_API_TOKEN= ``` -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- ``` **/node_modules/ **/.gitignore **/README.md **/.vscode/ **/Dockerfile **/out/ ``` -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- ``` auto-install-peers=true public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*prettier* ``` -------------------------------------------------------------------------------- /apps/auditlogs/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/dex-analysis/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/logpush/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/sandbox-container/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/workers-bindings/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/workers-observability/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/ai-gateway/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/autorag/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/browser-rendering/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/radar/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/workers-builds/.dev.vars.example: -------------------------------------------------------------------------------- ``` CLOUDFLARE_CLIENT_ID= CLOUDFLARE_CLIENT_SECRET= # OR DEV_DISABLE_OAUTH= DEV_CLOUDFLARE_API_TOKEN= DEV_CLOUDFLARE_EMAIL= ``` -------------------------------------------------------------------------------- /apps/ai-gateway/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/auditlogs/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/autorag/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/browser-rendering/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/demo-day/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/dex-analysis/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/dns-analytics/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/docs-autorag/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/graphql/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/logpush/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/radar/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/workers-bindings/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/workers-builds/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /apps/workers-observability/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /packages/mcp-common/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /packages/tools/.eslintrc.cjs: -------------------------------------------------------------------------------- ``` /** @type {import("eslint").Linter.Config} */ module.exports = { root: true, extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- ``` .changeset .github/ pnpm-lock.yaml vitest.config.ts.timestamp* vite.config.ts.timestamp* worker-configuration.d.ts **/dist/** packages/tools/src/test/fixtures/changesets/invalid-json/*.json ``` -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- ``` // This configuration only applies to the package manager root. /** @type {import("eslint").Linter.Config} */ module.exports = { ignorePatterns: ['apps/**', 'packages/**'], extends: ['@repo/eslint-config/default.cjs'], } ``` -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- ``` # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true [*] indent_style = tab indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.{yml,yaml,mdx}] indent_style = space ``` -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- ``` # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # Wrangler .wrangler .dev.vars # Astro generated types .astro/ # Dependencies node_modules .pnp .pnp.js .eslintcache # Local env files .env .env.local .env.development.local .env.test.local .env.production.local .secret *.env # Testing coverage # Turbo .turbo # Vercel .vercel # Build Outputs .next/ out/ dist dist2 # Debug npm-debug.log* yarn-debug.log* yarn-error.log* # Misc .DS_Store *.pem .sentryclirc.lock/ tmp.json tmp.ts .idea apps/sandbox-container/workdir ``` -------------------------------------------------------------------------------- /.prettierrc.cjs: -------------------------------------------------------------------------------- ``` // @ts-check const codeImports = [ // Groups '<BUILTIN_MODULES>', '<THIRD_PARTY_MODULES>', '', '^(@repo)(/.*)$', // Workspace imports '', // Local (relative) imports '^[.]{2}$', // .. '^[.]{2}/', // ../ '^[.]/(?!index)', // ./foo (but not ./index) '^[.]$', // . '^[.]/index$', // ./index '', ] // Type imports are ordered the same way, but without separators. // We also need a catch-all <TYPES> here to prevent prettier from failing. const typeImports = ['<TYPES>'].concat( codeImports.filter((i) => i !== '').map((i) => `<TYPES>${i}`) ) /** @type {import("prettier").Config} */ const config = { trailingComma: 'es5', tabWidth: 2, useTabs: true, semi: false, singleQuote: true, printWidth: 100, plugins: ['@ianvs/prettier-plugin-sort-imports'], importOrder: [...codeImports, ...typeImports], importOrderTypeScriptVersion: '5.5.4', overrides: [ { files: '*.mdx', options: { parser: 'mdx', }, }, { files: ['*.jsonc', '*.code-workspace'], options: { trailingComma: 'none', }, }, ], } module.exports = config ``` -------------------------------------------------------------------------------- /.syncpackrc.cjs: -------------------------------------------------------------------------------- ``` // @ts-check /** @type {import("syncpack").RcFile} */ const config = { indent: '\t', lintFormatting: false, // handled by prettier versionGroups: [ { label: 'local packages', packages: ['**'], dependencies: ['@repo/*'], dependencyTypes: ['!local'], // Exclude the local package itself pinVersion: 'workspace:*', }, { label: 'Sentry types that are compatible with toucan-js', dependencies: ['@sentry/types', '@sentry/tracing'], pinVersion: '8.9.2', }, { label: 'toucan-js that is compatible with pinned sentry types', dependencies: ['toucan-js'], pinVersion: '4.1.1', }, { label: 'pin vitest compatible with @cloudflare/vitest-pool-workers', dependencies: ['vitest', '@vitest/ui'], pinVersion: '3.0.9', }, { label: 'pin typescript for eslint', dependencies: ['typescript'], pinVersion: '5.5.4', }, { label: `pin eslint and all it's plugins for eslint v8`, dependencies: [ 'eslint', '@types/eslint', 'eslint-config-prettier', 'eslint-plugin-react-hooks', 'eslint-plugin-unused-imports', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', ], // snapTo removes it from syncpack update list, which is the main goal snapTo: ['@repo/eslint-config'], }, { label: 'use zod v4 in packages/tools', dependencies: ['zod'], pinVersion: '4.0.0-beta.20250505T195954', packages: ['@repo/tools'], }, ], semverGroups: [ { label: 'pin all deps', range: '', dependencies: ['**'], packages: ['**'], }, ], } module.exports = config ``` -------------------------------------------------------------------------------- /apps/workers-bindings/.gitignore: -------------------------------------------------------------------------------- ``` node_modules .nx .idea .vscode .zed # Logs logs _.log npm-debug.log_ yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # Runtime data pids _.pid _.seed \*.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage \*.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache \*.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional stylelint cache .stylelintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' \*.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variable files .env .env.development.local .env.test.local .env.production.local .env.local # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # vuepress v2.x temp and cache directory .temp .cache # Docusaurus cache and generated files .docusaurus # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.\* # wrangler project .dev.vars .wrangler/ ``` -------------------------------------------------------------------------------- /packages/mcp-common/README.md: -------------------------------------------------------------------------------- ```markdown # MCP Common A place for common things used across MCP packages/apps ``` -------------------------------------------------------------------------------- /packages/eslint-config/README.md: -------------------------------------------------------------------------------- ```markdown # `@repo/eslint-config` Collection of internal eslint configurations. ``` -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- ```markdown # Changesets Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets) We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) ``` -------------------------------------------------------------------------------- /apps/docs-autorag/README.md: -------------------------------------------------------------------------------- ```markdown # Model Context Protocol (MCP) Server + Cloudflare Documentation (via Autorag) This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections. It connects to an autorag instance (in this case, Cloudflare docs) To run this server, you'll need access to an autorag instance which has indexed the contents of cloudflare-docs: https://github.com/cloudflare/cloudflare-docs/ The Cloudflare account this worker is deployed on already has this Autorag instance setup and indexed. ## Running locally ``` pnpm run start ``` Then connect to the server via remote MCP at `http://localhost:8976/sse` ## Deploying ``` pnpm run deploy --env [ENVIRONMENT] ``` ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/README.md: -------------------------------------------------------------------------------- ```markdown # Model Context Protocol (MCP) Server + Cloudflare OAuth This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. You should use this as a template to build an MCP server for Cloudflare, provided by Cloudflare at `server-name.mcp.cloudflare.com`. It has a basic set of tools `apps/template-start-here/src/tools/logpush.tools.ts` — you can modify these to do what you need ## Getting Started - Set secrets via Wrangler ```bash wrangler secret put CLOUDFLARE_CLIENT_ID wrangler secret put CLOUDFLARE_CLIENT_SECRET ``` #### Set up a KV namespace - Create the KV namespace: `wrangler kv:namespace create "OAUTH_KV"` - Update the Wrangler file with the KV ID #### Deploy & Test Deploy the MCP server to make it available on your workers.dev domain ` wrangler deploy` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ``` npx wrangler deploy ``` ``` -------------------------------------------------------------------------------- /packages/tools/README.md: -------------------------------------------------------------------------------- ```markdown # @repo/tools A collection of shared scripts for automating the monorepo while ensuring consistency across packages. ## Scripts ### Bin Scripts Simple shell scripts for common development tasks: - `run-tsc`: Run TypeScript type checking - `run-eslint-workers`: Run ESLint checks - `run-vitest`: Run tests - `run-vitest-ci`: Run tests in CI mode - `run-turbo`: Run Turbo commands with tracking disabled - `run-wrangler-deploy`: Deploy using Wrangler - `run-wrangler-types`: Generate Wrangler types - `run-fix-deps`: Fix dependencies ### Runx CLI A TypeScript-based CLI for more complex automation tasks. While the bin scripts work well for simple tasks, the runx CLI provides better type safety and more sophisticated programmatic control. Usage: ```bash pnpm runx <command> [options] ``` Available commands: - `deploy-published-workers`: Deploy Cloudflare Workers (based on which packages changesets marked as published in the release). Note: The CLI will automatically use Bun if available, but falls back to tsx if not installed. ``` -------------------------------------------------------------------------------- /apps/logpush/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Logpush MCP Server 📜 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare Logpush API](https://developers.cloudflare.com/logs/) to provide insights into Logpush jobs. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | --------------------------- | ---------------------------- | ----------------------------------------------------------------------- | | **Logpush Jobs By Account** | `logpush_jobs_by_account_id` | Fetches Logpush jobs by specific account or all accounts under the user | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Which Logpush jobs failed recently?` - `Do any of my Logpush jobs in my <insert name> account have errors?` - `Can you list all the enabled job failures from today?` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://logs.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://logs.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. ``` -------------------------------------------------------------------------------- /apps/auditlogs/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Audit Logs MCP Server 🕵🏻 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. Audit logs summarize the history of changes made within your Cloudflare account. Audit logs include account level actions like zone configuration changes. The tool is powered by the [Audit Log API](https://developers.cloudflare.com/api/resources/accounts/subresources/logs/subresources/audit/methods/list/) ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | -------------- | ------------------------- | ------------------------------------------------------------------------------------------------ | | **Audit Logs** | `auditlogs_by_account_id` | Fetches the history of changes between within your Cloudflare account over a specific time range | ### Prompt Examples - `Were there any suspicious changes made to my Cloudflare account yesterday around lunch time?` - `When was the last activity that updated a DNS record?` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://auditlogs.mcp.cloudflare.com/sse`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://auditlogs.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Documentation MCP Server (via Vectorize) 🔭 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections. It connects to a Vectorize DB (in this case, indexed w/ the Cloudflare docs) The Cloudflare account this worker is deployed on already has this Vectorize DB setup and indexed. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ---------------------------- | --------------------------------- | ------------------------------------ | | **Cloudflare Documentation** | `search_cloudflare_documentation` | Search the Cloudflare documentation. | ### Prompt Examples - `Do Cloudflare Workers costs depend on response sizes? I want to serve some images (map tiles) from an R2 bucket and I'm concerned about costs.` - `How many indexes are supported in Workers Analytics Engine? Give an example using the Workers binding api.` - `Can you give me some information on how to use the Workers AutoRAG binding` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://docs.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://docs.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/autorag/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare AutoRAG MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare AutoRAG API](https://developers.cloudflare.com/autorag/) to allow you to access and query your account's AutoRAG instances. ## 🔨 Available Tools Currently available tools: | **Tool** | **Description** | | ----------- | -------------------------------------------------------------------------------- | | `list_rags` | Lists AutoRAGs with pagination support | | `search` | Searches documents in a specified AutoRAG using a query (URL, title, or snippet) | | `ai_search` | Performs AI-powered search on documents in a specified AutoRAG | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `List all AutoRAGs in my account.` - `Search for documents in AutoRAG with ID 'rag123' using the query 'cloudflare security'.` - `Perform an AI search in AutoRAG with ID 'rag456' for 'best practices for vector stores'.` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://autorag.mcp.cloudflare.com`) directly within its interface (for example in[Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using mcp-remote (https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://autorag.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/browser-rendering/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Browser Rendering MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare Browser Rendering API](https://developers.cloudflare.com/browser-rendering/) to provide global Internet traffic insights, trends and other utilities. ## 🔨 Available Tools Currently available tools: | **Tool** | **Description** | | ---------------------- | ---------------------------------------------------------------------------- | | `get_url_html_content` | Retrieves the HTML content of the specified URL. | | `get_url_markdown` | Fetches the webpage content and converts it into Markdown format. | | `get_url_screenshot` | Captures a screenshot of the webpage. Optionally, specify the viewport size. | **Note:** To use these tools, ensure you have an active account set. If not, use `accounts_list` to list your accounts and `set_active_account` to set one as active. This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Get the HTML content of https://example.com.` - `Convert https://example.com to Markdown.` - `Take a screenshot of https://example.com.` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://browser.mcp.cloudflare.com`) directly within its interface (for example in[Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using mcp-remote (https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://browser.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/workers-builds/README.md: -------------------------------------------------------------------------------- ```markdown # Workers Builds MCP Server 🔭 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools to provide insights and management capabilities for your Cloudflare Workers Builds. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ------------------ | ---------------------------------- | ---------------------------------------------------------------------------------------- | | **Workers Builds** | `workers_builds_set_active_worker` | Sets the active Worker ID for subsequent calls. | | **Workers Builds** | `workers_builds_list_builds` | Lists builds for a Cloudflare Worker. | | **Workers Builds** | `workers_builds_get_build` | Retrieves details for a specific build by its UUID, including build and deploy commands. | | **Workers Builds** | `workers_builds_get_build_logs` | Fetches the logs for a Cloudflare Workers build by its UUID. | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Set my-worker as the active worker.` - `List the last 5 builds for my worker 'my-ci-worker'.` - `What were the details for build 'xxxx-xxxx-xxxx-xxxx'?` - `Show me the logs for build my latest build.` - `Did the latest build for worker frontend-app succeed?` ## Access the remote MCP server from from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://builds.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote@latest", "https://builds.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/dns-analytics/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare DNS Analytics MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare DNS Analytics API](https://developers.cloudflare.com/api/resources/dns/) to provide insights on DNS analytics and optimization. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ----------------------- | --------------------------- | -------------------------------------------------------------- | | **Zone Information** | `zones_list` | List zones under the current active account. | | **DNS Analytics** | `dns_report` | Fetch the DNS Report for a given zone over a given time frame. | | **Account DNS Setting** | `show_account_dns_settings` | Fetch the DNS setting for the current active account. | | **Zone DNS Setting** | `show_zone_dns_settings` | Fetch the DNS setting for a given zone. | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `List zones under my Cloudflare account.` - `What are the DNS Settings for my account?` - `Show me the zones under my account and fetch DNS Report for them.` - `How can I optimize my DNS Setting based on my DNS Report?` - `Which of my zones has the highest traffic?` - `Read Cloudflare's documentation on managing DNS records and tell me how to optimize my DNS settings.` - `Show me DNS Report for https://example.com in the last X days.` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://dns-analytics.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://dns-analytics.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/graphql/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare GraphQL MCP Server This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare GraphQL API](https://developers.cloudflare.com/analytics/graphql-api/) to provide insights and utilities for your Cloudflare account. ## Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | --------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------- | | **GraphQL Schema Search** | `graphql_schema_search` | Search the Cloudflare GraphQL API schema for types, fields, and enum values matching a keyword | | **GraphQL Schema Overview** | `graphql_schema_overview` | Fetch the high-level overview of the Cloudflare GraphQL API schema | | **GraphQL Type Details** | `graphql_type_details` | Fetch detailed information about a specific GraphQL type | | **GraphQL Complete Schema** | `graphql_complete_schema` | Fetch the complete Cloudflare GraphQL API schema (combines overview and important type details) | | **GraphQL Query Execution** | `graphql_query` | Execute a GraphQL query against the Cloudflare API | | **GraphQL API Explorer** | `graphql_api_explorer` | Generate a Cloudflare [GraphQL API Explorer](https://graphql.cloudflare.com/explorer) link | ### Prompt Examples - `Show me HTTP traffic for the last 7 days for example.com` - `Show me which GraphQL datatype I need to use to query firewall events` - `Can you generate a link to the Cloudflare GraphQL API Explorer with a pre-populated query and variables?` - `I need to monitor HTTP requests and responses for a specific domain. Can you help me with that using the Cloudflare GraphQL API?` ## Access the remote MCP server from Claude Desktop If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://graphql.mcp.cloudflare.com/sse`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://graphql.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. ``` -------------------------------------------------------------------------------- /apps/ai-gateway/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare AI Gateway MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare AI Gateway API](https://developers.cloudflare.com/ai-gateway/) to provide global Internet traffic insights, trends and other utilities. ## 🔨 Available Tools Currently available tools: | **Tool** | **Description** | | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | `list_gateways` | Lists all AI Gateways associated with the account, supporting pagination for easy navigation. | | `list_logs` | Retrieves logs for a specified gateway, offering filters such as date ranges, feedback scores, success status, model, and provider. | | `get_log_details` | Fetches detailed information about a specific log identified by its log ID within a gateway. | | `get_log_request_body` | Retrieves the request body associated with a specific log in a gateway. | | `get_log_response_body` | Retrieves the response body associated with a specific log in a gateway. | **Note:** To use these tools, ensure you have an active account set. If not, use `accounts_list` to list your accounts and `set_active_account` to set one as active. This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `List all my AI Gateways.` - `Show logs for gateway 'gateway-001' between January 1, 2023, and January 31, 2023.` - `Fetch the latest errors from gateway-001 and debug what might have happened wrongly` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://ai-gateway.mcp.cloudflare.com`) directly within its interface (for example in[Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using mcp-remote (https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://ai-gateway.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/workers-observability/README.md: -------------------------------------------------------------------------------- ```markdown # Workers Observability MCP Server 🔭 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by [Workers Observability](https://developers.cloudflare.com/workers/observability/) to provide global Internet traffic insights, trends and other utilities. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | --------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Workers Analytics** | `query_worker_observability` | Queries Workers Observability API to analyze logs and metrics from your Cloudflare Workers. Supports listing events, calculating metrics, and finding specific invocations | | **Schema Discovery** | `observability_keys` | Discovers available data fields in your Workers logs including metadata fields, worker-specific fields, and custom logged fields | | **Value Exploration** | `observability_values` | Finds available values for specific fields in Workers logs to help build precise filters for analytics queries | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Can you tell me about any potential issues on this particular worker 'my-worker-name'?` - `Show me the CPU time usage for my worker 'api-gateway' over the last 24 hours` - `What were the top 5 countries by request count for my worker yesterday?` - `How many requests were made to my worker 'my-app' broken down by HTTP status code?` - `Compare the error rates between my production and staging workers` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://observability.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://observability.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/sandbox-container/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Container Sandbox MCP Server This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools for running a sandbox container with your MCP client. With this server you can allow your LLM to run arbitrary code, such as Node or Python, in a secure, sandboxed environment. ## Tools | **Category** | **Tool** | **Description** | | ----------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | **Container Lifecycle** | `container_initialize` | (Re)start a container. Containers are intended to be ephemeral and don't save any state. Containers are only guaranteed to last ~10m. | | | `container_ping` | Ping a container for connectivity | | **Filesystem** | `container_file_write` | Write to a file | | | `container_files_list` | List all files in the work directory | | | `container_file_read` | Read the contents of a single file or directory | | | `container_file_delete` | Delete a single file or directory | | **Execution** | `container_exec` | Run a command in the shell | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Create a visualization using matplotlib. Run it in the container that you can start` - `Clone and explore this github repo: [repo link]. Setup and run the tests in your development environment` - `Analyze this data using Python` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://bindings.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://containers.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/radar/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Radar MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare Radar API](https://developers.cloudflare.com/radar/) to provide global Internet traffic insights, trends and other utilities. ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ---------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | **AI** | `get_ai_data` | Retrieves AI-related data, including traffic from AI user agents, as well as popular models and model tasks | | **Autonomous Systems** | `list_autonomous_systems` | Lists ASes; filter by location and sort by population size | | | `get_as_details` | Retrieves detailed info for a specific ASN | | **Domains** | `get_domains_ranking` | Gets top or trending domains | | | `get_domain_rank_details` | Gets domain rank details | | **DNS** | `get_dns_data` | Retrieves DNS query data to 1.1.1.1, including timeseries, summaries, and breakdowns by dimensions like `queryType` | | **Email Routing** | `get_email_routing_data` | Retrieves Email Routing data, including timeseries, and breakdowns by dimensions like `encrypted` | | **Email Security** | `get_email_security_data` | Retrieves Email Security data, including timeseries, and breakdowns by dimensions like `threatCategory` | | **HTTP** | `get_http_data` | Retrieves HTTP request data, including timeseries, and breakdowns by dimensions like `deviceType` | | **IP Addresses** | `get_ip_details` | Provides details about a specific IP address | | **Internet Services** | `get_internet_services_ranking` | Gets top Internet services | | **Internet Quality** | `get_internet_quality_data` | Retrieves a summary or time series of bandwidth, latency, or DNS response time from the Radar Internet Quality Index | | **Internet Speed** | `get_internet_speed_data` | Retrieves summary of bandwidth, latency, jitter, and packet loss, from the previous 90 days of Cloudflare Speed Test | | **Layer 3 Attacks** | `get_l3_attack_data` | Retrieves L3 attack data, including timeseries, top attacks, and breakdowns by dimensions like `protocol` | | **Layer 7 Attacks** | `get_l7_attack_data` | Retrieves L7 attack data, including timeseries, top attacks, and breakdowns by dimensions like `mitigationProduct` | | **Traffic Anomalies** | `get_traffic_anomalies` | Lists traffic anomalies and outages; filter by AS, location, start date, and end date | | **URL Scanner** | `scan_url` | Scans a URL via [Cloudflare’s URL Scanner](https://developers.cloudflare.com/radar/investigate/url-scanner/) | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `What are the most used operating systems?` - `What are the top 5 ASes in Portugal?` - `Get information about ASN 13335.` - `What are the details of IP address 1.1.1.1?` - `List me traffic anomalies in Syria over the last year.` - `Compare domain rankings in the US and UK.` - `Give me rank details for google.com in March 2025.` - `Scan https://example.com.` - `Show me HTTP traffic trends from Portugal.` - `Show me application layer attack trends from the last 7 days.` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://radar.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://radar.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/workers-bindings/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare Workers Bindings MCP Server This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools for managing resources in the Cloudflare Workers Platform, which you can connect to your Worker via [Bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/). ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ----------------- | -------------------------- | ----------------------------------------------------------------------------- | | **Account** | `accounts_list` | List all accounts in your Cloudflare account | | | `set_active_account` | Set active account to be used for tool calls that require accountId | | **KV Namespaces** | `kv_namespaces_list` | List all of the kv namespaces in your Cloudflare account | | | `kv_namespace_create` | Create a new kv namespace in your Cloudflare account | | | `kv_namespace_delete` | Delete a kv namespace in your Cloudflare account | | | `kv_namespace_get` | Get details of a kv namespace in your Cloudflare account | | | `kv_namespace_update` | Update the title of a kv namespace in your Cloudflare account | | **Workers** | `workers_list` | List all Workers in your Cloudflare account | | | `workers_get_worker` | Get the details of a Cloudflare Worker | | | `workers_get_worker_code` | Get the source code of a Cloudflare Worker | | **R2 Buckets** | `r2_buckets_list` | List r2 buckets in your Cloudflare account | | | `r2_bucket_create` | Create a new r2 bucket in your Cloudflare account | | | `r2_bucket_get` | Get details about a specific R2 bucket | | | `r2_bucket_delete` | Delete an R2 bucket | | **D1 Databases** | `d1_databases_list` | List all of the D1 databases in your Cloudflare account | | | `d1_database_create` | Create a new D1 database in your Cloudflare account | | | `d1_database_delete` | Delete a d1 database in your Cloudflare account | | | `d1_database_get` | Get a D1 database in your Cloudflare account | | | `d1_database_query` | Query a D1 database in your Cloudflare account | | **Hyperdrive** | `hyperdrive_configs_list` | List Hyperdrive configurations in your Cloudflare account | | | `hyperdrive_config_create` | Create a new Hyperdrive configuration in your Cloudflare account | | | `hyperdrive_config_delete` | Delete a Hyperdrive configuration in your Cloudflare account | | | `hyperdrive_config_get` | Get details of a specific Hyperdrive configuration in your Cloudflare account | | | `hyperdrive_config_edit` | Edit (patch) a Hyperdrive configuration in your Cloudflare account | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `List my Cloudflare accounts.` - `Set my active account to 'YOUR_ACCOUNT_ID'.` (Replace YOUR_ACCOUNT_ID with an actual ID) - `Show me my KV namespaces.` - `Create a new KV namespace called 'my-kv-store'.` - `Get the details for KV namespace 'YOUR_NAMESPACE_ID'.` (Replace YOUR_NAMESPACE_ID) - `Delete the KV namespace 'NAMESPACE_TO_DELETE_ID'.` (Replace NAMESPACE_TO_DELETE_ID) - `List my Cloudflare Workers.` - `Get the code for the 'my-worker-script' worker.` - `Show me my R2 buckets.` - `Create an R2 bucket named 'my-new-bucket'.` - `Get details for the R2 bucket 'my-data-bucket'.` - `Delete the R2 bucket 'old-bucket'.` - `List my D1 databases.` - `Create a D1 database named 'analytics-db'.` - `Get details for D1 database 'YOUR_D1_DB_ID'.` (Replace YOUR_D1_DB_ID) - `Run the query 'SELECT * FROM customers LIMIT 10;' on D1 database 'YOUR_D1_DB_ID'.` (Replace YOUR_D1_DB_ID) - `Delete the D1 database 'TEMP_DB_ID'.` (Replace TEMP_DB_ID) - `List my Hyperdrive configurations.` - `Create a Hyperdrive config named 'prod-db-cache' for my database.` (You might need to provide more origin details) - `Get details for Hyperdrive config 'YOUR_HYPERDRIVE_ID'.` (Replace YOUR_HYPERDRIVE_ID) - `Update the cache settings for Hyperdrive config 'YOUR_HYPERDRIVE_ID'.` (Replace YOUR_HYPERDRIVE_ID) - `Delete the Hyperdrive config 'OLD_HYPERDRIVE_ID'.` (Replace OLD_HYPERDRIVE_ID) ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://bindings.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://bindings.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare MCP Server Model Context Protocol (MCP) is a [new, standardized protocol](https://modelcontextprotocol.io/introduction) for managing context between large language models (LLMs) and external systems. In this repository, you can find several MCP servers allowing you to connect to Cloudflare's service from an MCP client (e.g. Cursor, Claude) and use natural language to accomplish tasks through your Cloudflare account. These MCP servers allow your [MCP Client](https://modelcontextprotocol.io/clients) to read configurations from your account, process information, make suggestions based on data, and even make those suggested changes for you. All of these actions can happen across Cloudflare's many services including application development, security and performance. The following servers are included in this repository: | Server Name | Description | Server URL | | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [**Documentation server**](/apps/docs-vectorize) | Get up to date reference information on Cloudflare | `https://docs.mcp.cloudflare.com/sse` | | [**Workers Bindings server**](/apps/workers-bindings) | Build Workers applications with storage, AI, and compute primitives | `https://bindings.mcp.cloudflare.com/sse` | | [**Workers Builds server**](/apps/workers-builds) | Get insights and manage your Cloudflare Workers Builds | `https://builds.mcp.cloudflare.com/sse` | | [**Observability server**](/apps/workers-observability) | Debug and get insight into your application's logs and analytics | `https://observability.mcp.cloudflare.com/sse` | | [**Radar server**](/apps/radar) | Get global Internet traffic insights, trends, URL scans, and other utilities | `https://radar.mcp.cloudflare.com/sse` | | [**Container server**](/apps/sandbox-container) | Spin up a sandbox development environment | `https://containers.mcp.cloudflare.com/sse` | | [**Browser rendering server**](/apps/browser-rendering) | Fetch web pages, convert them to markdown and take screenshots | `https://browser.mcp.cloudflare.com/sse` | | [**Logpush server**](/apps/logpush) | Get quick summaries for Logpush job health | `https://logs.mcp.cloudflare.com/sse` | | [**AI Gateway server**](/apps/ai-gateway) | Search your logs, get details about the prompts and responses | `https://ai-gateway.mcp.cloudflare.com/sse` | | [**AutoRAG server**](/apps/autorag) | List and search documents on your AutoRAGs | `https://autorag.mcp.cloudflare.com/sse` | | [**Audit Logs server**](/apps/auditlogs) | Query audit logs and generate reports for review | `https://auditlogs.mcp.cloudflare.com/sse` | | [**DNS Analytics server**](/apps/dns-analytics) | Optimize DNS performance and debug issues based on current set up | `https://dns-analytics.mcp.cloudflare.com/sse` | | [**Digital Experience Monitoring server**](/apps/dex-analysis) | Get quick insight on critical applications for your organization | `https://dex.mcp.cloudflare.com/sse` | | [**Cloudflare One CASB server**](/apps/cloudflare-one-casb) | Quickly identify any security misconfigurations for SaaS applications to safeguard users & data | `https://casb.mcp.cloudflare.com/sse` | | [**GraphQL server**](/apps/graphql/) | Get analytics data using Cloudflare’s GraphQL API | `https://graphql.mcp.cloudflare.com/sse` | ## Access the remote MCP server from any MCP client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL directly within its interface (e.g. [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)) If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using mcp-remote (https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. ```json { "mcpServers": { "cloudflare-observability": { "command": "npx", "args": ["mcp-remote", "https://observability.mcp.cloudflare.com/sse"] }, "cloudflare-bindings": { "command": "npx", "args": ["mcp-remote", "https://bindings.mcp.cloudflare.com/sse"] } } } ``` ## Using Cloudflare's MCP servers from the OpenAI Responses API To use one of Cloudflare's MCP servers with [OpenAI's responses API](https://openai.com/index/new-tools-and-features-in-the-responses-api/), you will need to provide the Responses API with an API token that has the scopes (permissions) required for that particular MCP server. For example, to use the [Browser Rendering MCP server](https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/browser-rendering) with OpenAI, create an API token in the Cloudflare dashboard [here](https://dash.cloudflare.com/profile/api-tokens), with the following permissions: <img width="937" alt="Screenshot 2025-05-21 at 10 38 02 AM" src="https://github.com/user-attachments/assets/872e253f-23ce-43b3-983c-45f9d0f66100" /> ## Need access to more Cloudflare tools? We're continuing to add more functionality to this remote MCP server repo. If you'd like to leave feedback, file a bug or provide a feature request, [please open an issue](https://github.com/cloudflare/mcp-server-cloudflare/issues/new/choose) on this repository ## Troubleshooting "Claude's response was interrupted ... " If you see this message, Claude likely hit its context-length limit and stopped mid-reply. This happens most often on servers that trigger many chained tool calls such as the observability server. To reduce the chance of running in to this issue: - Try to be specific, keep your queries concise. - If a single request calls multiple tools, try to to break it into several smaller tool calls to keep the responses short. ## Paid Features Some features may require a paid Cloudflare Workers plan. Ensure your Cloudflare account has the necessary subscription level for the features you intend to use. ## Contributing Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/dex-analysis/README.md: -------------------------------------------------------------------------------- ```markdown # Cloudflare DEX MCP Server 📡 This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare DEX API](https://developers.cloudflare.com/api/resources/zero_trust/subresources/dex/) to provide visibility into device, network, and application performance across your Zero Trust organization ## 🔨 Available Tools Currently available tools: | **Category** | **Tool** | **Description** | | ------------------------------------ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Synthetic Application Monitoring** | `dex_test_statistics` | Analyze Cloudflare DEX Test Results by quartile given a Test ID | | | `dex_list_tests` | List configured Cloudflare DEX tests along with overview performance metrics. | | | `dex_http_test_details` | Retrieve detailed time series results for an HTTP DEX test by id. | | | `dex_traceroute_test_details` | Retrieve detailed time series results for a Traceroute DEX test by id. | | | `dex_traceroute_test_network_path` | Retrieve detailed time series results for the network path of a traceroute test by test id and device id. | | | `dex_traceroute_test_result_network_path` | Retrieve the hop-by-hop network path for a specific Traceroute DEX test result by id. Use `dex_traceroute_test_network_path` to obain test result ids. | | **Remote Captures** | `dex_list_remote_capture_eligible_devices` | Retrieve a list of devices eligible for remote captures like packet captures or WARP diagnostics. | | | `dex_create_remote_pcap` | Initiate a remote packet capture on a specific device by id. | | | `dex_create_remote_warp_diag` | Initiate a remote Warp diagnostic capture on a specific device by id. | | | `dex_list_remote_captures` | Retrieve a list of previously created remote captures along with their details and status. | | | `dex_list_remote_warp_diag_contents` | List the filenames included in a remote WARP diag capture returned by `dex_list_remote_captures`. | | | `dex_explore_remote_warp_diag_output` | Retreive remote WARP diag file contents by filepath returned by `dex_list_remote_warp_diag_contents`. | | | `dex_analyze_warp_diag` | Analyze successful WARP-diag remote captures for common issues. | | **Fleet Status** | `dex_fleet_status_live` | View live metrics for your fleet of zero trust devices for up to the past 1 hour. | | | `dex_fleet_status_over_time` | View historical metrics for your fleet of zero trust devices over time. | | | `dex_fleet_status_logs` | View historical logs for your fleet of zero trust devices for up to the past 7 days. | | | `dex_list_warp_change_events` | View logs of users toggling WARP connection or changing configuration. | | **Misc** | `dex_list_colos` | List Cloudflare colos, optionally sorted by their frequency of appearance in DEX test or fleet status results. | This MCP server is still a work in progress, and we plan to add more tools in the future. ### Prompt Examples - `Are there any anomolies in the DEX test to the internal wiki in the past 24 hours?` - `Can you see any bottlenecks in [email protected]'s network path for Zoom today between 1 and 2 PM?` - `How many macOS devices are connected right now in DFW?` - `Do you notice any unusual performance metrics for [email protected]'s device in the past few hours?` - `Capture a WARP diag for [email protected] and make sure to test all routes` - `Which users have toggled off WARP recently?` - `Which Cloudflare colo is most used by my users in the EU running DEX application tests?` - `Look at the latest WARP diag for [email protected] and tell me if you see anything notable in dns logs` ## Access the remote MCP server from any MCP Client If your MCP client has first class support for remote MCP servers, the client will provide a way to accept the server URL (`https://dex.mcp.cloudflare.com`) directly within its interface (for example in [Cloudflare AI Playground](https://playground.ai.cloudflare.com/)). If your client does not yet support remote MCP servers, you will need to set up its respective configuration file using [mcp-remote](https://www.npmjs.com/package/mcp-remote) to specify which servers your client can access. Replace the content with the following configuration: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["mcp-remote", "https://dex.mcp.cloudflare.com/sse"] } } } ``` Once you've set up your configuration file, restart MCP client and a browser window will open showing your OAuth login page. Proceed through the authentication flow to grant the client access to your MCP server. After you grant access, the tools will become available for you to use. Interested in contributing, and running this server locally? See [CONTRIBUTING.md](CONTRIBUTING.md) to get started. ``` -------------------------------------------------------------------------------- /apps/sandbox-container/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Container MCP Server This is a simple MCP-based interface for a sandboxed development environment. ## Local dev Cloudchamber local dev isn't implemented yet, so we are doing a bit of a hack to just run the server in your local environment. Because of this, testing the container(s) and container manager locally is not possible at this time. Do the following from within the sandbox-container app: 1. Copy the `.dev.vars.example` file to a new `.dev.vars` file. 2. Get the Cloudflare client id and secret from a team member and add them to the `.dev.vars` file. 3. Run `pnpm i` then `pnpm dev` to start the MCP server. 4. Run `pnpx @modelcontextprotocol/inspector` to start the MCP inspector client. 5. Open the inspector client in your browser and connect to the server via `http://localhost:8976/sse`. Note: Temporary files created through files tool calls are stored in the workdir folder of this app. ## Deploying 1. Make sure the docker daemon is running 2. Disable WARP and run ``` npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14387504770/npm-package-wrangler-8740 deploy ``` 3. Add to your Claude config. If using with Claude, you'll need to disable WARP: ``` { "mcpServers": { "container": { "command": "npx", "args": [ "mcp-remote", // this is my deployed instance "https://container-starter-2.cmsparks.workers.dev/sse" ] } } } ``` ``` -------------------------------------------------------------------------------- /apps/ai-gateway/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If 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 ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/browser-rendering/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If 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 ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/workers-builds/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If you're an external contributor, you can provide a development API token: ``` DEV_DISABLE_OAUTH=true DEV_CLOUDFLARE_EMAIL=your_cloudflare_email # This is your global api token DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` 2. Start the local development server: ```bash pnpm dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/radar/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If you're an external contributor, you can provide a development API token: ``` DEV_DISABLE_OAUTH=true DEV_CLOUDFLARE_EMAIL=your_cloudflare_email # This is your global api token DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/workers-bindings/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If you're an external contributor, you can provide a development API token: ``` DEV_DISABLE_OAUTH=true DEV_CLOUDFLARE_EMAIL=your_cloudflare_email # This is your global api token DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/workers-observability/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If you're an external contributor, you can provide a development API token: ``` DEV_DISABLE_OAUTH=true DEV_CLOUDFLARE_EMAIL=your_cloudflare_email # This is your global api token DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /apps/autorag/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret ``` If 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 ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash npx wrangler secret put CLOUDFLARE_CLIENT_ID -e <ENVIRONMENT> npx wrangler secret put CLOUDFLARE_CLIENT_SECRET -e <ENVIRONMENT> npx wrangler secret put URL_SCANNER_API_TOKEN -e <ENVIRONMENT> ``` ## Set up a KV namespace Create the KV namespace: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Developing We welcome contributions to all of our MCP servers! Here's a quick run down on how to get started. ## Architecture This monorepo has two top-level directories: `/apps` and `/packages`. - **/apps**: Containing directories for each server. Within each server, you'll find a `CONTRIBUTING.md` with any special instructions on how to get set up: - [apps/workers-observability](apps/workers-observability) - [apps/workers-bindings](apps/workers-bindings) - [apps/radar](apps/radar) - [apps/cloudflare-one-casb](apps/cloudflare-one-casb) - **/packages**: Containing shared packages used across our various apps. - packages/eslint-config: Eslint config used by all apps and packages. - packages/typescript-config: tsconfig used by all apps and packages. - packages/mcp-common: Shared common tools and scripts to help manage this repo. We use [TurboRepo](https://turbo.build/) and [pnpm](https://pnpm.io/) to manage this repository. TurboRepo manages the monorepo by ensuring commands are run across all apps. ## Getting Started This section will guide you through setting up your developer environment and running tests. ### Installation Install dependencies: ```bash pnpm install ``` ### Testing The project uses Vitest as the testing framework with [fetchMock](https://developers.cloudflare.com/workers/testing/vitest-integration/test-apis/) for API mocking. #### Running Tests To run all tests: ```bash pnpm test ``` To run a specific test file: ```bash pnpm test -- tests/tools/queues.test.ts ``` To run tests in watch mode (useful during development): ```bash pnpm test:watch ``` ``` -------------------------------------------------------------------------------- /apps/dns-analytics/CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown # Setup If you'd like to iterate and test your MCP server, you can do so in local development. ## Local Development 1. Create a `.dev.vars` file 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_secret DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` If you're an external contributor, you can provide a development API token (See [Cloudflare API](https://developers.cloudflare.com/api/) for information on creating an API Token): ``` DEV_DISABLE_OAUTH=true DEV_CLOUDFLARE_EMAIL=your_cloudflare_email # This is your api token with endpoint access. DEV_CLOUDFLARE_API_TOKEN=your_development_api_token ``` 2. Start the local development server: ```bash npx wrangler dev ``` 3. 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: ```bash 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: ```bash 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: ```bash npx wrangler deploy -e <ENVIRONMENT> ``` Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): ```bash npx @modelcontextprotocol/inspector@latest ``` ``` -------------------------------------------------------------------------------- /packages/tools/src/test/fixtures/changesets/invalid-json/published-packages.json: -------------------------------------------------------------------------------- ```json this is not valid json ``` -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- ```yaml packages: - 'apps/*' - 'packages/*' ``` -------------------------------------------------------------------------------- /packages/tools/src/test/fixtures/changesets/invalid-schema/published-packages.json: -------------------------------------------------------------------------------- ```json [ { "name": "package-a", "version": 123 } ] ``` -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/tools.json" } ``` -------------------------------------------------------------------------------- /packages/mcp-observability/src/index.ts: -------------------------------------------------------------------------------- ```typescript export * from './analytics-engine' export * from './metrics' ``` -------------------------------------------------------------------------------- /apps/sandbox-container/shared/consts.ts: -------------------------------------------------------------------------------- ```typescript // Set this to the open port on your container export const OPEN_CONTAINER_PORT = 8080 ``` -------------------------------------------------------------------------------- /apps/docs-autorag/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts"] } ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts"] } ``` -------------------------------------------------------------------------------- /packages/tools/src/test/fixtures/changesets/valid/published-packages.json: -------------------------------------------------------------------------------- ```json [ { "name": "package-a", "version": "1.0.0" }, { "name": "package-b", "version": "2.1.3" } ] ``` -------------------------------------------------------------------------------- /packages/eslint-config/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown # @repo/eslint-config ## 0.1.36 ### Patch Changes - cc6d41f: Update agents deps & modelcontextprotocol ``` -------------------------------------------------------------------------------- /apps/workers-bindings/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.evals.ts"] } ``` -------------------------------------------------------------------------------- /apps/ai-gateway/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/autorag/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/browser-rendering/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./types.d.ts", "./vitest.config.ts"] } ``` -------------------------------------------------------------------------------- /apps/dex-analysis/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/graphql/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/logpush/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/radar/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/workers-builds/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/workers-observability/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /packages/tools/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/tools.json", "include": ["**/*.ts"], "exclude": ["node_modules", "tsconfig.json"] } ``` -------------------------------------------------------------------------------- /apps/ai-gateway/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/auditlogs/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/autorag/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/browser-rendering/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/dex-analysis/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/dns-analytics/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/graphql/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/logpush/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/radar/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/workers-builds/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /apps/workers-observability/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /packages/mcp-common/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from './vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /packages/mcp-observability/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["**/*.ts"], "exclude": ["node_modules", "tsconfig.json"] } ``` -------------------------------------------------------------------------------- /apps/workers-bindings/evals/types.d.ts: -------------------------------------------------------------------------------- ```typescript import type { TestEnv } from '../vitest.config' declare module 'cloudflare:test' { interface ProvidedEnv extends TestEnv {} } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/env.ts: -------------------------------------------------------------------------------- ```typescript import { env } from 'cloudflare:workers' // Helper to cast env as any generic Env type export function getEnv<Env>() { return env as Env } ``` -------------------------------------------------------------------------------- /apps/demo-day/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["src/demo-day.app.ts"], "compilerOptions": { "types": ["@types/node"] } } ``` -------------------------------------------------------------------------------- /apps/auditlogs/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "worker-configuration.d.ts", "./vitest.config.ts", "./types.d.ts"] } ``` -------------------------------------------------------------------------------- /apps/dns-analytics/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./worker-configuration.d.ts", "./types.d.ts", "./vitest.config.ts"] } ``` -------------------------------------------------------------------------------- /packages/typescript-config/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/typescript-config", "version": "0.3.1", "private": true, "sideEffects": false, "devDependencies": { "@types/node": "22.14.1" } } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["*/**.ts", "./vitest.config.evals.ts", "./types.d.ts"], "exclude": ["container/**.ts"] } ``` -------------------------------------------------------------------------------- /packages/eval-tools/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers.json", "include": ["**/*.ts", "./worker-configuration.d.ts"], "exclude": ["node_modules", "tsconfig.json"] } ``` -------------------------------------------------------------------------------- /packages/tools/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineConfig } from 'vitest/config' export default defineConfig({ test: { setupFiles: [`${__dirname}/src/test/setup.ts`], environment: 'node', }, }) ``` -------------------------------------------------------------------------------- /packages/tools/src/proc.ts: -------------------------------------------------------------------------------- ```typescript export function getOutcome(exitCode: number | null) { if (exitCode === 0) { return chalk.green('Success!') } else { return chalk.red(`Failed with code: ${exitCode}`) } } ``` -------------------------------------------------------------------------------- /apps/autorag/src/types.ts: -------------------------------------------------------------------------------- ```typescript import { z } from 'zod' export const pageParam = z.number().int().min(1).optional().default(1) export const perPageParam = z.number().int().min(1).max(50).optional().default(20) ``` -------------------------------------------------------------------------------- /apps/sandbox-container/types.d.ts: -------------------------------------------------------------------------------- ```typescript declare module 'cloudflare:test' { interface ProvidedEnv { OPENAI_API_KEY: 'TODO' AI_GATEWAY_TOKEN: string CLOUDFLARE_ACCOUNT_ID: string AI_GATEWAY_ID: string AI: Ai } } ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/more.svg: -------------------------------------------------------------------------------- ``` <svg width="476" height="476" viewBox="0 0 476 476" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M0 199H200V0H277V199H476V276H277V476H200V276H0V199Z" stroke='#fff' stroke-width="2"/> </svg> ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/get-props.ts: -------------------------------------------------------------------------------- ```typescript /** * Gets props from agent or throws if undefined */ export function getProps<T = unknown>(agent: { props?: T }): T { if (!agent.props) { throw new Error('Props required') } return agent.props } ``` -------------------------------------------------------------------------------- /packages/mcp-common/tsconfig.json: -------------------------------------------------------------------------------- ```json { "extends": "@repo/typescript-config/workers-lib.json", "include": ["**/*.ts"], "exclude": ["node_modules", "tsconfig.json"], "compilerOptions": { "types": ["@cloudflare/vitest-pool-workers"] } } ``` -------------------------------------------------------------------------------- /vitest.workspace.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkspace } from 'vitest/config' export default defineWorkspace([ 'apps/*/vitest.config.ts', 'apps/*/vitest.config.node.ts', 'packages/*/vitest.config.ts', 'packages/*/vitest.config.node.ts', ]) ``` -------------------------------------------------------------------------------- /packages/eval-tools/wrangler.json: -------------------------------------------------------------------------------- ```json { "name": "stub-worker", "compatibility_date": "2025-04-14", "vars": { "OPENAI_API_KEY": "TODO", "AI_GATEWAY_TOKEN": "TODO", "CLOUDFLARE_ACCOUNT_ID": "TODO", "AI_GATEWAY_ID": "TODO" }, "ai": { "binding": "AI" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/scopes.ts: -------------------------------------------------------------------------------- ```typescript // These scopes are required for Cloudflare auth export const RequiredScopes = { 'user:read': 'See your user info such as name, email address, and account memberships.', offline_access: 'Grants refresh tokens for long-lived access.', } as const ``` -------------------------------------------------------------------------------- /packages/tools/src/test/setup.ts: -------------------------------------------------------------------------------- ```typescript // Ensure chalk doesn't add colors to output for consistent snapshots delete process.env.FORCE_COLOR // runx uses zx/globals imported in bin/runx.ts // This import ensures that tests work without // needing to import this manually. await import('zx/globals') ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/config.ts: -------------------------------------------------------------------------------- ```typescript import { z } from 'zod' export type MCPEnvironment = z.infer<typeof MCPEnvironment> export const MCPEnvironment = z.enum(['VITEST', 'development', 'staging', 'production']) export function getEnvironment(environment: string) { return MCPEnvironment.parse(environment) } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/evals/utils.ts: -------------------------------------------------------------------------------- ```typescript import { MCPClientManager } from 'agents/mcp/client' export async function initializeClient(): Promise<MCPClientManager> { const clientManager = new MCPClientManager('test-client', '0.0.0') await clientManager.connect('http://localhost:8976/sse') return clientManager } ``` -------------------------------------------------------------------------------- /apps/workers-bindings/evals/utils.ts: -------------------------------------------------------------------------------- ```typescript import { MCPClientManager } from 'agents/mcp/client' export async function initializeClient(): Promise<MCPClientManager> { const clientManager = new MCPClientManager('test-client', '0.0.0') await clientManager.connect('http://localhost:8977/sse') return clientManager } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/shared.types.ts: -------------------------------------------------------------------------------- ```typescript import { z } from 'zod' export const PaginationPerPageParam = z.number().nullable().optional() export const PaginationPageParam = z.number().nullable().optional() export const PaginationLimitParam = z.number().optional() export const PaginationOffsetParam = z.number().optional() ``` -------------------------------------------------------------------------------- /apps/radar/src/types/url-scanner.ts: -------------------------------------------------------------------------------- ```typescript /** * This file contains the validators for the URL scanner tools. */ import { z } from 'zod' export const UrlParam = z .string() .url() .describe('A valid URL including protocol (e.g., "https://example.com").') export const CreateScanResult = z .object({ uuid: z.string(), }) .passthrough() ``` -------------------------------------------------------------------------------- /packages/typescript-config/workers-lib.json: -------------------------------------------------------------------------------- ```json { "$schema": "https://json.schemastore.org/tsconfig", "extends": "@repo/typescript-config/workers.json", "include": ["${configDir}/**/*.ts", "${configDir}/**/*.tsx"], "exclude": ["${configDir}/node_modules/", "${configDir}/dist/"], "compilerOptions": { "types": ["@cloudflare/vitest-pool-workers"] } } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/container/tsconfig.json: -------------------------------------------------------------------------------- ```json { "compilerOptions": { "lib": ["es2023"], "module": "ES2022", "target": "es2022", "types": ["@types/node"], "strict": true, "esModuleInterop": true, "skipLibCheck": true, "moduleResolution": "bundler", "noEmit": true, "allowImportingTsExtensions": true }, "include": ["**/*.ts"], "exclude": [] } ``` -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- ```json { "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", "changelog": "@changesets/cli/changelog", "commit": false, "fixed": [], "linked": [], "access": "restricted", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [], "privatePackages": { "version": true, "tag": true } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/constants.ts: -------------------------------------------------------------------------------- ```typescript import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js' export const MISSING_ACCOUNT_ID_RESPONSE = { content: [ { type: 'text', text: 'No currently active accountId. Try listing your accounts (accounts_list) and then setting an active account (set_active_account)', }, ], } satisfies CallToolResult ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/tools.types.ts: -------------------------------------------------------------------------------- ```typescript import type { z } from 'zod' export type ToolHandler<T extends Record<string, any>> = ( params: T & { accountId: string | null; apiToken: string } ) => Promise<any> export interface ToolDefinition<T extends Record<string, any>> { name: string description: string params: Record<string, z.ZodType> handler: ToolHandler<T> } ``` -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- ```json { "version": "2.0.0", "tasks": [ { "type": "npm", "script": "changeset:new", "group": "none", "label": "changeset: new", "detail": "Create changeset and commit all changes", "runOptions": { "instanceLimit": 1 }, "presentation": { "reveal": "always", "focus": true, "panel": "new", "close": true } } ] } ``` -------------------------------------------------------------------------------- /apps/docs-autorag/src/docs-autorag.context.ts: -------------------------------------------------------------------------------- ```typescript import type { CloudflareDocumentationMCP } from './docs-autorag.app' export interface Env { ENVIRONMENT: 'development' | 'staging' | 'production' AUTORAG_NAME: 'cloudflare-docs-autorag' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string MCP_OBJECT: DurableObjectNamespace<CloudflareDocumentationMCP> MCP_METRICS: AnalyticsEngineDataset AI: Ai } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/vitest.config.evals.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' export default defineWorkersConfig({ test: { include: ['**/*.eval.?(c|m)[jt]s?(x)'], poolOptions: { workers: { isolatedStorage: true, wrangler: { configPath: './wrangler.jsonc' }, miniflare: { bindings: { ENVIRONMENT: 'test', }, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/workers-bindings/vitest.config.evals.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' export default defineWorkersConfig({ test: { include: ['**/*.eval.?(c|m)[jt]s?(x)'], poolOptions: { workers: { isolatedStorage: true, wrangler: { configPath: './wrangler.jsonc' }, miniflare: { bindings: { ENVIRONMENT: 'test', }, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /packages/typescript-config/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown # @repo/typescript-config ## 0.3.1 ### Patch Changes - cc6d41f: Update agents deps & modelcontextprotocol ## 0.3.0 ### Minor Changes - 6cf52a6: Support AOT tokens ### Patch Changes - 0fc4439: Update agents and modelcontext dependencies ## 0.2.5 ### Patch Changes - bdb5b89: chore: remove publishConfig from typescript-config/package.json This did nothing. ``` -------------------------------------------------------------------------------- /packages/mcp-observability/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown # @repo/mcp-observability ## 0.32.3 ### Patch Changes - 43f493d: Update agent + modelcontextprotocol deps ## 0.32.2 ### Patch Changes - 7422e71: Update MCP sdk ## 0.32.1 ### Patch Changes - cc6d41f: Update agents deps & modelcontextprotocol ## 0.32.0 ### Minor Changes - 6cf52a6: Support AOT tokens ### Patch Changes - 0fc4439: Update agents and modelcontext dependencies ``` -------------------------------------------------------------------------------- /apps/sandbox-container/server/metrics.ts: -------------------------------------------------------------------------------- ```typescript import { MetricsEvent, MetricsEventIndexIds } from '@repo/mcp-observability' export class ContainerEvent extends MetricsEvent { constructor( private containers: { active?: number } ) { super() } toDataPoint(): AnalyticsEngineDataPoint { return { indexes: [MetricsEventIndexIds.CONTAINER_MANAGER], doubles: this.mapDoubles({ double1: this.containers.active, }), } } } ``` -------------------------------------------------------------------------------- /packages/eval-tools/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown # @repo/eval-tools ## 0.32.3 ### Patch Changes - 43f493d: Update agent + modelcontextprotocol deps ## 0.32.2 ### Patch Changes - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools ## 0.32.1 ### Patch Changes - cc6d41f: Update agents deps & modelcontextprotocol ## 0.32.0 ### Minor Changes - 6cf52a6: Support AOT tokens ### Patch Changes - 0fc4439: Update agents and modelcontext dependencies ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/webflow.svg: -------------------------------------------------------------------------------- ``` <svg width="529" height="331" viewBox="0 0 529 331" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M527 1L359.159 329H201.51L271.751 193.063H268.6C210.652 268.262 124.192 317.766 1 329V194.945C1 194.945 79.8072 190.291 126.138 141.598H1V1.00364H141.643V116.641L144.8 116.628L202.27 1.00364H308.634V115.907L311.791 115.901L371.418 1H527Z" stroke="white" stroke-width="1"/> </svg> ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/workers.types.ts: -------------------------------------------------------------------------------- ```typescript import { z } from 'zod' export type WorkersService = z.infer<typeof WorkersService> export const WorkersService = z.object({ id: z.string(), default_environment: z.object({ environment: z.string(), script_tag: z.string(), created_on: z.string(), modified_on: z.string(), script: z.object({ created_on: z.string(), modified_on: z.string(), id: z.string(), }), }), created_on: z.string(), modified_on: z.string(), }) ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/src/docs-vectorize.context.ts: -------------------------------------------------------------------------------- ```typescript import type { CloudflareDocumentationMCP } from './docs-vectorize.app' export interface Env { ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string MCP_OBJECT: DurableObjectNamespace<CloudflareDocumentationMCP> MCP_METRICS: AnalyticsEngineDataset SENTRY_ACCESS_CLIENT_ID: string SENTRY_ACCESS_CLIENT_SECRET: string GIT_HASH: string SENTRY_DSN: string AI: Ai VECTORIZE: VectorizeIndex } ``` -------------------------------------------------------------------------------- /packages/mcp-observability/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/mcp-observability", "version": "0.32.3", "private": true, "sideEffects": false, "type": "module", "main": "./src/index.ts", "scripts": { "types": "wrangler types --include-env=false" }, "directories": { "bin": "bin" }, "dependencies": { "@modelcontextprotocol/sdk": "1.18.2", "wrangler": "4.10.0", "zod": "3.24.2" }, "devDependencies": { "@repo/typescript-config": "workspace:*", "@types/node": "22.14.1" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/tests/utils/cloudflare-mock.ts: -------------------------------------------------------------------------------- ```typescript import { vi } from 'vitest' import type { Account } from 'cloudflare/resources/accounts/accounts.mjs' /** * Creates a mocked implementation of the Cloudflare client */ export const cloudflareClientMockImplementation = () => { return { accounts: { list: vi.fn(async () => { return { success: true, result: [ { id: 'mock-account-id', name: 'mock-account-name', }, ] satisfies Account[], } }), }, } } ``` -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- ```json { // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] } ``` -------------------------------------------------------------------------------- /packages/tools/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/tools", "version": "0.33.1", "private": true, "sideEffects": false, "type": "module", "directories": { "bin": "bin" }, "devDependencies": { "@types/fs-extra": "11.0.4", "@types/node": "22.14.1", "vitest": "3.0.9" }, "dependencies": { "@commander-js/extra-typings": "13.1.0", "@jahands/cli-tools": "0.10.2", "commander": "13.1.0", "empathic": "1.1.0", "tsx": "4.19.3", "zod": "4.0.0-beta.20250505T195954", "zx": "8.5.4" } } ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/anthropic.svg: -------------------------------------------------------------------------------- ``` <svg width="517" height="364" viewBox="0 0 517 364" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M110.465 286.84H109.782L109.534 287.476L80.063 363H1.47142L144.789 1H226.419L369.737 363H291.15L262.238 287.482L261.992 286.84H261.304H110.465ZM135.326 219.719L134.801 221.08H136.259H234.949H236.408L235.882 219.719L186.537 92.0395L185.604 89.626L184.671 92.0395L135.326 219.719ZM515.529 363H438.616L295.298 1H372.211L515.529 363Z" stroke="white" stroke-width="1"/> </svg> ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/src/cf1-casb.context.ts: -------------------------------------------------------------------------------- ```typescript import type { CASBMCP, UserDetails } from './cf1-casb.app' export interface Env { ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string MCP_OBJECT: DurableObjectNamespace<CASBMCP> MCP_METRICS: AnalyticsEngineDataset AI: Ai CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string USER_DETAILS: DurableObjectNamespace<UserDetails> DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/server/utils.spec.ts: -------------------------------------------------------------------------------- ```typescript import { describe, expect, it } from 'vitest' import { stripProtocolFromFilePath } from './utils' describe('get_file_name_from_path', () => { it('strips file:// protocol from path', async () => { const path = await stripProtocolFromFilePath('file:///files/contents/cats') expect(path).toBe('/files/contents/cats') }), it('leaves protocol-less paths untouched', async () => { const path = await stripProtocolFromFilePath('/files/contents/cats') expect(path).toBe('/files/contents/cats') }) }) ``` -------------------------------------------------------------------------------- /apps/dns-analytics/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/d1.types.ts: -------------------------------------------------------------------------------- ```typescript /** * This file contains the validators for the d1 tools. */ import { z } from 'zod' import type { DatabaseCreateParams } from 'cloudflare/resources/d1.mjs' export const D1DatabaseNameParam: z.ZodType<DatabaseCreateParams['name']> = z.string() export const D1DatabasePrimaryLocationHintParam: z.ZodType< DatabaseCreateParams['primary_location_hint'] > = z.enum(['wnam', 'enam', 'weur', 'eeur', 'apac', 'oc']).optional() export const D1DatabaseQuerySqlParam = z.string() export const D1DatabaseQueryParamsParam = z.array(z.string()).optional() ``` -------------------------------------------------------------------------------- /packages/mcp-common/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersProject } from '@cloudflare/vitest-pool-workers/config' export interface TestEnv { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersProject({ test: { poolOptions: { workers: { singleWorker: true, miniflare: { compatibilityDate: '2025-03-10', compatibilityFlags: ['nodejs_compat'], bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/radar/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/radar.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/autorag/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/autorag.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/browser-rendering/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/browser.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/logpush/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/logpush.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/cf1-casb.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/logpush/src/logpush.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { LogsMCP } from './logpush.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<LogsMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/workers-bindings/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/bindings.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /packages/tools/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown # @repo/tools ## 0.33.1 ### Patch Changes - cc6d41f: Update agents deps & modelcontextprotocol ## 0.33.0 ### Minor Changes - 6cf52a6: Support AOT tokens ### Patch Changes - 0fc4439: Update agents and modelcontext dependencies ## 0.32.1 ### Patch Changes - 86c2e4f: Add API token passthrough auth ## 0.32.0 ### Minor Changes - 33e0198: BANDA-899 feat: add runx deploy-published-workers script ### Patch Changes - bdb5b89: chore: remove pnpx from wrangler deploy script This is redundant because turbo and pnpm already add the bundled wrangler command to $PATH ``` -------------------------------------------------------------------------------- /apps/auditlogs/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/auditlogs.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/ai-gateway/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/ai-gateway.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/dex-analysis/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/dex-analysis.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/docs-autorag/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/docs-autorag.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /packages/tools/src/bin/runx.ts: -------------------------------------------------------------------------------- ```typescript import 'zx/globals' import { program } from '@commander-js/extra-typings' import { catchProcessError } from '@jahands/cli-tools' import { deployPublishedWorkersCmd } from '../cmd/deploy-published-packages' program .name('runx') .description('A CLI for scripts that automate this repo') // While `packages/tools/bin` scripts work well for simple tasks, // a typescript CLI is nicer for more complex things. .addCommand(deployPublishedWorkersCmd) // Don't hang for unresolved promises .hook('postAction', () => process.exit(0)) .parseAsync() .catch(catchProcessError()) ``` -------------------------------------------------------------------------------- /apps/autorag/src/autorag.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { AutoRAGMCP } from './autorag.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<AutoRAGMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/browser-rendering/src/browser.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { BrowserMCP } from './browser.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<BrowserMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/docs-vectorize.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/workers-builds/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/workers-builds.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /packages/typescript-config/tools.json: -------------------------------------------------------------------------------- ```json { "$schema": "https://json.schemastore.org/tsconfig", "display": "Default", "compilerOptions": { "target": "es2022", "module": "es2022", "composite": false, "declaration": true, "declarationMap": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "inlineSources": false, "isolatedModules": true, "moduleResolution": "node", "noUnusedLocals": false, "noUnusedParameters": false, "preserveWatchOutput": true, "skipLibCheck": true, "strict": true, "noEmit": true, "experimentalDecorators": true }, "exclude": ["node_modules"] } ``` -------------------------------------------------------------------------------- /apps/ai-gateway/src/ai-gateway.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { AIGatewayMCP } from './ai-gateway.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<AIGatewayMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/workers-observability/vitest.config.ts: -------------------------------------------------------------------------------- ```typescript import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config' import type { Env } from './src/workers-observability.context' export interface TestEnv extends Env { CLOUDFLARE_MOCK_ACCOUNT_ID: string CLOUDFLARE_MOCK_API_TOKEN: string } export default defineWorkersConfig({ test: { poolOptions: { workers: { wrangler: { configPath: `${__dirname}/wrangler.jsonc` }, miniflare: { bindings: { CLOUDFLARE_MOCK_ACCOUNT_ID: 'mock-account-id', CLOUDFLARE_MOCK_API_TOKEN: 'mock-api-token', } satisfies Partial<TestEnv>, }, }, }, }, }) ``` -------------------------------------------------------------------------------- /apps/graphql/src/graphql.context.ts: -------------------------------------------------------------------------------- ```typescript import type { GraphQLMCP, UserDetails } from './graphql.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<GraphQLMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset SENTRY_ACCESS_CLIENT_ID: string SENTRY_ACCESS_CLIENT_SECRET: string GIT_HASH: string SENTRY_DSN: string DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/auditlogs/src/auditlogs.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { AuditlogMCP } from './auditlogs.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_ACCESS_TOKEN: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<AuditlogMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /packages/eslint-config/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/eslint-config", "version": "0.1.36", "private": true, "sideEffects": false, "files": [ "remix.cjs", "default.cjs" ], "devDependencies": { "@types/eslint": "8.56.10", "@types/node": "22.14.1", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", "eslint-config-turbo": "2.4.2", "eslint-import-resolver-typescript": "3.8.3", "eslint-plugin-import": "2.31.0", "eslint-plugin-only-warn": "1.1.0", "eslint-plugin-unused-imports": "3.2.0", "typescript": "5.5.4", "vitest": "3.0.9" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/mcp-error.ts: -------------------------------------------------------------------------------- ```typescript import type { ContentfulStatusCode } from 'hono/utils/http-status' export class McpError extends Error { public code: ContentfulStatusCode public reportToSentry: boolean // error message for internal use public internalMessage?: string public cause?: Error constructor( message: string, code: ContentfulStatusCode, opts: { reportToSentry: boolean internalMessage?: string cause?: Error } = { reportToSentry: false } ) { super(message) this.code = code this.name = 'MCPError' this.reportToSentry = opts.reportToSentry this.internalMessage = opts.internalMessage this.cause = opts.cause } } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/server/utils.ts: -------------------------------------------------------------------------------- ```typescript export async function fileToBase64(blob: Blob): Promise<string> { // Use ArrayBuffer instead of text() for binary data const arrayBuffer = await blob.arrayBuffer() const byteArray = new Uint8Array(arrayBuffer) // Convert byte array to base64 string let binary = '' byteArray.forEach((byte) => { binary += String.fromCharCode(byte) }) // Apply base64 encoding return btoa(binary) } // Used for file related tool calls in case the llm sends a full resource URI export async function stripProtocolFromFilePath(path: string): Promise<string> { return path.startsWith('file://') ? path.replace('file://', '') : path } ``` -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- ```yaml name: 'Setup Node.js Environment' description: 'Install pnpm, Node.js, and project dependencies' inputs: node-version: description: 'Node.js version to use' required: false default: '22' runs: using: "composite" steps: - name: Install pnpm # note: version is inferred from the packageManager field in package.json uses: pnpm/action-setup@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} cache: 'pnpm' - name: Install dependencies shell: bash run: pnpm install --frozen-lockfile --child-concurrency=10 ``` -------------------------------------------------------------------------------- /apps/demo-day/package.json: -------------------------------------------------------------------------------- ```json { "name": "demo-day", "version": "0.1.6", "private": true, "scripts": { "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /packages/eval-tools/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/eval-tools", "version": "0.32.3", "private": true, "sideEffects": false, "type": "module", "scripts": { "types": "wrangler types --include-env=false" }, "directories": { "bin": "bin" }, "dependencies": { "@ai-sdk/anthropic": "1.2.11", "@ai-sdk/google": "1.2.17", "@ai-sdk/openai": "1.3.20", "@cloudflare/vitest-pool-workers": "0.8.14", "agents": "0.2.7", "ai": "4.3.10", "ai-gateway-provider": "0.0.6", "workers-ai-provider": "0.3.0", "wrangler": "4.10.0", "zod": "3.24.2" }, "devDependencies": { "@repo/typescript-config": "workspace:*", "@types/node": "22.14.1", "vitest-evals": "0.1.4" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/api-handler.ts: -------------------------------------------------------------------------------- ```typescript import type { McpAgent } from 'agents/mcp' // Support both SSE and Streamable HTTP export function createApiHandler< T extends typeof McpAgent<unknown, unknown, Record<string, unknown>>, >(agent: T, opts?: { binding?: string }) { return { fetch: (req: Request, env: unknown, ctx: ExecutionContext) => { const url = new URL(req.url) if (url.pathname === '/sse' || url.pathname === '/sse/message') { return agent.serveSSE('/sse', { binding: opts?.binding }).fetch(req, env, ctx) } if (url.pathname === '/mcp') { return agent.serve('/mcp', { binding: opts?.binding }).fetch(req, env, ctx) } return new Response('Not found', { status: 404 }) }, } } ``` -------------------------------------------------------------------------------- /apps/workers-builds/src/workers-builds.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { BuildsMCP } from './workers-builds.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<BuildsMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset SENTRY_ACCESS_CLIENT_ID: string SENTRY_ACCESS_CLIENT_SECRET: string GIT_HASH: string SENTRY_DSN: string DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/dns-analytics/src/dns-analytics.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { DNSAnalyticsMCP } from './dns-analytics.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<DNSAnalyticsMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset SENTRY_ACCESS_CLIENT_ID: string SENTRY_ACCESS_CLIENT_SECRET: string GIT_HASH: string SENTRY_DSN: string DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/dex-analysis/src/dex-analysis.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { CloudflareDEXMCP } from './dex-analysis.app' import type { WarpDiagReader } from './warp_diag_reader' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<CloudflareDEXMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> WARP_DIAG_READER: DurableObjectNamespace<WarpDiagReader> MCP_METRICS: AnalyticsEngineDataset DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- ```json { "editor.detectIndentation": true, // https://arktype.io/docs/intro/setup#settings // allow autocomplete for ArkType expressions like "string | num" "editor.quickSuggestions": { "strings": "on" }, // prioritize ArkType's "type" for autoimports "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"], "typescript.preferences.autoImportFileExcludePatterns": ["**/vitest/dist/**"], "typescript.preferences.importModuleSpecifier": "non-relative", "files.associations": { "**/packages/tools/bin/*": "shellscript", "**/*.css": "tailwindcss", "turbo.json": "jsonc", "**/packages/typescript-config/*.json": "jsonc" }, "eslint.workingDirectories": [ { "mode": "auto" } ] } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/server/sandbox.server.context.ts: -------------------------------------------------------------------------------- ```typescript import type { ContainerManager, ContainerMcpAgent, UserContainer } from './sandbox.server.app' export interface Env { OAUTH_KV: KVNamespace CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string ENVIRONMENT: 'dev' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string OPENAI_API_KEY: string AI_GATEWAY_TOKEN: string CLOUDFLARE_ACCOUNT_ID: string AI_GATEWAY_ID: string MCP_OBJECT: DurableObjectNamespace<ContainerMcpAgent> CONTAINER_MANAGER: DurableObjectNamespace<ContainerManager> USER_CONTAINER: DurableObjectNamespace<UserContainer> USER_BLOCKLIST: KVNamespace MCP_METRICS: AnalyticsEngineDataset AI: Ai DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /packages/typescript-config/workers.json: -------------------------------------------------------------------------------- ```json { "$schema": "https://json.schemastore.org/tsconfig", "include": [ "${configDir}/worker-configuration.d.ts", "${configDir}/env.d.ts", "${configDir}/**/*.ts", "${configDir}/**/*.tsx" ], "exclude": ["${configDir}/node_modules/", "${configDir}/dist/"], "compilerOptions": { "target": "es2022", "lib": ["es2022"], "jsx": "react", "module": "es2022", "moduleResolution": "bundler", "types": ["./worker-configuration.d.ts", "@cloudflare/vitest-pool-workers", "@types/node"], "resolveJsonModule": true, "allowJs": true, "checkJs": false, "noEmit": true, "isolatedModules": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true } } ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/asana.svg: -------------------------------------------------------------------------------- ``` <svg width="490" height="453" viewBox="0 0 490 453" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1 346.397C1 288.086 48.266 240.83 106.567 240.825C164.875 240.828 212.138 288.087 212.138 346.397C212.138 404.703 164.872 451.974 106.567 451.974C48.2661 451.974 1 404.703 1 346.397ZM350.562 107.598H350.562C350.026 165.445 302.972 212.186 245.005 212.186C186.695 212.186 139.434 164.905 139.434 106.598C139.434 48.2921 186.695 1.02148 245.005 1.02148C303.305 1.02148 350.562 48.292 350.562 106.598V107.598ZM277.867 346.392C277.867 288.086 325.128 240.82 383.439 240.82C441.739 240.82 489 288.086 489 346.392C489 404.703 441.739 451.979 383.439 451.979C325.128 451.979 277.867 404.703 277.867 346.392Z" stroke="white" stroke-width="1"/> </svg> ``` -------------------------------------------------------------------------------- /apps/workers-observability/src/workers-observability.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { ObservabilityMCP } from './workers-observability.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<ObservabilityMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset SENTRY_ACCESS_CLIENT_ID: string SENTRY_ACCESS_CLIENT_SECRET: string GIT_HASH: string SENTRY_DSN: string AI: Ai VECTORIZE: VectorizeIndex DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /apps/sandbox-container/evals/initialize.eval.ts: -------------------------------------------------------------------------------- ```typescript import { describeEval } from 'vitest-evals' import { runTask } from '@repo/eval-tools/src/runTask' import { checkFactuality } from '@repo/eval-tools/src/scorers' import { eachModel } from '@repo/eval-tools/src/test-models' import { initializeClient } from './utils' eachModel('$modelName', ({ model }) => { describeEval('Runs container initialize', { data: async () => [ { input: 'create and ping a container', expected: 'The container_initialize tool was called and then the container_ping tool was called', }, ], task: async (input) => { const client = await initializeClient() const { promptOutput } = await runTask(client, model, input) return promptOutput }, scorers: [checkFactuality], threshold: 1, timeout: 60000, }) }) ``` -------------------------------------------------------------------------------- /apps/workers-bindings/src/bindings.context.ts: -------------------------------------------------------------------------------- ```typescript import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' import type { WorkersBindingsMCP } from './bindings.app' export interface Env { OAUTH_KV: KVNamespace ENVIRONMENT: 'development' | 'staging' | 'production' | 'test' MCP_SERVER_NAME: string MCP_SERVER_VERSION: string CLOUDFLARE_CLIENT_ID: string CLOUDFLARE_CLIENT_SECRET: string MCP_OBJECT: DurableObjectNamespace<WorkersBindingsMCP> USER_DETAILS: DurableObjectNamespace<UserDetails> MCP_METRICS: AnalyticsEngineDataset CLOUDFLARE_API_TOKEN: string OPENAI_API_KEY: string AI_GATEWAY_TOKEN: string CLOUDFLARE_ACCOUNT_ID: string AI_GATEWAY_ID: string AI: Ai VECTORIZE: VectorizeIndex DEV_DISABLE_OAUTH: string DEV_CLOUDFLARE_API_TOKEN: string DEV_CLOUDFLARE_EMAIL: string } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/prompts/docs-vectorize.prompts.ts: -------------------------------------------------------------------------------- ```typescript import type { CloudflareMcpAgentNoAccount } from '../types/cloudflare-mcp-agent.types' /** * Registers developer-platform-related prompts with the MCP server * @param agent The MCP server instance */ export function registerPrompts(agent: CloudflareMcpAgentNoAccount) { agent.server.prompt( 'workers-prompt-full', 'Detailed prompt for generating Cloudflare Workers code (and other developer platform products) from https://developers.cloudflare.com/workers/prompt.txt', async () => ({ messages: [ { role: 'user', content: { type: 'text', text: await ( await fetch('https://developers.cloudflare.com/workers/prompt.txt', { cf: { cacheEverything: true, cacheTtl: 3600 }, }) ).text(), }, }, ], }) ) } ``` -------------------------------------------------------------------------------- /apps/logpush/package.json: -------------------------------------------------------------------------------- ```json { "name": "logpush", "version": "0.1.7", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/auditlogs/package.json: -------------------------------------------------------------------------------- ```json { "name": "auditlogs", "version": "0.1.7", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/dns-analytics/package.json: -------------------------------------------------------------------------------- ```json { "name": "dns-analytics", "version": "0.1.7", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/package.json: -------------------------------------------------------------------------------- ```json { "name": "cloudflare-casb-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/jsonwebtoken": "9.0.9", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/radar/package.json: -------------------------------------------------------------------------------- ```json { "name": "cloudflare-radar-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/autorag/package.json: -------------------------------------------------------------------------------- ```json { "name": "cloudflare-autorag-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/browser-rendering/package.json: -------------------------------------------------------------------------------- ```json { "name": "cloudflare-browser-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/docs-autorag/package.json: -------------------------------------------------------------------------------- ```json { "name": "docs-autorag", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "mime": "4.0.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/ai-gateway/package.json: -------------------------------------------------------------------------------- ```json { "name": "cloudflare-ai-gateway-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/poll.ts: -------------------------------------------------------------------------------- ```typescript type PollOptions<T> = { taskFn: () => Promise<T> checkFn?: (result: T) => boolean intervalSeconds?: number maxWaitSeconds?: number onError?: (error: unknown) => void } const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) export async function pollUntilReady<T>({ taskFn, checkFn = (result: T) => Boolean(result), intervalSeconds = 5, maxWaitSeconds = 60, onError = () => {}, }: PollOptions<T>): Promise<T> { let elapsed = 0 let result: T | null = null while (elapsed < maxWaitSeconds) { try { result = await taskFn() if (checkFn(result)) break } catch (error) { onError(error) } await sleep(intervalSeconds * 1000) elapsed += intervalSeconds } if (result === null || !checkFn(result)) { throw new Error('Polling timed out or condition not met') } return result } ``` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- ```markdown --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Client Information** - LLM Client: [e.g. Claude Desktop, claude.ai, Cursor, VSCode] - Client Config: [e.g. claude_desktop_config.json or screenshot of client configuration UI] - Using MCP Remote?: Yes/No - MCP Server: [e.g. https://observability.mcp.cloudflare.com, https://docs.mcp.cloudflare.com] - Prompt: [if applicable, add the prompt used] **Describe the bug** A clear and concise description of what the bug is. Any error logs are helpful. **To Reproduce** Steps to reproduce the behavior: 1. Connect to MCP Server... 2. Provide LLM prompt "..." 4. See error... **Expected behavior** A clear and concise description of what you expected to happen. **Additional context** Add any other context about the problem here. ``` -------------------------------------------------------------------------------- /apps/graphql/package.json: -------------------------------------------------------------------------------- ```json { "name": "graphql-mcp-server", "version": "0.1.6", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2", "lz-string": "1.5.0" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/workers-observability/package.json: -------------------------------------------------------------------------------- ```json { "name": "workers-observability", "version": "0.4.1", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@fast-csv/format": "5.0.2", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/square.svg: -------------------------------------------------------------------------------- ``` <svg width="490" height="490" viewBox="0 0 490 490" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M81.6777 0.5H408.322C452.956 0.5 489.5 37.027 489.509 81.6807V408.347C489.509 452.972 452.966 489.5 408.332 489.5H81.6777C37.0441 489.5 0.5 452.963 0.5 408.347V81.6807L0.506836 80.6357C1.07147 36.4586 37.3927 0.5 81.6777 0.5ZM115.056 88.6045C100.504 88.6045 88.5832 100.526 88.583 115.078V374.949C88.5831 389.494 100.505 401.377 115.056 401.377H374.926C389.486 401.377 401.399 389.503 401.399 374.949V115.078C401.399 100.526 389.487 88.6045 374.926 88.6045H115.056ZM193.067 178.699H296.997C304.872 178.699 311.326 185.153 311.326 193.038L311.335 296.972L311.33 297.341C311.133 305.083 304.749 311.319 297.006 311.319H193.067C185.175 311.319 178.738 304.875 178.738 296.972V193.038C178.738 185.144 185.174 178.699 193.067 178.699Z" stroke="white"/> </svg> ``` -------------------------------------------------------------------------------- /apps/workers-builds/package.json: -------------------------------------------------------------------------------- ```json { "name": "workers-builds", "version": "0.1.7", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "vite dev", "start": "vite dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vite-plugin": "1.1.0", "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vite": "6.3.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/package.json: -------------------------------------------------------------------------------- ```json { "name": "docs-vectorize", "version": "0.4.1", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev --experimental-vectorize-bind-to-prod", "start": "npm run dev", "types": "wrangler types --include-env=false", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "mime": "4.0.6", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/radar/src/utils.ts: -------------------------------------------------------------------------------- ```typescript /** * Resolves and invokes a method dynamically based on the provided slugs. * * This function traverses the object based on the `slugs` array, binds the method * to its correct context, and invokes it with the provided parameters. * * @param {Object} client - The root object (e.g., `client.radar.http`) to resolve methods from. * @param {string[]} path - The path to the desired method. * @param {Object} params - The parameters to pass when invoking the resolved method. * @returns {Promise<any>} The result of the method invocation. */ export async function resolveAndInvoke(client: any, path: string, params: any): Promise<any> { const slugs = path.split('/') const method = slugs.reduce((acc, key) => acc?.[key], client) const parentContext = slugs.slice(0, -1).reduce((acc, key) => acc?.[key], client) return await method.bind(parentContext)(params) } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/cloudflare-mcp-agent.types.ts: -------------------------------------------------------------------------------- ```typescript import { type McpAgent } from 'agents/mcp' import type { AuthProps } from '../cloudflare-oauth-handler' import type { CloudflareMCPServer } from '../server' export type CloudflareMCPAgentState = { activeAccountId: string | null } export type CloudflareMCPAgentProps = AuthProps // We omit server in this type, so that we can later use our own CloudflareMCPServer type ( which extends McpServer ) type McpAgentWithoutServer<EnvType = unknown> = Omit< McpAgent<EnvType, CloudflareMCPAgentState, CloudflareMCPAgentProps>, 'server' > export interface CloudflareMcpAgentNoAccount<EnvType = unknown> extends McpAgentWithoutServer<EnvType> { server: CloudflareMCPServer } export interface CloudflareMcpAgent<EnvType = unknown> extends CloudflareMcpAgentNoAccount<EnvType> { setActiveAccountId(accountId: string): Promise<void> getActiveAccountId(): Promise<string | null> } ``` -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- ```yaml name: Main on: push: branches: ['main'] env: FORCE_COLOR: 1 jobs: deploy-staging: name: Deploy (staging) runs-on: ubuntu-24.04 permissions: contents: read timeout-minutes: 10 concurrency: ${{ github.workflow }}-deploy-staging steps: - name: Checkout Repo uses: actions/checkout@v4 - uses: ./.github/actions/setup # Run tests & checks before deploying - name: Syncpack lint run: pnpm check:deps - name: Run linter run: pnpm check:turbo - name: Run linter (formatting) run: pnpm check:format - name: Run tests run: pnpm test - name: Deploy Workers (staging) run: pnpm turbo deploy -- -e staging env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} ``` -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- ```json { "$schema": "https://turbo.build/schema.json", "globalPassThroughEnv": ["FORCE_COLOR", "RUNNER_TEMP"], "tasks": { "deploy": { "cache": false, "env": ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN", "CLOUDFLARE_STAGING_API_TOKEN"], "outputs": ["dist"], "outputLogs": "new-only" }, "check": { "dependsOn": ["^check:types", "^check:lint", "check:types", "check:lint"], "outputLogs": "new-only" }, "check:types": { "dependsOn": ["^check:types"], "outputLogs": "new-only" }, "check:lint": { "env": ["GITHUB_ACTIONS"], "dependsOn": ["^check:lint"], "outputLogs": "new-only" }, "eval:ci": { "dependsOn": ["^eval:ci"], "outputLogs": "new-only" }, "types": { "dependsOn": ["^types"], "outputLogs": "new-only" }, "//#check:format": { "outputLogs": "new-only" }, "//#check:deps": { "outputLogs": "new-only" } } } ``` -------------------------------------------------------------------------------- /apps/dex-analysis/package.json: -------------------------------------------------------------------------------- ```json { "name": "dex-analysis", "version": "0.2.2", "private": true, "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "deploy": "run-wrangler-deploy", "dev": "wrangler dev", "start": "wrangler dev", "types": "wrangler types --include-env=false", "cf-typegen": "wrangler types", "test": "vitest run" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-common": "workspace:*", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "jszip": "3.10.1", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@types/jsonwebtoken": "9.0.9", "@types/node": "22.14.1", "prettier": "3.5.3", "typescript": "5.5.4", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/format.ts: -------------------------------------------------------------------------------- ```typescript import { writeToString } from '@fast-csv/format' /** * A collection of formatting functions (think of it like Golang's `fmt` package) */ export const fmt = { /** * Trims all lines of a string. * Useful for formatting tool instructions. */ trim: (str: string): string => str .trim() .split('\n') .map((line) => line.trim()) .join('\n'), /** * Converts a multi-line string into a single line. * Useful for formatting tool instructions. */ oneLine: (str: string): string => str .trim() .split('\n') .map((line) => line.trim()) .filter((line) => line.length > 0) .join(' '), /** * Convert an array of objects to a string of tab-separated values (TSV). * This is better than JSON for returning data to the model because it uses fewer tokens */ asTSV: (data: any[]): Promise<string> => writeToString(data, { headers: true, delimiter: '\t' }), } as const ``` -------------------------------------------------------------------------------- /packages/mcp-common/package.json: -------------------------------------------------------------------------------- ```json { "name": "@repo/mcp-common", "version": "0.19.3", "private": true, "sideEffects": false, "main": "./src/index.ts", "scripts": { "check:lint": "run-eslint-workers", "check:types": "run-tsc", "test": "vitest run", "test:coverage": "run-vitest-coverage" }, "dependencies": { "@cloudflare/workers-oauth-provider": "0.0.5", "@fast-csv/format": "5.0.2", "@hono/zod-validator": "0.4.3", "@modelcontextprotocol/sdk": "1.18.2", "@repo/mcp-observability": "workspace:*", "agents": "0.2.7", "cloudflare": "4.2.0", "hono": "4.7.6", "toucan-js": "4.1.1", "zod": "3.24.2" }, "devDependencies": { "@cloudflare/vitest-pool-workers": "0.8.14", "@repo/eslint-config": "workspace:*", "@repo/tools": "workspace:*", "@repo/typescript-config": "workspace:*", "@sentry/types": "8.9.2", "@types/node": "22.14.1", "@vitest/ui": "3.0.9", "vitest": "3.0.9", "wrangler": "4.10.0" } } ``` -------------------------------------------------------------------------------- /apps/docs-autorag/src/docs-autorag.app.ts: -------------------------------------------------------------------------------- ```typescript import { McpAgent } from 'agents/mcp' import { createApiHandler } from '@repo/mcp-common/src/api-handler' import { getEnv } from '@repo/mcp-common/src/env' import { CloudflareMCPServer } from '@repo/mcp-common/src/server' import { registerDocsTools } from './tools/docs-autorag.tools' import type { Env } from './docs-autorag.context' const env = getEnv<Env>() // The docs MCP server isn't stateful, so we don't have state/props export type Props = never export type State = never export class CloudflareDocumentationMCP extends McpAgent<Env, State, Props> { server = new CloudflareMCPServer({ wae: env.MCP_METRICS, serverInfo: { name: env.MCP_SERVER_NAME, version: env.MCP_SERVER_VERSION, }, }) constructor( public ctx: DurableObjectState, public env: Env ) { super(ctx, env) } async init() { registerDocsTools(this) } } export default createApiHandler(CloudflareDocumentationMCP) ``` -------------------------------------------------------------------------------- /packages/tools/src/cmd/deploy-published-packages.ts: -------------------------------------------------------------------------------- ```typescript import { Command } from '@commander-js/extra-typings' import { validateArg } from '@jahands/cli-tools' import z from 'zod' import { getPublishedPackages } from '../changesets' export const deployPublishedWorkersCmd = new Command('deploy-published-workers') .description( 'Deploy Cloudflare Workers (based on which packages changesets marked as published in the release)' ) .requiredOption( '-e, --env <staging|production>', 'The environment to deploy to', validateArg(z.enum(['staging', 'production'])) ) .action(async ({ env }) => { const publishedPackages = await getPublishedPackages() // This technically includes all versioned packages (including non-Workers), // but that's fine because only Workers include a `deploy` package.json script. const filters = publishedPackages.flatMap((p) => ['-F', p.name]) satisfies string[] await $({ verbose: true, })`turbo deploy ${filters} -- --env ${env}` }) ``` -------------------------------------------------------------------------------- /.github/workflows/branches.yml: -------------------------------------------------------------------------------- ```yaml name: Branches on: push: branches-ignore: ['main'] env: FORCE_COLOR: 1 jobs: test: name: Test & Check runs-on: ubuntu-24.04 permissions: contents: read timeout-minutes: 10 strategy: matrix: node-version: [20, 22] steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup with: node-version: ${{ matrix.node-version }} - name: Syncpack lint run: pnpm check:deps - name: Run linter run: pnpm check:turbo - name: Run linter (formatting) run: pnpm check:format - name: Run tests run: pnpm test build-workers: name: Build Workers runs-on: ubuntu-24.04 permissions: contents: read timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - name: Build Workers run: pnpm turbo deploy -- -e staging --dry-run ``` -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- ```json { "configurations": [ { "name": "Wrangler", "type": "node", "request": "attach", "port": 9229, "cwd": "/", "resolveSourceMapLocations": null, "attachExistingChildren": false, "autoAttachChildProcesses": false, "sourceMaps": true // works with or without this line }, { "type": "node", "request": "launch", "name": "Open inspector with Vitest", "runtimeExecutable": "npm", "runtimeArgs": ["run", "eval:dev"], "console": "integratedTerminal", "cwd": "${workspaceFolder}/apps/workers-bindings" }, { "name": "Attach to Workers Runtime", "type": "node", "request": "attach", "port": 9229, "cwd": "/", "resolveSourceMapLocations": null, "attachExistingChildren": false, "autoAttachChildProcesses": false } ], "compounds": [ { "name": "Debug Workers tests", "configurations": ["Open inspector with Vitest", "Attach to Workers Runtime"], "stopAll": true } ] } ```