This is page 2 of 27. Use http://codebase.md/cloudflare/mcp-server-cloudflare?lines=true&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 -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/asana.svg: -------------------------------------------------------------------------------- ``` 1 | <svg width="490" height="453" viewBox="0 0 490 453" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 | <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"/> 3 | </svg> 4 | ``` -------------------------------------------------------------------------------- /apps/workers-observability/src/workers-observability.context.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' 2 | import type { ObservabilityMCP } from './workers-observability.app' 3 | 4 | export interface Env { 5 | OAUTH_KV: KVNamespace 6 | ENVIRONMENT: 'development' | 'staging' | 'production' 7 | MCP_SERVER_NAME: string 8 | MCP_SERVER_VERSION: string 9 | CLOUDFLARE_CLIENT_ID: string 10 | CLOUDFLARE_CLIENT_SECRET: string 11 | MCP_OBJECT: DurableObjectNamespace<ObservabilityMCP> 12 | USER_DETAILS: DurableObjectNamespace<UserDetails> 13 | MCP_METRICS: AnalyticsEngineDataset 14 | SENTRY_ACCESS_CLIENT_ID: string 15 | SENTRY_ACCESS_CLIENT_SECRET: string 16 | GIT_HASH: string 17 | SENTRY_DSN: string 18 | AI: Ai 19 | VECTORIZE: VectorizeIndex 20 | DEV_DISABLE_OAUTH: string 21 | DEV_CLOUDFLARE_API_TOKEN: string 22 | DEV_CLOUDFLARE_EMAIL: string 23 | } 24 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/evals/initialize.eval.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { describeEval } from 'vitest-evals' 2 | 3 | import { runTask } from '@repo/eval-tools/src/runTask' 4 | import { checkFactuality } from '@repo/eval-tools/src/scorers' 5 | import { eachModel } from '@repo/eval-tools/src/test-models' 6 | 7 | import { initializeClient } from './utils' 8 | 9 | eachModel('$modelName', ({ model }) => { 10 | describeEval('Runs container initialize', { 11 | data: async () => [ 12 | { 13 | input: 'create and ping a container', 14 | expected: 15 | 'The container_initialize tool was called and then the container_ping tool was called', 16 | }, 17 | ], 18 | task: async (input) => { 19 | const client = await initializeClient() 20 | const { promptOutput } = await runTask(client, model, input) 21 | return promptOutput 22 | }, 23 | scorers: [checkFactuality], 24 | threshold: 1, 25 | timeout: 60000, 26 | }) 27 | }) 28 | ``` -------------------------------------------------------------------------------- /apps/workers-bindings/src/bindings.context.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type { UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do' 2 | import type { WorkersBindingsMCP } from './bindings.app' 3 | 4 | export interface Env { 5 | OAUTH_KV: KVNamespace 6 | ENVIRONMENT: 'development' | 'staging' | 'production' | 'test' 7 | MCP_SERVER_NAME: string 8 | MCP_SERVER_VERSION: string 9 | CLOUDFLARE_CLIENT_ID: string 10 | CLOUDFLARE_CLIENT_SECRET: string 11 | MCP_OBJECT: DurableObjectNamespace<WorkersBindingsMCP> 12 | USER_DETAILS: DurableObjectNamespace<UserDetails> 13 | MCP_METRICS: AnalyticsEngineDataset 14 | CLOUDFLARE_API_TOKEN: string 15 | OPENAI_API_KEY: string 16 | AI_GATEWAY_TOKEN: string 17 | CLOUDFLARE_ACCOUNT_ID: string 18 | AI_GATEWAY_ID: string 19 | AI: Ai 20 | VECTORIZE: VectorizeIndex 21 | DEV_DISABLE_OAUTH: string 22 | DEV_CLOUDFLARE_API_TOKEN: string 23 | DEV_CLOUDFLARE_EMAIL: string 24 | } 25 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/prompts/docs-vectorize.prompts.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type { CloudflareMcpAgentNoAccount } from '../types/cloudflare-mcp-agent.types' 2 | 3 | /** 4 | * Registers developer-platform-related prompts with the MCP server 5 | * @param agent The MCP server instance 6 | */ 7 | export function registerPrompts(agent: CloudflareMcpAgentNoAccount) { 8 | agent.server.prompt( 9 | 'workers-prompt-full', 10 | 'Detailed prompt for generating Cloudflare Workers code (and other developer platform products) from https://developers.cloudflare.com/workers/prompt.txt', 11 | async () => ({ 12 | messages: [ 13 | { 14 | role: 'user', 15 | content: { 16 | type: 'text', 17 | text: await ( 18 | await fetch('https://developers.cloudflare.com/workers/prompt.txt', { 19 | cf: { cacheEverything: true, cacheTtl: 3600 }, 20 | }) 21 | ).text(), 22 | }, 23 | }, 24 | ], 25 | }) 26 | ) 27 | } 28 | ``` -------------------------------------------------------------------------------- /apps/logpush/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "logpush", 3 | "version": "0.1.7", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/auditlogs/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "auditlogs", 3 | "version": "0.1.7", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/dns-analytics/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "dns-analytics", 3 | "version": "0.1.7", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "cloudflare-casb-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "agents": "0.2.7", 20 | "cloudflare": "4.2.0", 21 | "hono": "4.7.6", 22 | "zod": "3.24.2" 23 | }, 24 | "devDependencies": { 25 | "@cloudflare/vitest-pool-workers": "0.8.14", 26 | "@types/jsonwebtoken": "9.0.9", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/radar/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "cloudflare-radar-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/autorag/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "cloudflare-autorag-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/browser-rendering/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "cloudflare-browser-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /apps/docs-autorag/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "docs-autorag", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "mime": "4.0.6", 24 | "zod": "3.24.2" 25 | }, 26 | "devDependencies": { 27 | "@cloudflare/vitest-pool-workers": "0.8.14", 28 | "@types/node": "22.14.1", 29 | "prettier": "3.5.3", 30 | "typescript": "5.5.4", 31 | "vitest": "3.0.9", 32 | "wrangler": "4.10.0" 33 | } 34 | } 35 | ``` -------------------------------------------------------------------------------- /apps/ai-gateway/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "cloudflare-ai-gateway-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@types/node": "22.14.1", 28 | "prettier": "3.5.3", 29 | "typescript": "5.5.4", 30 | "vitest": "3.0.9", 31 | "wrangler": "4.10.0" 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/poll.ts: -------------------------------------------------------------------------------- ```typescript 1 | type PollOptions<T> = { 2 | taskFn: () => Promise<T> 3 | checkFn?: (result: T) => boolean 4 | intervalSeconds?: number 5 | maxWaitSeconds?: number 6 | onError?: (error: unknown) => void 7 | } 8 | 9 | const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) 10 | 11 | export async function pollUntilReady<T>({ 12 | taskFn, 13 | checkFn = (result: T) => Boolean(result), 14 | intervalSeconds = 5, 15 | maxWaitSeconds = 60, 16 | onError = () => {}, 17 | }: PollOptions<T>): Promise<T> { 18 | let elapsed = 0 19 | let result: T | null = null 20 | 21 | while (elapsed < maxWaitSeconds) { 22 | try { 23 | result = await taskFn() 24 | if (checkFn(result)) break 25 | } catch (error) { 26 | onError(error) 27 | } 28 | 29 | await sleep(intervalSeconds * 1000) 30 | elapsed += intervalSeconds 31 | } 32 | 33 | if (result === null || !checkFn(result)) { 34 | throw new Error('Polling timed out or condition not met') 35 | } 36 | 37 | return result 38 | } 39 | ``` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Client Information** 11 | - LLM Client: [e.g. Claude Desktop, claude.ai, Cursor, VSCode] 12 | - Client Config: [e.g. claude_desktop_config.json or screenshot of client configuration UI] 13 | - Using MCP Remote?: Yes/No 14 | - MCP Server: [e.g. https://observability.mcp.cloudflare.com, https://docs.mcp.cloudflare.com] 15 | - Prompt: [if applicable, add the prompt used] 16 | 17 | **Describe the bug** 18 | A clear and concise description of what the bug is. Any error logs are helpful. 19 | 20 | **To Reproduce** 21 | Steps to reproduce the behavior: 22 | 1. Connect to MCP Server... 23 | 2. Provide LLM prompt "..." 24 | 4. See error... 25 | 26 | **Expected behavior** 27 | A clear and concise description of what you expected to happen. 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | ``` -------------------------------------------------------------------------------- /apps/graphql/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "graphql-mcp-server", 3 | "version": "0.1.6", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2", 24 | "lz-string": "1.5.0" 25 | }, 26 | "devDependencies": { 27 | "@cloudflare/vitest-pool-workers": "0.8.14", 28 | "@types/node": "22.14.1", 29 | "prettier": "3.5.3", 30 | "typescript": "5.5.4", 31 | "vitest": "3.0.9", 32 | "wrangler": "4.10.0" 33 | } 34 | } 35 | ``` -------------------------------------------------------------------------------- /apps/workers-observability/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "workers-observability", 3 | "version": "0.4.1", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@fast-csv/format": "5.0.2", 17 | "@hono/zod-validator": "0.4.3", 18 | "@modelcontextprotocol/sdk": "1.18.2", 19 | "@repo/mcp-common": "workspace:*", 20 | "@repo/mcp-observability": "workspace:*", 21 | "agents": "0.2.7", 22 | "cloudflare": "4.2.0", 23 | "hono": "4.7.6", 24 | "zod": "3.24.2" 25 | }, 26 | "devDependencies": { 27 | "@cloudflare/vitest-pool-workers": "0.8.14", 28 | "@types/node": "22.14.1", 29 | "prettier": "3.5.3", 30 | "typescript": "5.5.4", 31 | "vitest": "3.0.9", 32 | "wrangler": "4.10.0" 33 | } 34 | } 35 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/square.svg: -------------------------------------------------------------------------------- ``` 1 | <svg width="490" height="490" viewBox="0 0 490 490" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 | <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"/> 3 | </svg> 4 | ``` -------------------------------------------------------------------------------- /apps/workers-builds/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "workers-builds", 3 | "version": "0.1.7", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "vite dev", 10 | "start": "vite dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vite-plugin": "1.1.0", 27 | "@cloudflare/vitest-pool-workers": "0.8.14", 28 | "@types/node": "22.14.1", 29 | "prettier": "3.5.3", 30 | "typescript": "5.5.4", 31 | "vite": "6.3.4", 32 | "vitest": "3.0.9", 33 | "wrangler": "4.10.0" 34 | } 35 | } 36 | ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "docs-vectorize", 3 | "version": "0.4.1", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev --experimental-vectorize-bind-to-prod", 10 | "start": "npm run dev", 11 | "types": "wrangler types --include-env=false", 12 | "test": "vitest run" 13 | }, 14 | "dependencies": { 15 | "@cloudflare/workers-oauth-provider": "0.0.5", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-common": "workspace:*", 19 | "@repo/mcp-observability": "workspace:*", 20 | "agents": "0.2.7", 21 | "cloudflare": "4.2.0", 22 | "hono": "4.7.6", 23 | "mime": "4.0.6", 24 | "zod": "3.24.2" 25 | }, 26 | "devDependencies": { 27 | "@cloudflare/vitest-pool-workers": "0.8.14", 28 | "@types/node": "22.14.1", 29 | "prettier": "3.5.3", 30 | "typescript": "5.5.4", 31 | "vitest": "3.0.9", 32 | "wrangler": "4.10.0" 33 | } 34 | } 35 | ``` -------------------------------------------------------------------------------- /apps/radar/src/utils.ts: -------------------------------------------------------------------------------- ```typescript 1 | /** 2 | * Resolves and invokes a method dynamically based on the provided slugs. 3 | * 4 | * This function traverses the object based on the `slugs` array, binds the method 5 | * to its correct context, and invokes it with the provided parameters. 6 | * 7 | * @param {Object} client - The root object (e.g., `client.radar.http`) to resolve methods from. 8 | * @param {string[]} path - The path to the desired method. 9 | * @param {Object} params - The parameters to pass when invoking the resolved method. 10 | * @returns {Promise<any>} The result of the method invocation. 11 | */ 12 | export async function resolveAndInvoke(client: any, path: string, params: any): Promise<any> { 13 | const slugs = path.split('/') 14 | const method = slugs.reduce((acc, key) => acc?.[key], client) 15 | const parentContext = slugs.slice(0, -1).reduce((acc, key) => acc?.[key], client) 16 | return await method.bind(parentContext)(params) 17 | } 18 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/types/cloudflare-mcp-agent.types.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { type McpAgent } from 'agents/mcp' 2 | 3 | import type { AuthProps } from '../cloudflare-oauth-handler' 4 | import type { CloudflareMCPServer } from '../server' 5 | 6 | export type CloudflareMCPAgentState = { activeAccountId: string | null } 7 | 8 | export type CloudflareMCPAgentProps = AuthProps 9 | 10 | // We omit server in this type, so that we can later use our own CloudflareMCPServer type ( which extends McpServer ) 11 | type McpAgentWithoutServer<EnvType = unknown> = Omit< 12 | McpAgent<EnvType, CloudflareMCPAgentState, CloudflareMCPAgentProps>, 13 | 'server' 14 | > 15 | 16 | export interface CloudflareMcpAgentNoAccount<EnvType = unknown> 17 | extends McpAgentWithoutServer<EnvType> { 18 | server: CloudflareMCPServer 19 | } 20 | 21 | export interface CloudflareMcpAgent<EnvType = unknown> 22 | extends CloudflareMcpAgentNoAccount<EnvType> { 23 | setActiveAccountId(accountId: string): Promise<void> 24 | getActiveAccountId(): Promise<string | null> 25 | } 26 | ``` -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- ```yaml 1 | name: Main 2 | 3 | on: 4 | push: 5 | branches: ['main'] 6 | 7 | env: 8 | FORCE_COLOR: 1 9 | 10 | jobs: 11 | deploy-staging: 12 | name: Deploy (staging) 13 | runs-on: ubuntu-24.04 14 | permissions: 15 | contents: read 16 | timeout-minutes: 10 17 | concurrency: ${{ github.workflow }}-deploy-staging 18 | steps: 19 | - name: Checkout Repo 20 | uses: actions/checkout@v4 21 | - uses: ./.github/actions/setup 22 | 23 | # Run tests & checks before deploying 24 | - name: Syncpack lint 25 | run: pnpm check:deps 26 | - name: Run linter 27 | run: pnpm check:turbo 28 | - name: Run linter (formatting) 29 | run: pnpm check:format 30 | - name: Run tests 31 | run: pnpm test 32 | 33 | - name: Deploy Workers (staging) 34 | run: pnpm turbo deploy -- -e staging 35 | env: 36 | CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} 37 | CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} 38 | ``` -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalPassThroughEnv": ["FORCE_COLOR", "RUNNER_TEMP"], 4 | "tasks": { 5 | "deploy": { 6 | "cache": false, 7 | "env": ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN", "CLOUDFLARE_STAGING_API_TOKEN"], 8 | "outputs": ["dist"], 9 | "outputLogs": "new-only" 10 | }, 11 | "check": { 12 | "dependsOn": ["^check:types", "^check:lint", "check:types", "check:lint"], 13 | "outputLogs": "new-only" 14 | }, 15 | "check:types": { 16 | "dependsOn": ["^check:types"], 17 | "outputLogs": "new-only" 18 | }, 19 | "check:lint": { 20 | "env": ["GITHUB_ACTIONS"], 21 | "dependsOn": ["^check:lint"], 22 | "outputLogs": "new-only" 23 | }, 24 | "eval:ci": { 25 | "dependsOn": ["^eval:ci"], 26 | "outputLogs": "new-only" 27 | }, 28 | "types": { 29 | "dependsOn": ["^types"], 30 | "outputLogs": "new-only" 31 | }, 32 | "//#check:format": { 33 | "outputLogs": "new-only" 34 | }, 35 | "//#check:deps": { 36 | "outputLogs": "new-only" 37 | } 38 | } 39 | } 40 | ``` -------------------------------------------------------------------------------- /apps/dex-analysis/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "dex-analysis", 3 | "version": "0.2.2", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "dev": "wrangler dev", 10 | "start": "wrangler dev", 11 | "types": "wrangler types --include-env=false", 12 | "cf-typegen": "wrangler types", 13 | "test": "vitest run" 14 | }, 15 | "dependencies": { 16 | "@cloudflare/workers-oauth-provider": "0.0.5", 17 | "@hono/zod-validator": "0.4.3", 18 | "@modelcontextprotocol/sdk": "1.18.2", 19 | "@repo/mcp-common": "workspace:*", 20 | "@repo/mcp-observability": "workspace:*", 21 | "agents": "0.2.7", 22 | "cloudflare": "4.2.0", 23 | "hono": "4.7.6", 24 | "jszip": "3.10.1", 25 | "zod": "3.24.2" 26 | }, 27 | "devDependencies": { 28 | "@cloudflare/vitest-pool-workers": "0.8.14", 29 | "@types/jsonwebtoken": "9.0.9", 30 | "@types/node": "22.14.1", 31 | "prettier": "3.5.3", 32 | "typescript": "5.5.4", 33 | "vitest": "3.0.9", 34 | "wrangler": "4.10.0" 35 | } 36 | } 37 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/format.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { writeToString } from '@fast-csv/format' 2 | 3 | /** 4 | * A collection of formatting functions (think of it like Golang's `fmt` package) 5 | */ 6 | export const fmt = { 7 | /** 8 | * Trims all lines of a string. 9 | * Useful for formatting tool instructions. 10 | */ 11 | trim: (str: string): string => 12 | str 13 | .trim() 14 | .split('\n') 15 | .map((line) => line.trim()) 16 | .join('\n'), 17 | 18 | /** 19 | * Converts a multi-line string into a single line. 20 | * Useful for formatting tool instructions. 21 | */ 22 | oneLine: (str: string): string => 23 | str 24 | .trim() 25 | .split('\n') 26 | .map((line) => line.trim()) 27 | .filter((line) => line.length > 0) 28 | .join(' '), 29 | 30 | /** 31 | * Convert an array of objects to a string of tab-separated values (TSV). 32 | * This is better than JSON for returning data to the model because it uses fewer tokens 33 | */ 34 | asTSV: (data: any[]): Promise<string> => writeToString(data, { headers: true, delimiter: '\t' }), 35 | } as const 36 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "@repo/mcp-common", 3 | "version": "0.19.3", 4 | "private": true, 5 | "sideEffects": false, 6 | "main": "./src/index.ts", 7 | "scripts": { 8 | "check:lint": "run-eslint-workers", 9 | "check:types": "run-tsc", 10 | "test": "vitest run", 11 | "test:coverage": "run-vitest-coverage" 12 | }, 13 | "dependencies": { 14 | "@cloudflare/workers-oauth-provider": "0.0.5", 15 | "@fast-csv/format": "5.0.2", 16 | "@hono/zod-validator": "0.4.3", 17 | "@modelcontextprotocol/sdk": "1.18.2", 18 | "@repo/mcp-observability": "workspace:*", 19 | "agents": "0.2.7", 20 | "cloudflare": "4.2.0", 21 | "hono": "4.7.6", 22 | "toucan-js": "4.1.1", 23 | "zod": "3.24.2" 24 | }, 25 | "devDependencies": { 26 | "@cloudflare/vitest-pool-workers": "0.8.14", 27 | "@repo/eslint-config": "workspace:*", 28 | "@repo/tools": "workspace:*", 29 | "@repo/typescript-config": "workspace:*", 30 | "@sentry/types": "8.9.2", 31 | "@types/node": "22.14.1", 32 | "@vitest/ui": "3.0.9", 33 | "vitest": "3.0.9", 34 | "wrangler": "4.10.0" 35 | } 36 | } 37 | ``` -------------------------------------------------------------------------------- /apps/docs-autorag/src/docs-autorag.app.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { McpAgent } from 'agents/mcp' 2 | 3 | import { createApiHandler } from '@repo/mcp-common/src/api-handler' 4 | import { getEnv } from '@repo/mcp-common/src/env' 5 | import { CloudflareMCPServer } from '@repo/mcp-common/src/server' 6 | 7 | import { registerDocsTools } from './tools/docs-autorag.tools' 8 | 9 | import type { Env } from './docs-autorag.context' 10 | 11 | const env = getEnv<Env>() 12 | 13 | // The docs MCP server isn't stateful, so we don't have state/props 14 | export type Props = never 15 | 16 | export type State = never 17 | 18 | export class CloudflareDocumentationMCP extends McpAgent<Env, State, Props> { 19 | server = new CloudflareMCPServer({ 20 | wae: env.MCP_METRICS, 21 | serverInfo: { 22 | name: env.MCP_SERVER_NAME, 23 | version: env.MCP_SERVER_VERSION, 24 | }, 25 | }) 26 | 27 | constructor( 28 | public ctx: DurableObjectState, 29 | public env: Env 30 | ) { 31 | super(ctx, env) 32 | } 33 | 34 | async init() { 35 | registerDocsTools(this) 36 | } 37 | } 38 | 39 | export default createApiHandler(CloudflareDocumentationMCP) 40 | ``` -------------------------------------------------------------------------------- /packages/tools/src/cmd/deploy-published-packages.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { Command } from '@commander-js/extra-typings' 2 | import { validateArg } from '@jahands/cli-tools' 3 | import z from 'zod' 4 | 5 | import { getPublishedPackages } from '../changesets' 6 | 7 | export const deployPublishedWorkersCmd = new Command('deploy-published-workers') 8 | .description( 9 | 'Deploy Cloudflare Workers (based on which packages changesets marked as published in the release)' 10 | ) 11 | .requiredOption( 12 | '-e, --env <staging|production>', 13 | 'The environment to deploy to', 14 | validateArg(z.enum(['staging', 'production'])) 15 | ) 16 | .action(async ({ env }) => { 17 | const publishedPackages = await getPublishedPackages() 18 | 19 | // This technically includes all versioned packages (including non-Workers), 20 | // but that's fine because only Workers include a `deploy` package.json script. 21 | const filters = publishedPackages.flatMap((p) => ['-F', p.name]) satisfies string[] 22 | 23 | await $({ 24 | verbose: true, 25 | })`turbo deploy ${filters} -- --env ${env}` 26 | }) 27 | ``` -------------------------------------------------------------------------------- /.github/workflows/branches.yml: -------------------------------------------------------------------------------- ```yaml 1 | name: Branches 2 | on: 3 | push: 4 | branches-ignore: ['main'] 5 | 6 | env: 7 | FORCE_COLOR: 1 8 | 9 | jobs: 10 | test: 11 | name: Test & Check 12 | runs-on: ubuntu-24.04 13 | permissions: 14 | contents: read 15 | timeout-minutes: 10 16 | strategy: 17 | matrix: 18 | node-version: [20, 22] 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: ./.github/actions/setup 22 | with: 23 | node-version: ${{ matrix.node-version }} 24 | 25 | - name: Syncpack lint 26 | run: pnpm check:deps 27 | - name: Run linter 28 | run: pnpm check:turbo 29 | - name: Run linter (formatting) 30 | run: pnpm check:format 31 | - name: Run tests 32 | run: pnpm test 33 | 34 | build-workers: 35 | name: Build Workers 36 | runs-on: ubuntu-24.04 37 | permissions: 38 | contents: read 39 | timeout-minutes: 10 40 | steps: 41 | - uses: actions/checkout@v4 42 | - uses: ./.github/actions/setup 43 | 44 | - name: Build Workers 45 | run: pnpm turbo deploy -- -e staging --dry-run ``` -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Wrangler", 5 | "type": "node", 6 | "request": "attach", 7 | "port": 9229, 8 | "cwd": "/", 9 | "resolveSourceMapLocations": null, 10 | "attachExistingChildren": false, 11 | "autoAttachChildProcesses": false, 12 | "sourceMaps": true // works with or without this line 13 | }, 14 | { 15 | "type": "node", 16 | "request": "launch", 17 | "name": "Open inspector with Vitest", 18 | "runtimeExecutable": "npm", 19 | "runtimeArgs": ["run", "eval:dev"], 20 | "console": "integratedTerminal", 21 | "cwd": "${workspaceFolder}/apps/workers-bindings" 22 | }, 23 | { 24 | "name": "Attach to Workers Runtime", 25 | "type": "node", 26 | "request": "attach", 27 | "port": 9229, 28 | "cwd": "/", 29 | "resolveSourceMapLocations": null, 30 | "attachExistingChildren": false, 31 | "autoAttachChildProcesses": false 32 | } 33 | ], 34 | "compounds": [ 35 | { 36 | "name": "Debug Workers tests", 37 | "configurations": ["Open inspector with Vitest", "Attach to Workers Runtime"], 38 | "stopAll": true 39 | } 40 | ] 41 | } 42 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/shared/schema.ts: -------------------------------------------------------------------------------- ```typescript 1 | import z from 'zod' 2 | 3 | export type ExecParams = z.infer<typeof ExecParams> 4 | export const ExecParams = z.object({ 5 | args: z.string(), 6 | timeout: z.number().optional().describe('Timeout in milliseconds'), 7 | streamStderr: z.boolean().default(true), 8 | }) 9 | 10 | export type FileWrite = z.infer<typeof FileWrite> 11 | export const FileWrite = z.object({ 12 | path: z.string(), 13 | text: z.string().describe('Full text content of the file you want to write.'), 14 | }) 15 | 16 | export type FilePathParam = z.infer<typeof FilePathParam> 17 | export const FilePathParam = z.object({ 18 | path: z.string(), 19 | }) 20 | 21 | export type FileList = z.infer<typeof FileList> 22 | export const FileList = z.object({ 23 | resources: z 24 | .object({ 25 | uri: z.string(), 26 | name: z.string(), 27 | description: z.string().optional(), 28 | mimeType: z.string().optional(), 29 | }) 30 | .array(), 31 | }) 32 | 33 | export type FilesContextSchema = z.infer<typeof FilesContextSchema> 34 | export const FilesContextSchema = z.object({ 35 | files: z 36 | .object({ 37 | uri: z.string(), 38 | }) 39 | .array(), 40 | }) 41 | ``` -------------------------------------------------------------------------------- /apps/demo-day/wrangler.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "$schema": "node_modules/wrangler/config-schema.json", 3 | "main": "src/demo-day.app.ts", 4 | "compatibility_date": "2025-03-10", 5 | "compatibility_flags": ["nodejs_compat"], 6 | "account_id": "6702657b6aa048cf3081ff3ff3c9c52f", 7 | "routes": [{ "pattern": "demo-day.mcp.cloudflare.com", "custom_domain": true }], 8 | "name": "mcp-cloudflare-demo-day", 9 | "migrations": [ 10 | { 11 | "new_sqlite_classes": ["CloudflareDemoDayMCP"], 12 | "tag": "v1" 13 | } 14 | ], 15 | "observability": { 16 | "enabled": true 17 | }, 18 | "durable_objects": { 19 | "bindings": [ 20 | { 21 | "class_name": "CloudflareDemoDayMCP", 22 | "name": "MCP_OBJECT" 23 | } 24 | ] 25 | }, 26 | "assets": { 27 | "directory": "./frontend", 28 | "binding": "ASSETS" 29 | }, 30 | "vars": { 31 | "ENVIRONMENT": "development", 32 | "MCP_SERVER_NAME": "PLACEHOLDER", 33 | "MCP_SERVER_VERSION": "PLACEHOLDER" 34 | }, 35 | "dev": { 36 | "port": 8976 37 | }, 38 | "workers_dev": false, 39 | "preview_urls": false, 40 | "analytics_engine_datasets": [ 41 | { 42 | "binding": "MCP_METRICS", 43 | "dataset": "mcp-metrics-production" 44 | } 45 | ] 46 | } 47 | ``` -------------------------------------------------------------------------------- /apps/ai-gateway/src/types.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { z } from 'zod' 2 | 3 | export const GatewayIdParam = z.string().describe('The gateway ID.') 4 | export const LogIdParam = z.string() 5 | export const pageParam = z.number().int().min(1).optional().default(1) 6 | export const perPageParam = z.number().int().min(1).max(50).optional().default(20) 7 | 8 | export const ListLogsParams = { 9 | gateway_id: GatewayIdParam, 10 | page: pageParam, 11 | per_page: perPageParam, 12 | order_by: z 13 | .enum([ 14 | 'created_at', 15 | 'provider', 16 | 'model', 17 | 'model_type', 18 | 'success', 19 | 'cached', 20 | 'cost', 21 | 'tokens_in', 22 | 'tokens_out', 23 | 'duration', 24 | 'feedback', 25 | ]) 26 | .optional() 27 | .default('created_at'), 28 | order_by_direction: z.enum(['asc', 'desc']).optional().default('desc'), 29 | start_date: z.string().datetime().optional(), 30 | end_date: z.string().datetime().optional(), 31 | feedback: z.union([z.literal(-1), z.literal(0), z.literal(1)]).optional(), 32 | success: z.boolean().optional(), 33 | cached: z.boolean().optional(), 34 | model: z.string().toLowerCase().optional(), 35 | provider: z.string().toLowerCase().optional(), 36 | } 37 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/utils.ts: -------------------------------------------------------------------------------- ```typescript 1 | /** 2 | * Utility functions for common operations 3 | */ 4 | 5 | /** 6 | * Parse a relative time string into seconds 7 | */ 8 | export function parseRelativeTime(input: string): number { 9 | const units = { s: 1, m: 60, h: 3600, d: 86400, w: 604800 } as const 10 | 11 | const cleanedInput = input.replace(/\s+/g, '').toLowerCase() 12 | if (!/^[+-](?:\d+[smhdw]){1,}$/.test(cleanedInput)) { 13 | throw new Error(`Invalid relative time format: ${input}`) 14 | } 15 | 16 | const sign = cleanedInput.startsWith('-') ? -1 : 1 17 | 18 | const timeStr = cleanedInput.slice(1) // Remove the sign 19 | const matches = timeStr.match(/\d+[smhdw]/g) 20 | 21 | if (!matches) { 22 | throw new Error(`No matches found while parsing relative time: ${timeStr}`) 23 | } 24 | 25 | const seconds = matches.reduce((total, match) => { 26 | const value = parseInt(match) 27 | const unit = match.slice(-1) as keyof typeof units 28 | 29 | return total + value * units[unit] 30 | }, 0) 31 | 32 | return sign * seconds 33 | } 34 | 35 | /** 36 | * Get the current time as an ISO string without milliseconds 37 | */ 38 | export function nowISO(): string { 39 | return new Date().toISOString().split('.')[0] + 'Z' 40 | } 41 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/utils.spec.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { describe, expect, it } from 'vitest' 2 | 3 | import { nowISO, parseRelativeTime } from './utils' 4 | 5 | describe('parseRelativeTime', () => { 6 | it('parses positive relative time correctly', () => { 7 | expect(parseRelativeTime('+1h')).toBe(3600) 8 | expect(parseRelativeTime('+2d')).toBe(172800) 9 | expect(parseRelativeTime('+3w')).toBe(1814400) 10 | }) 11 | 12 | it('parses negative relative time correctly', () => { 13 | expect(parseRelativeTime('-1h')).toBe(-3600) 14 | expect(parseRelativeTime('-2d')).toBe(-172800) 15 | expect(parseRelativeTime('-3w')).toBe(-1814400) 16 | }) 17 | 18 | it('parses mixed units correctly', () => { 19 | expect(parseRelativeTime('+1h30m')).toBe(5400) 20 | expect(parseRelativeTime('-2d6h')).toBe(-194400) 21 | }) 22 | 23 | it('throws an error for invalid formats', () => { 24 | expect(() => parseRelativeTime('1h')).toThrow() 25 | expect(() => parseRelativeTime('+')).toThrow() 26 | expect(() => parseRelativeTime('')).toThrow() 27 | }) 28 | }) 29 | 30 | describe('nowISO', () => { 31 | it('returns the current time in ISO format without milliseconds', () => { 32 | const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/ 33 | expect(nowISO()).toMatch(isoRegex) 34 | }) 35 | }) 36 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/container/fileUtils.ts: -------------------------------------------------------------------------------- ```typescript 1 | import * as fs from 'node:fs/promises' 2 | import path from 'node:path' 3 | import mime from 'mime' 4 | 5 | // this is because there isn't a "real" directory mime type, so we're reusing the "text/directory" mime type 6 | // so claude doesn't give an error 7 | export const DIRECTORY_CONTENT_TYPE = 'text/directory' 8 | 9 | export async function get_file_name_from_path(path: string): Promise<string> { 10 | path = path.replace('/files/contents', '') 11 | path = path.endsWith('/') ? path.substring(0, path.length - 1) : path 12 | 13 | return path 14 | } 15 | 16 | export async function list_files_in_directory(dirPath: string): Promise<string[]> { 17 | const files: string[] = [] 18 | try { 19 | const dir = await fs.readdir(path.join(process.cwd(), dirPath), { 20 | withFileTypes: true, 21 | }) 22 | for (const dirent of dir) { 23 | const relPath = path.relative(process.cwd(), `${dirPath}/${dirent.name}`) 24 | files.push(`file:///${relPath}`) 25 | } 26 | } catch (error) { 27 | throw new Error('Failed to read directory') 28 | } 29 | 30 | return files 31 | } 32 | 33 | export async function get_mime_type(path: string): Promise<string | null> { 34 | let mimeType = mime.getType(path) 35 | if (mimeType && mimeType === 'inode/directory') { 36 | mimeType = DIRECTORY_CONTENT_TYPE 37 | } 38 | return mimeType 39 | } 40 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/api/zone.api.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type { Cloudflare } from 'cloudflare' 2 | 3 | export interface ZoneListParams { 4 | client: Cloudflare 5 | accountId: string 6 | page?: number 7 | perPage?: number 8 | direction?: 'asc' | 'desc' 9 | match?: 'any' | 'all' 10 | name?: string 11 | status?: string 12 | order?: string 13 | } 14 | 15 | /** 16 | * Lists zones under a Cloudflare account 17 | * @see https://developers.cloudflare.com/api/resources/zones/methods/list/ 18 | */ 19 | export async function handleZonesList({ 20 | client, 21 | accountId, 22 | page = 1, 23 | perPage = 50, 24 | direction = 'desc', 25 | match = 'all', 26 | name, 27 | status, 28 | order = 'name', 29 | }: ZoneListParams) { 30 | // Build query parameters 31 | const query: Record<string, string | number> = { 32 | page, 33 | per_page: perPage, 34 | direction, 35 | match, 36 | account_id: accountId, 37 | } 38 | 39 | // Only add these parameters if they're defined and not empty strings 40 | if (name) { 41 | query.name = name 42 | } 43 | 44 | if (status) { 45 | query.status = status 46 | } 47 | 48 | if (order) { 49 | query.order = order 50 | } 51 | 52 | try { 53 | // Use the zones.list method from the Cloudflare client 54 | const response = await client.zones.list({ query }) 55 | return response.result 56 | } catch (error) { 57 | throw new Error( 58 | `Failed to list zones: ${error instanceof Error ? error.message : String(error)}` 59 | ) 60 | } 61 | } 62 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/linear.svg: -------------------------------------------------------------------------------- ``` 1 | <svg viewBox="0 0 360 360" xmlns="http://www.w3.org/2000/svg"> 2 | <path d="M191.137 358.995C190.409 359.041 189.692 358.767 189.168 358.243L1.75637 170.832C1.23337 170.309 0.959476 169.592 1.00488 168.863C1.53318 160.381 2.65162 152.059 4.31955 143.937C4.71808 141.997 7.11977 141.275 8.56629 142.722L217.278 351.434C218.725 352.88 218.003 355.282 216.063 355.68C207.941 357.348 199.619 358.467 191.137 358.995Z 3 | M271.681 330.339C272.867 331.525 272.629 333.48 271.218 334.319C265.245 337.867 259.048 341.079 252.654 343.927C251.693 344.355 250.562 344.14 249.808 343.386L16.6141 110.192C15.8595 109.438 15.6451 108.307 16.0728 107.346C18.9209 100.952 22.1325 94.7553 25.6814 88.7824C26.5198 87.3714 28.4748 87.1327 29.6613 88.3192L271.681 330.339Z 4 | M299.142 313.842C298.141 314.736 296.606 314.687 295.64 313.721L46.2784 64.3593C45.3129 63.3937 45.2633 61.859 46.1577 60.8578C78.9703 24.1231 126.698 1 179.827 1C278.781 1 359 81.2185 359 180.173C359 233.302 335.877 281.03 299.142 313.842Z 5 | M5.38505 221.254C4.83372 218.903 7.62147 217.274 9.45134 219.104L140.896 350.548C142.726 352.378 141.097 355.166 138.746 354.615C72.7835 339.141 20.8589 287.216 5.38505 221.254Z" 6 | fill="none" stroke="white" stroke-width="1"/> 7 | </svg> ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/durable-objects/user_details.do.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { DurableObject } from 'cloudflare:workers' 2 | import { z } from 'zod' 3 | 4 | import { DurableKVStore } from '../durable-kv-store' 5 | 6 | import type { DurableKVStorageKeys } from '../durable-kv-store' 7 | 8 | // Durable Object for persisting UserDetails in DO storage across sessions based off the userId 9 | export class UserDetails extends DurableObject { 10 | private readonly kv: DurableKVStore<UserDetailsKeys> 11 | constructor(state: DurableObjectState, env: unknown) { 12 | super(state, env) 13 | this.env = env 14 | this.kv = new DurableKVStore({ 15 | state, 16 | prefix: 'meta', 17 | keys: UserDetailsKeys, 18 | }) 19 | } 20 | 21 | public async getActiveAccountId() { 22 | return await this.kv.get('active_account_id') 23 | } 24 | 25 | public async setActiveAccountId(activeAccountId: string) { 26 | this.kv.put('active_account_id', activeAccountId) 27 | } 28 | } 29 | 30 | /** 31 | * Storage keys used by UserDetails 32 | */ 33 | type UserDetailsKeys = typeof UserDetailsKeys 34 | const UserDetailsKeys = { 35 | active_account_id: z.string(), 36 | } as const satisfies DurableKVStorageKeys 37 | 38 | /** Get the UserDetails instance */ 39 | export function getUserDetails( 40 | env: { USER_DETAILS: DurableObjectNamespace<UserDetails> }, 41 | user_id: string 42 | ): DurableObjectStub<UserDetails> { 43 | const id = env.USER_DETAILS.idFromName(user_id) 44 | return env.USER_DETAILS.get(id) 45 | } 46 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/Dockerfile: -------------------------------------------------------------------------------- ```dockerfile 1 | # Use Alpine as base for minimal size 2 | FROM alpine:3.19 as base 3 | 4 | # Install necessary packages while minimizing layers 5 | # We combine commands with && and clean cache in the same layer 6 | # to reduce the image size 7 | RUN apk update && \ 8 | apk add --no-cache \ 9 | # Core utilities 10 | git \ 11 | curl \ 12 | wget \ 13 | # Build essentials 14 | build-base \ 15 | # Python and pip 16 | python3 \ 17 | py3-pip \ 18 | # Node and npm 19 | nodejs \ 20 | npm && \ 21 | # Clean up the cache to reduce image size 22 | rm -rf /var/cache/apk/* && \ 23 | # Create symlink for python 24 | ln -sf /usr/bin/python3 /usr/bin/python 25 | 26 | # Install pnpm in a separate layer for better caching 27 | RUN npm install -g pnpm && \ 28 | rm -rf /root/.npm 29 | 30 | # Set up pnpm environment 31 | ENV PNPM_HOME=/usr/local/bin 32 | ENV PATH=$PNPM_HOME:$PATH 33 | 34 | # Set working directory 35 | WORKDIR /app 36 | 37 | # Set environment variables 38 | ENV PATH="/app/node_modules/.bin:${PATH}" 39 | 40 | ### 41 | # STAGE: PRUNE - Generate a partial monorepo for the sandbox-container app. The output will be placed into a directory named "out" 42 | ### 43 | FROM base AS prune 44 | WORKDIR /app 45 | RUN pnpm install turbo --global 46 | COPY . . 47 | RUN turbo prune containers-starter 48 | 49 | ### 50 | # STAGE: INSTALL & RUN 51 | ### 52 | FROM base AS installer 53 | WORKDIR /app 54 | 55 | COPY --from=prune /app/out/ . 56 | RUN pnpm install --frozen-lockfile --only=production 57 | 58 | WORKDIR /app/apps/sandbox-container 59 | 60 | # Expose the port your Node.js server will run on 61 | EXPOSE 8080 62 | 63 | CMD ["pnpm", "run", "start:container"] 64 | ``` -------------------------------------------------------------------------------- /apps/docs-vectorize/src/docs-vectorize.app.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { McpAgent } from 'agents/mcp' 2 | 3 | import { createApiHandler } from '@repo/mcp-common/src/api-handler' 4 | import { getEnv } from '@repo/mcp-common/src/env' 5 | import { registerPrompts } from '@repo/mcp-common/src/prompts/docs-vectorize.prompts' 6 | import { initSentry } from '@repo/mcp-common/src/sentry' 7 | import { CloudflareMCPServer } from '@repo/mcp-common/src/server' 8 | import { registerDocsTools } from '@repo/mcp-common/src/tools/docs-vectorize.tools' 9 | 10 | import type { Env } from './docs-vectorize.context' 11 | 12 | const env = getEnv<Env>() 13 | 14 | // The docs MCP server isn't stateful, so we don't have state/props 15 | export type Props = never 16 | 17 | export type State = never 18 | 19 | export class CloudflareDocumentationMCP extends McpAgent<Env, State, Props> { 20 | _server: CloudflareMCPServer | undefined 21 | set server(server: CloudflareMCPServer) { 22 | this._server = server 23 | } 24 | get server(): CloudflareMCPServer { 25 | if (!this._server) { 26 | throw new Error('Tried to access server before it was initialized') 27 | } 28 | 29 | return this._server 30 | } 31 | 32 | constructor( 33 | public ctx: DurableObjectState, 34 | public env: Env 35 | ) { 36 | super(ctx, env) 37 | } 38 | 39 | async init() { 40 | const sentry = initSentry(env, this.ctx) 41 | 42 | this.server = new CloudflareMCPServer({ 43 | wae: env.MCP_METRICS, 44 | serverInfo: { 45 | name: env.MCP_SERVER_NAME, 46 | version: env.MCP_SERVER_VERSION, 47 | }, 48 | sentry, 49 | }) 50 | 51 | registerDocsTools(this, this.env) 52 | registerPrompts(this) 53 | } 54 | } 55 | 56 | export default createApiHandler(CloudflareDocumentationMCP) 57 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/api/account.api.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { getProps } from '../get-props' 2 | 3 | import type { Cloudflare } from 'cloudflare' 4 | import type { Account } from 'cloudflare/resources/accounts/accounts.mjs' 5 | import type { CloudflareMcpAgent } from '../types/cloudflare-mcp-agent.types' 6 | import type { ToolHandler } from '../types/tools.types' 7 | 8 | export async function handleAccountsList({ client }: { client: Cloudflare }): Promise<Account[]> { 9 | // Currently limited to 50 accounts 10 | const response = await client.accounts.list({ query: { per_page: 50 } }) 11 | return response.result 12 | } 13 | 14 | export const withAccountCheck = <T extends Record<string, any>>( 15 | agent: CloudflareMcpAgent, 16 | handler: ToolHandler<T> 17 | ) => { 18 | return async (params: T) => { 19 | const accountId = await agent.getActiveAccountId() 20 | if (!accountId) { 21 | return { 22 | content: [ 23 | { 24 | type: 'text' as const, 25 | text: 'No currently active accountId. Try listing your accounts (accounts_list) and then setting an active account (set_active_account)', 26 | }, 27 | ], 28 | } 29 | } 30 | 31 | try { 32 | const props = getProps(agent) 33 | const result = await handler({ 34 | ...params, 35 | accountId, 36 | apiToken: props.accessToken || '', 37 | }) 38 | return { 39 | content: [{ type: 'text' as const, text: JSON.stringify(result) }], 40 | } 41 | } catch (error) { 42 | return { 43 | content: [ 44 | { 45 | type: 'text' as const, 46 | text: JSON.stringify({ 47 | error: `Error processing request: ${error instanceof Error ? error.message : 'Unknown error'}`, 48 | }), 49 | }, 50 | ], 51 | } 52 | } 53 | } 54 | } 55 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/paypal.svg: -------------------------------------------------------------------------------- ``` 1 | 2 | <svg viewBox="0 0 296 360" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 | <!-- First P shape --> 4 | <path d="M44.878 13.781C45.961 6.951 51.837 1.918 58.738 1.918H163.79C199.909 1.918 227.809 9.575 243.174 27.105C250.189 35.11 254.697 43.501 256.956 53.124C259.138 62.42 259.232 72.918 257.396 85.401C254.193 83.784 250.755 82.382 247.104 81.16C246.068 80.817 245.019 80.495 243.954 80.184C241.821 79.56 239.621 78.993 237.356 78.492C235.091 77.981 232.761 77.537 230.36 77.151C221.985 75.801 212.834 75.162 203.04 75.162H120.688C118.516 75.162 116.443 75.656 114.583 76.542C110.497 78.508 107.458 82.386 106.714 87.122L73.057 300.893H9.053C4.134 300.893 0.367 296.49 1.14 291.609L44.878 13.781Z" stroke="white" stroke-width="1"/> 5 | 6 | <!-- Second P shape --> 7 | <path d="M256.119 92.901C249.235 128.32 234.037 152.041 213.136 166.928C192.214 181.831 165.458 187.966 135.312 187.966H104.486C96.593 187.966 89.933 193.724 88.707 201.519L68.447 330.168C67.594 335.567 71.763 340.464 77.223 340.464H131.89C138.849 340.464 144.769 335.392 145.862 328.52L146.392 325.745L146.398 325.713L156.699 260.324L157.36 256.721L157.365 256.697C158.298 250.785 163.387 246.425 169.364 246.425H177.545C204.147 246.425 227.981 241.014 246.709 227.676C265.458 214.322 278.968 193.108 285.065 161.747C290.15 135.571 287.572 113.448 273.897 97.837C269.747 93.106 264.606 89.214 258.645 86.048L257.407 85.39L257.188 86.775C256.871 88.781 256.528 90.81 256.119 92.901Z" stroke="white" stroke-width="1"/> 8 | </svg> ``` -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "@cloudflare/mcp-server-cloudflare", 3 | "version": "1.0.0", 4 | "description": "Monorepo for Cloudflare MCP servers", 5 | "private": true, 6 | "license": "Apache-2.0", 7 | "author": "Cloudflare, Inc. (https://cloudflare.com)", 8 | "homepage": "https://github.com/cloudflare/mcp-server-cloudflare", 9 | "bugs": "https://github.com/cloudflare/mcp-server-cloudflare/issues", 10 | "type": "module", 11 | "sideEffects": false, 12 | "scripts": { 13 | "changeset:new": "run-changeset-new", 14 | "check:deps": "syncpack lint", 15 | "check:format": "prettier . --check --cache --ignore-unknown", 16 | "check:turbo": "run-turbo check", 17 | "types": "run-turbo types", 18 | "test:ci": "run-vitest-ci", 19 | "test": "vitest run --passWithNoTests", 20 | "fix:format": "prettier . --write --cache --ignore-unknown", 21 | "fix:deps": "run-fix-deps", 22 | "test:watch": "vitest", 23 | "eval:ci": "run-turbo eval:ci", 24 | "eval:dev": "run-turbo eval:dev", 25 | "update-deps": "syncpack update" 26 | }, 27 | "devDependencies": { 28 | "@changesets/cli": "2.28.1", 29 | "@cloudflare/vitest-pool-workers": "0.8.14", 30 | "@ianvs/prettier-plugin-sort-imports": "4.4.1", 31 | "@repo/eslint-config": "workspace:*", 32 | "@repo/tools": "workspace:*", 33 | "@repo/typescript-config": "workspace:*", 34 | "@vitest/ui": "3.0.9", 35 | "prettier": "3.5.3", 36 | "syncpack": "13.0.3", 37 | "turbo": "2.5.0", 38 | "typescript": "5.5.4", 39 | "vitest": "3.0.9" 40 | }, 41 | "packageManager": "[email protected]", 42 | "pnpm": { 43 | "onlyBuiltDependencies": [ 44 | "esbuild", 45 | "sharp", 46 | "workerd" 47 | ], 48 | "overrides": { 49 | "esbuild": "0.25.1" 50 | } 51 | } 52 | } 53 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/evals/exec.eval.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { expect } from 'vitest' 2 | import { describeEval } from 'vitest-evals' 3 | 4 | import { runTask } from '@repo/eval-tools/src/runTask' 5 | import { checkFactuality } from '@repo/eval-tools/src/scorers' 6 | import { eachModel } from '@repo/eval-tools/src/test-models' 7 | 8 | import { initializeClient } from './utils' 9 | 10 | eachModel('$modelName', ({ model }) => { 11 | describeEval('Runs a python file in a container', { 12 | data: async () => [ 13 | { 14 | input: 'Create a hello world python script and run it', 15 | expected: `The container_file_write tool was called, containing a file ending in .py.\ 16 | Then the container_file_exec tool was called with python or python3 as one of the arguments`, 17 | }, 18 | ], 19 | task: async (input) => { 20 | const client = await initializeClient() 21 | const { promptOutput, toolCalls } = await runTask(client, model, input) 22 | 23 | expect(toolCalls).toEqual( 24 | expect.arrayContaining([ 25 | expect.objectContaining({ 26 | type: 'tool-call', 27 | toolName: 'container_exec', 28 | args: { 29 | args: expect.objectContaining({ 30 | args: expect.stringContaining('python'), 31 | }), 32 | }, 33 | }), 34 | ]) 35 | ) 36 | 37 | expect(toolCalls).toEqual( 38 | expect.arrayContaining([ 39 | expect.objectContaining({ 40 | type: 'tool-call', 41 | toolName: 'container_file_write', 42 | args: { 43 | args: expect.objectContaining({ 44 | path: expect.stringContaining('.py'), 45 | }), 46 | }, 47 | }), 48 | ]) 49 | ) 50 | 51 | return promptOutput 52 | }, 53 | scorers: [checkFactuality], 54 | threshold: 1, 55 | timeout: 60000, 56 | }) 57 | }) 58 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # @repo/mcp-common 2 | 3 | ## 0.19.3 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | 11 | ## 0.19.2 12 | 13 | ### Patch Changes 14 | 15 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 16 | 17 | ## 0.19.1 18 | 19 | ### Patch Changes 20 | 21 | - 7422e71: Update MCP sdk 22 | - Updated dependencies [7422e71] 23 | - @repo/[email protected] 24 | 25 | ## 0.19.0 26 | 27 | ### Minor Changes 28 | 29 | - 1833c6d: add relative timeframe support for querying 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [cc6d41f] 35 | - @repo/[email protected] 36 | 37 | ## 0.18.0 38 | 39 | ### Minor Changes 40 | 41 | - f885d07: Add search docs tool to bindings and obs servers 42 | 43 | ## 0.17.1 44 | 45 | ### Patch Changes 46 | 47 | - 83e2d19: Pass in type user_token in props during oauth flow 48 | 49 | ## 0.17.0 50 | 51 | ### Minor Changes 52 | 53 | - 6cf52a6: Support AOT tokens 54 | 55 | ### Patch Changes 56 | 57 | - 0fc4439: Update agents and modelcontext dependencies 58 | - Updated dependencies [6cf52a6] 59 | - Updated dependencies [0fc4439] 60 | - @repo/[email protected] 61 | 62 | ## 0.16.3 63 | 64 | ### Patch Changes 65 | 66 | - 3677a18: Remove extraneous log 67 | 68 | ## 0.16.2 69 | 70 | ### Patch Changes 71 | 72 | - 86c2e4f: Add API token passthrough auth 73 | 74 | ## 0.16.1 75 | 76 | ### Patch Changes 77 | 78 | - cf3771b: chore: add suffixes to common files in apps and packages 79 | 80 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 81 | 82 | - @repo/[email protected] 83 | ``` -------------------------------------------------------------------------------- /apps/graphql/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # graphql-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - 86c2e4f: Add API token passthrough auth 80 | - Updated dependencies [86c2e4f] 81 | - @repo/[email protected] 82 | 83 | ## 0.0.2 84 | 85 | ### Patch Changes 86 | 87 | - Updated dependencies [cf3771b] 88 | - @repo/[email protected] 89 | - @repo/[email protected] 90 | ``` -------------------------------------------------------------------------------- /apps/workers-bindings/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "workers-bindings", 3 | "version": "0.4.1", 4 | "private": true, 5 | "scripts": { 6 | "check:lint": "run-eslint-workers", 7 | "check:types": "run-tsc", 8 | "deploy": "run-wrangler-deploy", 9 | "deploy:staging": "wrangler deploy --env staging", 10 | "deploy:production": "wrangler deploy --env production", 11 | "eval:dev": "start-server-and-test --expect 404 eval:server http://localhost:8977 'vitest --testTimeout=60000 --config vitest.config.evals.ts'", 12 | "eval:server": "wrangler dev --var ENVIRONMENT:test --var DEV_DISABLE_OAUTH:true --var DEV_CLOUDFLARE_EMAIL:[email protected] --inspector-port 9230 --port 8977", 13 | "eval:ci": "start-server-and-test --expect 404 eval:server http://localhost:8977 'vitest run --testTimeout=60000 --config vitest.config.evals.ts'", 14 | "dev": "wrangler dev", 15 | "start": "wrangler dev", 16 | "types": "wrangler types --include-env=false", 17 | "test": "vitest" 18 | }, 19 | "devDependencies": { 20 | "@cloudflare/vitest-pool-workers": "0.8.14", 21 | "@types/node": "22.14.1", 22 | "marked": "15.0.7", 23 | "typescript": "5.5.4", 24 | "vitest": "3.0.9", 25 | "wrangler": "4.10.0" 26 | }, 27 | "dependencies": { 28 | "@cloudflare/workers-oauth-provider": "0.0.5", 29 | "@modelcontextprotocol/sdk": "1.18.2", 30 | "@n8n/json-schema-to-zod": "1.1.0", 31 | "@repo/eval-tools": "workspace:*", 32 | "@repo/mcp-common": "workspace:*", 33 | "@repo/mcp-observability": "workspace:*", 34 | "agents": "0.2.7", 35 | "ai": "4.3.10", 36 | "concurrently": "9.1.2", 37 | "hono": "4.7.6", 38 | "start-server-and-test": "2.0.11", 39 | "vitest-evals": "0.1.4", 40 | "zod": "3.24.2" 41 | } 42 | } 43 | ``` -------------------------------------------------------------------------------- /packages/tools/src/changesets.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { cliError, isNotFoundError } from '@jahands/cli-tools' 2 | import { z } from 'zod' 3 | 4 | export type PublishedPackage = z.infer<typeof PublishedPackage> 5 | export const PublishedPackage = z.object({ 6 | name: z.string(), 7 | version: z.string(), 8 | }) 9 | export const PublishedPackages = z.array(PublishedPackage) 10 | 11 | /** 12 | * Reads and parses the list of published packages from the runner's temporary directory. 13 | * This file is generated by the changesets action in the release workflow and contains 14 | * information about packages that were just published. 15 | * @returns Array of published packages 16 | * @throws Error if RUNNER_TEMP is not set, file is not found, or JSON parsing fails 17 | */ 18 | export async function getPublishedPackages(): Promise<PublishedPackage[]> { 19 | const runnerTemp = await z 20 | .string({ error: '$RUNNER_TEMP is not set' }) 21 | .min(1, { error: '$RUNNER_TEMP is empty' }) 22 | .parseAsync(process.env.RUNNER_TEMP) 23 | .catch((e) => { 24 | throw cliError(z.prettifyError(e)) 25 | }) 26 | 27 | const publishedPackagesPath = path.join(runnerTemp, 'published-packages.json') 28 | 29 | echo(chalk.dim(`Reading published packages from ${publishedPackagesPath}`)) 30 | 31 | return fs 32 | .readFile(publishedPackagesPath, 'utf8') 33 | .then((s) => PublishedPackages.parse(JSON.parse(s))) 34 | .catch((e) => { 35 | if (isNotFoundError(e)) { 36 | throw cliError(`No published packages file found at: ${publishedPackagesPath}`) 37 | } else if (e instanceof z.ZodError) { 38 | throw new Error(`Failed to parse published packages: ${z.prettifyError(e)}`) 39 | } 40 | throw new Error(`Failed to parse published packages: ${e}`) 41 | }) 42 | } 43 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/v4-api.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { z } from 'zod' 2 | 3 | type V4ErrorSchema = typeof V4ErrorSchema 4 | const V4ErrorSchema = z.array( 5 | z.object({ 6 | code: z.number().optional(), 7 | message: z.string(), 8 | }) 9 | ) 10 | 11 | export type V4Schema<TResultType extends z.ZodType> = z.ZodObject<{ 12 | result: z.ZodNullable<TResultType> 13 | success: z.ZodBoolean 14 | errors: V4ErrorSchema 15 | messages: z.ZodArray<z.ZodAny> 16 | }> 17 | 18 | export type V4SchemaWithResultInfo< 19 | TResultType extends z.ZodType, 20 | TResultInfoType extends z.ZodType, 21 | > = z.ZodObject<{ 22 | result: z.ZodNullable<TResultType> 23 | success: z.ZodBoolean 24 | errors: V4ErrorSchema 25 | messages: z.ZodArray<z.ZodAny> 26 | result_info: z.ZodOptional<z.ZodNullable<TResultInfoType>> 27 | }> 28 | 29 | export function V4Schema<TResultType extends z.ZodType>( 30 | resultType: TResultType 31 | ): V4Schema<TResultType> 32 | export function V4Schema<TResultType extends z.ZodType, TResultInfoType extends z.ZodType>( 33 | resultType: TResultType, 34 | resultInfoType: TResultInfoType 35 | ): V4SchemaWithResultInfo<TResultType, TResultInfoType> 36 | export function V4Schema<TResultType extends z.ZodType, TResultInfoType extends z.ZodType>( 37 | resultType: TResultType, 38 | resultInfoType?: TResultInfoType 39 | ): V4Schema<TResultType> | V4SchemaWithResultInfo<TResultType, TResultInfoType> { 40 | if (resultInfoType) { 41 | return z.object({ 42 | result: resultType.nullable(), 43 | result_info: resultInfoType.nullable().optional(), 44 | success: z.boolean(), 45 | errors: V4ErrorSchema, 46 | messages: z.array(z.any()), 47 | }) 48 | } else { 49 | return z.object({ 50 | result: resultType.nullable(), 51 | success: z.boolean(), 52 | errors: V4ErrorSchema, 53 | messages: z.array(z.any()), 54 | }) 55 | } 56 | } 57 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/api/workers.api.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { fetchCloudflareApi } from '../cloudflare-api' 2 | import { WorkersService } from '../types/workers.types' 3 | import { V4Schema } from '../v4-api' 4 | 5 | import type { Cloudflare } from 'cloudflare' 6 | 7 | /** 8 | * Fetches list of workers from Cloudflare API 9 | * @param client Cloudflare API Client 10 | * @param accountId Cloudflare account ID 11 | * @returns List of workers 12 | */ 13 | export async function handleWorkersList({ 14 | client, 15 | accountId, 16 | }: { 17 | client: Cloudflare 18 | accountId: string 19 | }): Promise<Cloudflare.Workers.Scripts.Script[]> { 20 | return (await client.workers.scripts.list({ account_id: accountId })).result 21 | } 22 | 23 | /** 24 | * Get details of a worker script from Cloudflare API 25 | * @param client Cloudflare API Client 26 | * @param scriptName Name of the worker script to download 27 | * @param accountId Cloudflare account ID 28 | * @returns The script name and id 29 | */ 30 | export async function handleGetWorkersService({ 31 | apiToken, 32 | scriptName, 33 | accountId, 34 | }: { 35 | apiToken: string 36 | scriptName: string 37 | accountId: string 38 | }) { 39 | return await fetchCloudflareApi({ 40 | endpoint: `/workers/services/${scriptName}`, 41 | accountId, 42 | apiToken, 43 | responseSchema: V4Schema(WorkersService), 44 | }) 45 | } 46 | 47 | /** 48 | * Downloads a specific worker script from Cloudflare API 49 | * @param client Cloudflare API Client 50 | * @param scriptName Name of the worker script to download 51 | * @param accountId Cloudflare account ID 52 | * @returns The worker script content 53 | */ 54 | export async function handleWorkerScriptDownload({ 55 | client, 56 | scriptName, 57 | accountId, 58 | }: { 59 | client: Cloudflare 60 | scriptName: string 61 | accountId: string 62 | }): Promise<string> { 63 | return await client.workers.scripts.get(scriptName, { account_id: accountId }) 64 | } 65 | ``` -------------------------------------------------------------------------------- /apps/demo-day/src/demo-day.app.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { McpAgent } from 'agents/mcp' 2 | 3 | import { getEnv } from '@repo/mcp-common/src/env' 4 | import { CloudflareMCPServer } from '@repo/mcp-common/src/server' 5 | 6 | // The demo day MCP server isn't stateful, so we don't have state/props 7 | export type Props = never 8 | 9 | export type State = never 10 | 11 | export type Env = { 12 | ENVIRONMENT: 'development' | 'staging' | 'production' 13 | AUTORAG_NAME: 'cloudflare-docs-autorag' 14 | MCP_SERVER_NAME: 'PLACEHOLDER' 15 | MCP_SERVER_VERSION: 'PLACEHOLDER' 16 | MCP_OBJECT: DurableObjectNamespace<CloudflareDemoDayMCP> 17 | MCP_METRICS: AnalyticsEngineDataset 18 | ASSETS: Fetcher 19 | } 20 | 21 | const env = getEnv<Env>() 22 | 23 | export class CloudflareDemoDayMCP extends McpAgent<Env, State, Props> { 24 | server = new CloudflareMCPServer({ 25 | wae: env.MCP_METRICS, 26 | serverInfo: { 27 | name: env.MCP_SERVER_NAME, 28 | version: env.MCP_SERVER_VERSION, 29 | }, 30 | }) 31 | 32 | constructor( 33 | public ctx: DurableObjectState, 34 | public env: Env 35 | ) { 36 | super(ctx, env) 37 | } 38 | 39 | async init() { 40 | this.server.tool( 41 | 'mcp_demo_day_info', 42 | "Get information about Cloudflare's MCP Demo Day. Use this tool if the user asks about Cloudflare's MCP demo day", 43 | async () => { 44 | const res = await this.env.ASSETS.fetch('https://assets.local/index.html') 45 | return { 46 | content: [ 47 | { 48 | type: 'resource', 49 | resource: { 50 | uri: 'https://demo-day.mcp.cloudflare.com', 51 | mimeType: 'text/html', 52 | text: await res.text(), 53 | }, 54 | }, 55 | { 56 | type: 'text', 57 | text: "Above is the contents of the demo day webpage, hosted at https://demo-day.mcp.cloudflare.com. Use it to answer the user's questions.", 58 | }, 59 | ], 60 | } 61 | } 62 | ) 63 | } 64 | } 65 | 66 | export default CloudflareDemoDayMCP.mount('/sse') 67 | ``` -------------------------------------------------------------------------------- /apps/cloudflare-one-casb/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # cloudflare-casb-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | 11 | ## 0.1.5 12 | 13 | ### Patch Changes 14 | 15 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 16 | - Updated dependencies [24dd872] 17 | - @repo/[email protected] 18 | 19 | ## 0.1.4 20 | 21 | ### Patch Changes 22 | 23 | - 7422e71: Update MCP sdk 24 | - Updated dependencies [7422e71] 25 | - @repo/[email protected] 26 | 27 | ## 0.1.3 28 | 29 | ### Patch Changes 30 | 31 | - cc6d41f: Update agents deps & modelcontextprotocol 32 | - Updated dependencies [1833c6d] 33 | - Updated dependencies [cc6d41f] 34 | - @repo/[email protected] 35 | 36 | ## 0.1.2 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies [f885d07] 41 | - @repo/[email protected] 42 | 43 | ## 0.1.1 44 | 45 | ### Patch Changes 46 | 47 | - Updated dependencies [83e2d19] 48 | - @repo/[email protected] 49 | 50 | ## 0.1.0 51 | 52 | ### Minor Changes 53 | 54 | - 6cf52a6: Support AOT tokens 55 | 56 | ### Patch Changes 57 | 58 | - 0fc4439: Update agents and modelcontext dependencies 59 | - Updated dependencies [6cf52a6] 60 | - Updated dependencies [0fc4439] 61 | - @repo/[email protected] 62 | 63 | ## 0.0.4 64 | 65 | ### Patch Changes 66 | 67 | - 3677a18: Remove extraneous log 68 | - Updated dependencies [3677a18] 69 | - @repo/[email protected] 70 | 71 | ## 0.0.3 72 | 73 | ### Patch Changes 74 | 75 | - 86c2e4f: Add API token passthrough auth 76 | - Updated dependencies [86c2e4f] 77 | - @repo/[email protected] 78 | 79 | ## 0.0.2 80 | 81 | ### Patch Changes 82 | 83 | - cf3771b: chore: add suffixes to common files in apps and packages 84 | 85 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 86 | 87 | - Updated dependencies [cf3771b] 88 | - @repo/[email protected] 89 | ``` -------------------------------------------------------------------------------- /packages/mcp-common/src/api/workers-builds.api.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { fetchCloudflareApi } from '../cloudflare-api' 2 | import { 3 | GetBuildLogsResult, 4 | GetBuildResult, 5 | ListBuildsByScriptResult, 6 | ListBuildsByScriptResultInfo, 7 | } from '../types/workers-builds.types' 8 | import { V4Schema } from '../v4-api' 9 | 10 | import type { LogLine } from '../types/workers-builds.types' 11 | 12 | export async function listBuilds({ 13 | accountId, 14 | workerId, 15 | page = 1, 16 | perPage = 10, 17 | apiToken, 18 | }: { 19 | accountId: string 20 | workerId: string 21 | page?: number 22 | perPage?: number 23 | apiToken: string 24 | }) { 25 | return fetchCloudflareApi({ 26 | endpoint: `/builds/workers/${workerId}/builds?page=${page}&per_page=${perPage}`, 27 | accountId, 28 | apiToken, 29 | responseSchema: V4Schema(ListBuildsByScriptResult, ListBuildsByScriptResultInfo), 30 | }) 31 | } 32 | 33 | export async function getBuild({ 34 | accountId, 35 | buildUUID, 36 | apiToken, 37 | }: { 38 | accountId: string 39 | buildUUID: string 40 | apiToken: string 41 | }) { 42 | return fetchCloudflareApi({ 43 | endpoint: `/builds/builds/${buildUUID}`, 44 | accountId, 45 | apiToken, 46 | responseSchema: V4Schema(GetBuildResult), 47 | }) 48 | } 49 | 50 | export async function getBuildLogs({ 51 | accountId, 52 | buildUUID, 53 | apiToken, 54 | }: { 55 | accountId: string 56 | buildUUID: string 57 | apiToken: string 58 | }) { 59 | const allLogs: LogLine[] = [] 60 | let cursor: string | undefined = undefined 61 | let hasMore = true 62 | 63 | while (hasMore) { 64 | let endpoint = `/builds/builds/${buildUUID}/logs` 65 | if (cursor) { 66 | endpoint += `?cursor=${cursor}` 67 | } 68 | 69 | const res = await fetchCloudflareApi({ 70 | endpoint, 71 | accountId, 72 | apiToken, 73 | responseSchema: V4Schema(GetBuildLogsResult), 74 | }) 75 | 76 | if (res.result) { 77 | allLogs.push(...res.result.lines) 78 | 79 | if (res.result.cursor && res.result.truncated) { 80 | cursor = res.result.cursor 81 | } else { 82 | hasMore = false 83 | } 84 | } 85 | } 86 | 87 | return allLogs 88 | } 89 | ``` -------------------------------------------------------------------------------- /packages/mcp-observability/src/metrics.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { type ClientCapabilities } from '@modelcontextprotocol/sdk/types.js' 2 | 3 | import { MetricsEvent, MetricsEventIndexIds } from './analytics-engine' 4 | 5 | /** 6 | * TODO: once there are better hooks into MCP servers, we should track the session ID 7 | */ 8 | export class ToolCall extends MetricsEvent { 9 | constructor( 10 | private toolCall: { 11 | userId?: string 12 | toolName: string 13 | errorCode?: number 14 | } 15 | ) { 16 | super() 17 | } 18 | 19 | toDataPoint(): AnalyticsEngineDataPoint { 20 | return { 21 | indexes: [MetricsEventIndexIds.TOOL_CALL], 22 | blobs: this.mapBlobs({ 23 | blob3: this.toolCall.userId, 24 | blob4: this.toolCall.toolName, 25 | }), 26 | doubles: this.mapDoubles({ 27 | double1: this.toolCall.errorCode, 28 | }), 29 | } 30 | } 31 | } 32 | 33 | export class SessionStart extends MetricsEvent { 34 | constructor( 35 | private session: { 36 | userId?: string 37 | clientInfo?: { 38 | name: string 39 | version: string 40 | } 41 | clientCapabilities?: ClientCapabilities 42 | } 43 | ) { 44 | super() 45 | } 46 | 47 | toDataPoint(): AnalyticsEngineDataPoint { 48 | return { 49 | indexes: [MetricsEventIndexIds.SESSION_START], 50 | blobs: this.mapBlobs({ 51 | blob3: this.session.userId, 52 | blob4: this.session.clientInfo?.name, 53 | blob5: this.session.clientInfo?.version, 54 | }), 55 | doubles: this.mapDoubles({ 56 | double1: this.session.clientCapabilities?.roots ? 1 : 0, 57 | double2: this.session.clientCapabilities?.sampling ? 1 : 0, 58 | }), 59 | } 60 | } 61 | } 62 | 63 | export class AuthUser extends MetricsEvent { 64 | constructor( 65 | private authUser: { 66 | userId?: string 67 | errorMessage?: string 68 | } 69 | ) { 70 | super() 71 | } 72 | 73 | toDataPoint(): AnalyticsEngineDataPoint { 74 | return { 75 | indexes: [MetricsEventIndexIds.AUTH_USER], 76 | blobs: this.mapBlobs({ 77 | blob3: this.authUser.userId, 78 | blob4: this.authUser.errorMessage, 79 | }), 80 | } 81 | } 82 | } 83 | ``` -------------------------------------------------------------------------------- /apps/workers-bindings/evals/hyperdrive.eval.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { expect } from 'vitest' 2 | import { describeEval } from 'vitest-evals' 3 | 4 | import { runTask } from '@repo/eval-tools/src/runTask' 5 | import { checkFactuality } from '@repo/eval-tools/src/scorers' 6 | import { eachModel } from '@repo/eval-tools/src/test-models' 7 | import { HYPERDRIVE_TOOLS } from '@repo/mcp-common/src/tools/hyperdrive.tools' 8 | 9 | import { initializeClient } from './utils' // Assuming utils.ts will exist here 10 | 11 | // TODO: Add test for creating hyperdrive config with the following params once we can securely pass parameters to the tool. See: https://github.com/modelcontextprotocol/modelcontextprotocol/pull/382 12 | // const HYPERDRIVE_NAME = 'neon-test-hyperdrive' 13 | // const HYPERDRIVE_DATABASE = 'neondb' 14 | // const HYPERDRIVE_HOST = 'ep-late-cell-a4fm3g5p-pooler.us-east-1.aws.neon.tech' 15 | // const HYPERDRIVE_PORT = 5432 16 | // const HYPERDRIVE_USER = 'neondb_owner' 17 | // const HYPERDRIVE_PASSWORD = 'my-test-password' 18 | 19 | eachModel('$modelName', ({ model }) => { 20 | describeEval('Hyperdrive Tool Evaluations', { 21 | data: async () => [ 22 | { 23 | input: `List my hyperdrive configurations.`, 24 | expected: `The ${HYPERDRIVE_TOOLS.hyperdrive_configs_list} tool should be called to list my hyperdrive configurations.`, 25 | }, 26 | ], 27 | task: async (input: string) => { 28 | const client = await initializeClient(/* Pass necessary mocks/config */) 29 | const { promptOutput, toolCalls } = await runTask(client, model, input) 30 | 31 | const toolCall = toolCalls.find( 32 | (call) => call.toolName === HYPERDRIVE_TOOLS.hyperdrive_configs_list 33 | ) 34 | expect( 35 | toolCall, 36 | `Tool ${HYPERDRIVE_TOOLS.hyperdrive_configs_list} was not called` 37 | ).toBeDefined() 38 | 39 | return promptOutput 40 | }, 41 | scorers: [checkFactuality], 42 | threshold: 1, 43 | timeout: 60000, 44 | }) 45 | }) 46 | ``` -------------------------------------------------------------------------------- /packages/eslint-config/default.cjs: -------------------------------------------------------------------------------- ``` 1 | const { resolve } = require('node:path') 2 | 3 | const project = resolve(process.cwd(), 'tsconfig.json') 4 | 5 | /** @type {import("eslint").Linter.Config} */ 6 | module.exports = { 7 | ignorePatterns: ['.*.{js,cjs}', '**/node_modules/**', '**/dist/**', '**/dist2/**'], 8 | plugins: ['@typescript-eslint', 'import', 'unused-imports'], 9 | extends: ['turbo'], 10 | settings: { 11 | 'import/resolver': { 12 | typescript: { 13 | project, 14 | }, 15 | }, 16 | }, 17 | overrides: [ 18 | // TypeScript 19 | { 20 | // enable the rule specifically for TypeScript files 21 | files: ['**/*.{ts,tsx,mjs}'], 22 | parser: '@typescript-eslint/parser', 23 | parserOptions: { 24 | ecmaVersion: 2024, 25 | sourceType: 'module', 26 | project: true, 27 | }, 28 | extends: [ 29 | 'eslint:recommended', 30 | 'plugin:@typescript-eslint/recommended', 31 | 'plugin:import/typescript', 32 | 'turbo', 33 | 'prettier', // disable rules that conflict with prettier 34 | ], 35 | rules: { 36 | '@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }], 37 | '@typescript-eslint/explicit-function-return-type': 'off', 38 | 'react-hooks/rules-of-hooks': 'off', 39 | '@typescript-eslint/ban-ts-comment': 'off', 40 | '@typescript-eslint/no-floating-promises': 'warn', 41 | 'unused-imports/no-unused-imports': 'warn', 42 | '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }], 43 | '@typescript-eslint/no-unused-vars': [ 44 | 'warn', 45 | { 46 | argsIgnorePattern: '^_', 47 | varsIgnorePattern: '^_', 48 | caughtErrorsIgnorePattern: '^_', 49 | }, 50 | ], 51 | '@typescript-eslint/no-explicit-any': 'off', 52 | 'prefer-const': 'warn', 53 | 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'], 54 | 'no-empty': 'warn', 55 | }, 56 | }, 57 | 58 | // Node 59 | { 60 | files: ['.eslintrc.cjs'], 61 | env: { 62 | node: true, 63 | }, 64 | }, 65 | ], 66 | } 67 | ``` -------------------------------------------------------------------------------- /apps/radar/src/radar.context.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type { RadarMCP, UserDetails } from './radar.app' 2 | 3 | export interface Env { 4 | OAUTH_KV: KVNamespace 5 | ENVIRONMENT: 'development' | 'staging' | 'production' 6 | MCP_SERVER_NAME: string 7 | MCP_SERVER_VERSION: string 8 | CLOUDFLARE_CLIENT_ID: string 9 | CLOUDFLARE_CLIENT_SECRET: string 10 | MCP_OBJECT: DurableObjectNamespace<RadarMCP> 11 | USER_DETAILS: DurableObjectNamespace<UserDetails> 12 | MCP_METRICS: AnalyticsEngineDataset 13 | DEV_DISABLE_OAUTH: string 14 | DEV_CLOUDFLARE_API_TOKEN: string 15 | DEV_CLOUDFLARE_EMAIL: string 16 | } 17 | 18 | export const BASE_INSTRUCTIONS = /* markdown */ ` 19 | # Cloudflare Radar MCP Server 20 | 21 | This server integrates tools powered by the Cloudflare Radar API to provide insights into global Internet traffic, 22 | trends, and other related utilities. 23 | 24 | An active account is **only required** for URL Scanner-related tools (e.g., \`scan_url\`). 25 | 26 | For tools related to Internet trends and insights, analyze the results and, when appropriate, generate visualizations 27 | such as line charts, pie charts, bar charts, stacked area charts, choropleth maps, treemaps, or other relevant chart types. 28 | 29 | ### Making comparisons 30 | 31 | Many tools support **array-based filters** to enable comparisons across multiple criteria. 32 | In such cases, the array index corresponds to a distinct data series. 33 | For each data series, provide a corresponding \`dateRange\`, or alternatively a \`dateStart\` and \`dateEnd\` pair. 34 | Example: To compare HTTP traffic between Portugal and Spain over the last 7 days: 35 | - \`dateRange: ["7d", "7d"]\` 36 | - \`location: ["PT", "ES"]\` 37 | 38 | This applies to date filters and other filters that support comparison across multiple values. 39 | If a tool does **not** support array-based filters, you can achieve the same comparison by making multiple separate 40 | calls to the tool. 41 | ` 42 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/atlassian.svg: -------------------------------------------------------------------------------- ``` 1 | <svg width="360" height="360" viewBox="0 0 360 360" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 | <path d="M105.984 167.061L106.015 167.101L106.049 167.138C129.194 191.788 144.778 224.83 151.273 258.534C157.769 292.244 155.156 326.525 142.022 353.67L142.016 353.682C141.265 355.289 140.062 356.642 138.554 357.575C137.046 358.508 135.299 358.981 133.527 358.935L133.515 358.935H133.502H10.7182H10.7151C9.23699 358.94 7.77879 358.594 6.4598 357.927L6.45595 357.925C4.19542 356.793 2.47638 354.809 1.67691 352.409C0.877449 350.009 1.06301 347.39 2.19275 345.127C2.19278 345.127 2.19281 345.127 2.19285 345.127L90.3202 168.711L90.3237 168.704L90.327 168.697C90.9615 167.377 91.8885 166.218 93.0374 165.31C94.9874 163.831 97.4428 163.185 99.8675 163.512C102.295 163.839 104.495 165.115 105.984 167.061Z" stroke="white" stroke-width="1"/> 3 | <path d="M172.393 6.45857L172.555 6.21014V6.09531C173.28 4.65453 174.384 3.43639 175.748 2.5722C177.175 1.66894 178.828 1.18945 180.516 1.18945C182.204 1.18945 183.857 1.66894 185.284 2.5722C186.71 3.47547 187.851 4.76544 188.574 6.29215L188.578 6.30179L188.583 6.31132L357.893 345.12C357.894 345.122 357.895 345.123 357.895 345.124C358.546 346.453 358.883 347.913 358.882 349.393V349.396C358.885 350.649 358.64 351.891 358.162 353.05C357.684 354.209 356.982 355.262 356.096 356.148C355.21 357.035 354.158 357.737 353 358.215C351.842 358.694 350.601 358.938 349.349 358.935H349.346H226.588C224.818 358.935 223.082 358.441 221.577 357.509C220.071 356.577 218.854 355.244 218.062 353.659L217.168 354.106L218.062 353.659L158.867 235.194C158.866 235.193 158.866 235.192 158.865 235.191C141.114 199.162 133.027 159.135 135.399 119.036C137.77 78.936 150.518 40.1415 172.393 6.45857Z" stroke="white" stroke-width="1"/> 4 | </svg> 5 | ``` -------------------------------------------------------------------------------- /apps/demo-day/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # demo-day 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - Updated dependencies [86c2e4f] 80 | - @repo/[email protected] 81 | 82 | ## 0.0.2 83 | 84 | ### Patch Changes 85 | 86 | - cf3771b: chore: add suffixes to common files in apps and packages 87 | 88 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 89 | 90 | - Updated dependencies [cf3771b] 91 | - @repo/[email protected] 92 | - @repo/[email protected] 93 | ``` -------------------------------------------------------------------------------- /apps/docs-autorag/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # docs-autorag 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - Updated dependencies [86c2e4f] 80 | - @repo/[email protected] 81 | 82 | ## 0.0.2 83 | 84 | ### Patch Changes 85 | 86 | - cf3771b: chore: add suffixes to common files in apps and packages 87 | 88 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 89 | 90 | - Updated dependencies [cf3771b] 91 | - @repo/[email protected] 92 | - @repo/[email protected] 93 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/canva.svg: -------------------------------------------------------------------------------- ``` 1 | <svg width="304" height="420" viewBox="0 0 304 420" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 | <path d="M290.187 321.595L290.135 321.647L290.09 321.707C272.996 344.813 250.906 368.88 221.814 386.92L221.807 386.924L221.8 386.928C193.664 404.999 161.592 419 123.543 419C88.5958 419 59.5943 401.035 43.5799 386.037C19.595 363.071 6.56214 330.071 2.55014 299.011C-3.46858 250.902 8.31751 194.948 33.0794 144.089C57.8401 93.2326 95.5276 47.57 141.198 19.9928L141.207 19.9872C162.216 6.99381 185.221 1 207.219 1C251.089 1 283.907 31.8603 287.883 69.6012L287.885 69.6134C289.882 86.5751 287.629 102.223 280.185 115.981C272.741 129.739 260.059 141.695 241.048 151.192L241.039 151.196L241.03 151.201C231.515 156.204 224.336 158.41 219.222 158.897C214.092 159.385 211.264 158.136 210.051 156.544C208.424 154.07 209.148 149.624 212.859 146.843L212.878 146.829L212.897 146.813C230.644 132.122 239.862 118.62 244.092 104.404C248.313 90.2184 247.531 75.4369 245.513 58.3003L245.512 58.2912L245.511 58.282C242.443 35.8101 228.045 21.1583 211.251 21.1583C193.508 21.1583 173.937 31.0955 154.851 47.5566C135.741 64.0391 116.994 87.1669 100.886 113.799C68.6873 167.035 46.9037 234.492 53.9966 291.198C56.5334 313.493 64.6501 337.6 79.2817 356.159C93.9361 374.746 115.13 387.763 143.706 387.763C162.02 387.763 182.34 382.685 199.616 373.549C219.299 363.464 233.485 354.864 245.664 344.725C257.846 334.583 267.982 322.931 279.602 306.78C281.129 304.745 282.652 302.462 284.156 300.208L284.165 300.195C285.681 297.924 287.177 295.682 288.669 293.694L288.724 293.622L288.764 293.541C290.534 290.004 294.089 289.058 296.943 289.058C299.416 289.058 303 291.632 303 296.115C303 298.979 302.031 304.78 298.179 309.591L298.112 309.674L298.065 309.768C297.048 311.8 294.088 317.697 290.187 321.595Z" stroke="white" stroke-width="1"/> 3 | </svg> 4 | ``` -------------------------------------------------------------------------------- /apps/radar/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # cloudflare-radar-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - 86c2e4f: Add API token passthrough auth 80 | - Updated dependencies [86c2e4f] 81 | - @repo/[email protected] 82 | 83 | ## 0.0.2 84 | 85 | ### Patch Changes 86 | 87 | - cf3771b: chore: add suffixes to common files in apps and packages 88 | 89 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 90 | 91 | - Updated dependencies [cf3771b] 92 | - @repo/[email protected] 93 | - @repo/[email protected] 94 | ``` -------------------------------------------------------------------------------- /apps/autorag/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # cloudflare-autorag-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - 86c2e4f: Add API token passthrough auth 80 | - Updated dependencies [86c2e4f] 81 | - @repo/[email protected] 82 | 83 | ## 0.0.2 84 | 85 | ### Patch Changes 86 | 87 | - cf3771b: chore: add suffixes to common files in apps and packages 88 | 89 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 90 | 91 | - Updated dependencies [cf3771b] 92 | - @repo/[email protected] 93 | - @repo/[email protected] 94 | ``` -------------------------------------------------------------------------------- /apps/browser-rendering/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # cloudflare-browser-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - 86c2e4f: Add API token passthrough auth 80 | - Updated dependencies [86c2e4f] 81 | - @repo/[email protected] 82 | 83 | ## 0.0.2 84 | 85 | ### Patch Changes 86 | 87 | - cf3771b: chore: add suffixes to common files in apps and packages 88 | 89 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 90 | 91 | - Updated dependencies [cf3771b] 92 | - @repo/[email protected] 93 | - @repo/[email protected] 94 | ``` -------------------------------------------------------------------------------- /apps/ai-gateway/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # cloudflare-ai-gateway-mcp-server 2 | 3 | ## 0.1.6 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.5 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.4 21 | 22 | ### Patch Changes 23 | 24 | - 7422e71: Update MCP sdk 25 | - Updated dependencies [7422e71] 26 | - @repo/[email protected] 27 | - @repo/[email protected] 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - cc6d41f: Update agents deps & modelcontextprotocol 34 | - Updated dependencies [1833c6d] 35 | - Updated dependencies [cc6d41f] 36 | - @repo/[email protected] 37 | - @repo/[email protected] 38 | 39 | ## 0.1.2 40 | 41 | ### Patch Changes 42 | 43 | - Updated dependencies [f885d07] 44 | - @repo/[email protected] 45 | 46 | ## 0.1.1 47 | 48 | ### Patch Changes 49 | 50 | - Updated dependencies [83e2d19] 51 | - @repo/[email protected] 52 | 53 | ## 0.1.0 54 | 55 | ### Minor Changes 56 | 57 | - 6cf52a6: Support AOT tokens 58 | 59 | ### Patch Changes 60 | 61 | - 0fc4439: Update agents and modelcontext dependencies 62 | - Updated dependencies [6cf52a6] 63 | - Updated dependencies [0fc4439] 64 | - @repo/[email protected] 65 | - @repo/[email protected] 66 | 67 | ## 0.0.4 68 | 69 | ### Patch Changes 70 | 71 | - 3677a18: Remove extraneous log 72 | - Updated dependencies [3677a18] 73 | - @repo/[email protected] 74 | 75 | ## 0.0.3 76 | 77 | ### Patch Changes 78 | 79 | - 86c2e4f: Add API token passthrough auth 80 | - Updated dependencies [86c2e4f] 81 | - @repo/[email protected] 82 | 83 | ## 0.0.2 84 | 85 | ### Patch Changes 86 | 87 | - cf3771b: chore: add suffixes to common files in apps and packages 88 | 89 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 90 | 91 | - Updated dependencies [cf3771b] 92 | - @repo/[email protected] 93 | - @repo/[email protected] 94 | ``` -------------------------------------------------------------------------------- /apps/sandbox-container/server/containerManager.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { DurableObject } from 'cloudflare:workers' 2 | 3 | import { getEnv } from '@repo/mcp-common/src/env' 4 | import { MetricsTracker } from '@repo/mcp-observability' 5 | 6 | import { ContainerEvent } from './metrics' 7 | 8 | import type { Env } from './sandbox.server.context' 9 | 10 | const env = getEnv<Env>() 11 | export class ContainerManager extends DurableObject<Env> { 12 | metrics = new MetricsTracker(env.MCP_METRICS, { 13 | name: env.MCP_SERVER_NAME, 14 | version: env.MCP_SERVER_VERSION, 15 | }) 16 | 17 | constructor( 18 | public ctx: DurableObjectState, 19 | public env: Env 20 | ) { 21 | super(ctx, env) 22 | } 23 | 24 | async trackContainer(id: string) { 25 | await this.ctx.storage.put(id, new Date()) 26 | } 27 | 28 | async killContainer(id: string) { 29 | await this.ctx.storage.delete(id) 30 | } 31 | 32 | async tryKillOldContainers() { 33 | const activeContainers = await this.ctx.storage.list<Date>() 34 | for (const c of activeContainers) { 35 | const id = c[0] 36 | const now = new Date() 37 | const time = c[1] 38 | 39 | console.log(id, time, now, now.valueOf() - time.valueOf()) 40 | 41 | // 15m timeout for container lifetime 42 | if (now.valueOf() - time.valueOf() > 15 * 60 * 1000) { 43 | await this.killContainer(id) 44 | // TODO: Figure out why we were running in to invalid durable object id the id does not match this durable object class error 45 | const doId = this.env.USER_CONTAINER.idFromString(id) 46 | const stub = this.env.USER_CONTAINER.get(doId) 47 | await stub.destroyContainer() 48 | } 49 | } 50 | } 51 | 52 | async listActive(): Promise<string[]> { 53 | const activeContainers = await this.ctx.storage.list() 54 | const activeIds: string[] = [] 55 | for (const c of activeContainers.keys()) { 56 | activeIds.push(c) 57 | } 58 | 59 | this.metrics.logEvent( 60 | new ContainerEvent({ 61 | active: activeIds.length, 62 | }) 63 | ) 64 | 65 | return activeIds 66 | } 67 | } 68 | 69 | export function getContainerManager(env: Env): DurableObjectStub<ContainerManager> { 70 | const id = env.CONTAINER_MANAGER.idFromName('manager') 71 | return env.CONTAINER_MANAGER.get(id) 72 | } 73 | ``` -------------------------------------------------------------------------------- /packages/tools/src/tsconfig.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { inspect } from 'node:util' 2 | 3 | import type { 4 | convertCompilerOptionsFromJson, 5 | createProgram, 6 | readConfigFile, 7 | sys, 8 | CompilerOptions as TSCompilerOptions, 9 | } from 'typescript' 10 | 11 | export type { TSCompilerOptions } 12 | 13 | interface TSModule { 14 | readConfigFile: typeof readConfigFile 15 | convertCompilerOptionsFromJson: typeof convertCompilerOptionsFromJson 16 | sys: typeof sys 17 | createProgram: typeof createProgram 18 | } 19 | 20 | /** 21 | * TypeScript helpers. This is a class so that we can dynamically import the TypeScript module 22 | * to reduce runx start time for commands that don't use the typescript package. 23 | * 24 | * @example 25 | * 26 | * ```ts 27 | * const tsHelpers = await new TSHelpers().init() 28 | * const { ts } = tsHelpers 29 | * const tsConfig = tsHelpers.getTSConfig() 30 | * ts.createProgram(entryPoints, tsConfig).emit() 31 | * ``` 32 | */ 33 | export class TSHelpers { 34 | #ts: TSModule | undefined 35 | public get ts(): TSModule { 36 | if (!this.#ts) { 37 | throw new Error('TSHelpers not initialized. Call init() first.') 38 | } 39 | return this.#ts 40 | } 41 | 42 | async init(): Promise<TSHelpers> { 43 | this.#ts = (await import('typescript')) as TSModule 44 | return this 45 | } 46 | 47 | getTSConfig(configPath = 'tsconfig.json'): TSCompilerOptions { 48 | const jsonCompopts = this.getCompilerOptionsJSONFollowExtends(configPath) 49 | const tmp = this.ts.convertCompilerOptionsFromJson(jsonCompopts, '') 50 | if (tmp.errors.length > 0) { 51 | throw new Error(`failed parse config: ${inspect(tmp)}`) 52 | } 53 | const tsCompopts: TSCompilerOptions = tmp.options 54 | return tsCompopts 55 | } 56 | 57 | getCompilerOptionsJSONFollowExtends(configPath: string): { 58 | [key: string]: unknown 59 | } { 60 | let compopts = {} 61 | const config = this.ts.readConfigFile(configPath, this.ts.sys.readFile).config 62 | if (config.extends !== undefined) { 63 | const rqrpath = require.resolve(config.extends) 64 | compopts = this.getCompilerOptionsJSONFollowExtends(rqrpath) 65 | } 66 | return { 67 | ...compopts, 68 | ...config.compilerOptions, 69 | } 70 | } 71 | } 72 | ``` -------------------------------------------------------------------------------- /apps/workers-bindings/evals/accounts.eval.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { expect } from 'vitest' 2 | import { describeEval } from 'vitest-evals' 3 | 4 | import { runTask } from '@repo/eval-tools/src/runTask' 5 | import { checkFactuality } from '@repo/eval-tools/src/scorers' 6 | import { eachModel } from '@repo/eval-tools/src/test-models' 7 | 8 | import { initializeClient } from './utils' // Assuming utils.ts will exist here 9 | 10 | // Define a mock account ID for testing 11 | const MOCK_ACCOUNT_ID = 'mock-account-12345' 12 | 13 | eachModel('$modelName', ({ model }) => { 14 | describeEval('List Cloudflare Accounts', { 15 | data: async () => [ 16 | { 17 | input: 'List all my Cloudflare accounts.', 18 | expected: 'The accounts_list tool should be called to retrieve the list of accounts.', 19 | }, 20 | ], 21 | task: async (input: string) => { 22 | const client = await initializeClient() 23 | const { promptOutput, toolCalls } = await runTask(client, model, input) 24 | 25 | const toolCall = toolCalls.find((call) => call.toolName === 'accounts_list') 26 | expect(toolCall, 'Tool accounts_list was not called').toBeDefined() 27 | return promptOutput 28 | }, 29 | scorers: [checkFactuality], 30 | threshold: 1, 31 | timeout: 60000, // 60 seconds 32 | }) 33 | describeEval('Set Active Cloudflare Account', { 34 | data: async () => [ 35 | { 36 | input: `Set my active Cloudflare account to ${MOCK_ACCOUNT_ID}.`, 37 | expected: `The set_active_account tool should be called with the account ID ${MOCK_ACCOUNT_ID}.`, 38 | }, 39 | ], 40 | task: async (input: string) => { 41 | const client = await initializeClient() 42 | const { promptOutput, toolCalls } = await runTask(client, model, input) 43 | const toolCall = toolCalls.find((call) => call.toolName === 'set_active_account') 44 | expect(toolCall, 'Tool set_active_account was not called').toBeDefined() 45 | 46 | expect(toolCall?.args, 'Arguments for set_active_account did not match').toEqual( 47 | expect.objectContaining({ activeAccountIdParam: MOCK_ACCOUNT_ID }) 48 | ) 49 | return promptOutput 50 | }, 51 | scorers: [checkFactuality], 52 | threshold: 1, 53 | timeout: 60000, // 60 seconds 54 | }) 55 | }) 56 | ``` -------------------------------------------------------------------------------- /apps/logpush/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # logpush 2 | 3 | ## 0.1.7 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.6 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.5 21 | 22 | ### Patch Changes 23 | 24 | - dffbd36: Use proper wrangler deploy in all servers so we get the name and version 25 | 26 | ## 0.1.4 27 | 28 | ### Patch Changes 29 | 30 | - 7422e71: Update MCP sdk 31 | - Updated dependencies [7422e71] 32 | - @repo/[email protected] 33 | - @repo/[email protected] 34 | 35 | ## 0.1.3 36 | 37 | ### Patch Changes 38 | 39 | - cc6d41f: Update agents deps & modelcontextprotocol 40 | - Updated dependencies [1833c6d] 41 | - Updated dependencies [cc6d41f] 42 | - @repo/[email protected] 43 | - @repo/[email protected] 44 | 45 | ## 0.1.2 46 | 47 | ### Patch Changes 48 | 49 | - Updated dependencies [f885d07] 50 | - @repo/[email protected] 51 | 52 | ## 0.1.1 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies [83e2d19] 57 | - @repo/[email protected] 58 | 59 | ## 0.1.0 60 | 61 | ### Minor Changes 62 | 63 | - 6cf52a6: Support AOT tokens 64 | 65 | ### Patch Changes 66 | 67 | - 0fc4439: Update agents and modelcontext dependencies 68 | - Updated dependencies [6cf52a6] 69 | - Updated dependencies [0fc4439] 70 | - @repo/[email protected] 71 | - @repo/[email protected] 72 | 73 | ## 0.0.4 74 | 75 | ### Patch Changes 76 | 77 | - 3677a18: Remove extraneous log 78 | - Updated dependencies [3677a18] 79 | - @repo/[email protected] 80 | 81 | ## 0.0.3 82 | 83 | ### Patch Changes 84 | 85 | - 86c2e4f: Add API token passthrough auth 86 | - Updated dependencies [86c2e4f] 87 | - @repo/[email protected] 88 | 89 | ## 0.0.2 90 | 91 | ### Patch Changes 92 | 93 | - cf3771b: chore: add suffixes to common files in apps and packages 94 | 95 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 96 | 97 | - Updated dependencies [cf3771b] 98 | - @repo/[email protected] 99 | - @repo/[email protected] 100 | ``` -------------------------------------------------------------------------------- /apps/auditlogs/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # auditlogs 2 | 3 | ## 0.1.7 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.6 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.5 21 | 22 | ### Patch Changes 23 | 24 | - dffbd36: Use proper wrangler deploy in all servers so we get the name and version 25 | 26 | ## 0.1.4 27 | 28 | ### Patch Changes 29 | 30 | - 7422e71: Update MCP sdk 31 | - Updated dependencies [7422e71] 32 | - @repo/[email protected] 33 | - @repo/[email protected] 34 | 35 | ## 0.1.3 36 | 37 | ### Patch Changes 38 | 39 | - cc6d41f: Update agents deps & modelcontextprotocol 40 | - Updated dependencies [1833c6d] 41 | - Updated dependencies [cc6d41f] 42 | - @repo/[email protected] 43 | - @repo/[email protected] 44 | 45 | ## 0.1.2 46 | 47 | ### Patch Changes 48 | 49 | - Updated dependencies [f885d07] 50 | - @repo/[email protected] 51 | 52 | ## 0.1.1 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies [83e2d19] 57 | - @repo/[email protected] 58 | 59 | ## 0.1.0 60 | 61 | ### Minor Changes 62 | 63 | - 6cf52a6: Support AOT tokens 64 | 65 | ### Patch Changes 66 | 67 | - 0fc4439: Update agents and modelcontext dependencies 68 | - Updated dependencies [6cf52a6] 69 | - Updated dependencies [0fc4439] 70 | - @repo/[email protected] 71 | - @repo/[email protected] 72 | 73 | ## 0.0.4 74 | 75 | ### Patch Changes 76 | 77 | - 3677a18: Remove extraneous log 78 | - Updated dependencies [3677a18] 79 | - @repo/[email protected] 80 | 81 | ## 0.0.3 82 | 83 | ### Patch Changes 84 | 85 | - 86c2e4f: Add API token passthrough auth 86 | - Updated dependencies [86c2e4f] 87 | - @repo/[email protected] 88 | 89 | ## 0.0.2 90 | 91 | ### Patch Changes 92 | 93 | - cf3771b: chore: add suffixes to common files in apps and packages 94 | 95 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 96 | 97 | - Updated dependencies [cf3771b] 98 | - @repo/[email protected] 99 | - @repo/[email protected] 100 | ``` -------------------------------------------------------------------------------- /apps/dns-analytics/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # dns-analytics 2 | 3 | ## 0.1.7 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.6 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.5 21 | 22 | ### Patch Changes 23 | 24 | - dffbd36: Use proper wrangler deploy in all servers so we get the name and version 25 | 26 | ## 0.1.4 27 | 28 | ### Patch Changes 29 | 30 | - 7422e71: Update MCP sdk 31 | - Updated dependencies [7422e71] 32 | - @repo/[email protected] 33 | - @repo/[email protected] 34 | 35 | ## 0.1.3 36 | 37 | ### Patch Changes 38 | 39 | - cc6d41f: Update agents deps & modelcontextprotocol 40 | - Updated dependencies [1833c6d] 41 | - Updated dependencies [cc6d41f] 42 | - @repo/[email protected] 43 | - @repo/[email protected] 44 | 45 | ## 0.1.2 46 | 47 | ### Patch Changes 48 | 49 | - Updated dependencies [f885d07] 50 | - @repo/[email protected] 51 | 52 | ## 0.1.1 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies [83e2d19] 57 | - @repo/[email protected] 58 | 59 | ## 0.1.0 60 | 61 | ### Minor Changes 62 | 63 | - 6cf52a6: Support AOT tokens 64 | 65 | ### Patch Changes 66 | 67 | - 0fc4439: Update agents and modelcontext dependencies 68 | - Updated dependencies [6cf52a6] 69 | - Updated dependencies [0fc4439] 70 | - @repo/[email protected] 71 | - @repo/[email protected] 72 | 73 | ## 0.0.4 74 | 75 | ### Patch Changes 76 | 77 | - 3677a18: Remove extraneous log 78 | - Updated dependencies [3677a18] 79 | - @repo/[email protected] 80 | 81 | ## 0.0.3 82 | 83 | ### Patch Changes 84 | 85 | - 86c2e4f: Add API token passthrough auth 86 | - Updated dependencies [86c2e4f] 87 | - @repo/[email protected] 88 | 89 | ## 0.0.2 90 | 91 | ### Patch Changes 92 | 93 | - cf3771b: chore: add suffixes to common files in apps and packages 94 | 95 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 96 | 97 | - Updated dependencies [cf3771b] 98 | - @repo/[email protected] 99 | - @repo/[email protected] 100 | ``` -------------------------------------------------------------------------------- /apps/workers-builds/CHANGELOG.md: -------------------------------------------------------------------------------- ```markdown 1 | # workers-builds 2 | 3 | ## 0.1.7 4 | 5 | ### Patch Changes 6 | 7 | - 43f493d: Update agent + modelcontextprotocol deps 8 | - Updated dependencies [43f493d] 9 | - @repo/[email protected] 10 | - @repo/[email protected] 11 | 12 | ## 0.1.6 13 | 14 | ### Patch Changes 15 | 16 | - 24dd872: feat: Add MCP tool titles and hints to all Cloudflare tools 17 | - Updated dependencies [24dd872] 18 | - @repo/[email protected] 19 | 20 | ## 0.1.5 21 | 22 | ### Patch Changes 23 | 24 | - dffbd36: Use proper wrangler deploy in all servers so we get the name and version 25 | 26 | ## 0.1.4 27 | 28 | ### Patch Changes 29 | 30 | - 7422e71: Update MCP sdk 31 | - Updated dependencies [7422e71] 32 | - @repo/[email protected] 33 | - @repo/[email protected] 34 | 35 | ## 0.1.3 36 | 37 | ### Patch Changes 38 | 39 | - cc6d41f: Update agents deps & modelcontextprotocol 40 | - Updated dependencies [1833c6d] 41 | - Updated dependencies [cc6d41f] 42 | - @repo/[email protected] 43 | - @repo/[email protected] 44 | 45 | ## 0.1.2 46 | 47 | ### Patch Changes 48 | 49 | - Updated dependencies [f885d07] 50 | - @repo/[email protected] 51 | 52 | ## 0.1.1 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies [83e2d19] 57 | - @repo/[email protected] 58 | 59 | ## 0.1.0 60 | 61 | ### Minor Changes 62 | 63 | - 6cf52a6: Support AOT tokens 64 | 65 | ### Patch Changes 66 | 67 | - 0fc4439: Update agents and modelcontext dependencies 68 | - Updated dependencies [6cf52a6] 69 | - Updated dependencies [0fc4439] 70 | - @repo/[email protected] 71 | - @repo/[email protected] 72 | 73 | ## 0.0.4 74 | 75 | ### Patch Changes 76 | 77 | - 3677a18: Remove extraneous log 78 | - Updated dependencies [3677a18] 79 | - @repo/[email protected] 80 | 81 | ## 0.0.3 82 | 83 | ### Patch Changes 84 | 85 | - 86c2e4f: Add API token passthrough auth 86 | - Updated dependencies [86c2e4f] 87 | - @repo/[email protected] 88 | 89 | ## 0.0.2 90 | 91 | ### Patch Changes 92 | 93 | - cf3771b: chore: add suffixes to common files in apps and packages 94 | 95 | It can be confusing switching between 16 files named 'index.ts', or 3 files named workers.ts. This change renames common files to have suffixes such as .types.ts, .api.ts, etc. to make it easier to work across files in the monorepo. 96 | 97 | - Updated dependencies [cf3771b] 98 | - @repo/[email protected] 99 | - @repo/[email protected] 100 | ``` -------------------------------------------------------------------------------- /apps/demo-day/frontend/public/sentry.svg: -------------------------------------------------------------------------------- ``` 1 | <svg width="492" height="442" viewBox="0 0 492 442" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 | <path d="M484.774 415.775C493.975 399.801 492.903 379.593 481.831 360.377L292.421 31.2701C281.349 12.0383 264.446 1 246.059 1C227.654 1 210.74 12.0383 199.683 31.2701L141.245 132.747C155.754 140.9 169.621 150.146 182.725 160.404C252.509 215.006 299.53 297.485 307.013 391.018H270.318C263.099 311.013 223.255 240.341 164.253 192.49C151.325 181.997 137.516 172.636 122.98 164.514L54.5168 283.409C69.398 291.394 82.7652 301.83 94.2089 314.159C113.628 335.151 127.189 361.655 132.332 391.031L71.021 391.003C69.4149 391.002 67.8246 390.686 66.3411 390.07C64.8576 389.455 63.51 388.554 62.3755 387.417C61.2409 386.281 60.3417 384.932 59.7292 383.448C59.1167 381.964 58.803 380.374 58.806 378.769C58.8124 376.73 59.3184 374.724 60.2798 372.926L75.7505 346.587C64.3269 334.228 50.9285 323.85 36.1023 315.879L10.1487 360.335C-0.923664 379.566 -1.9955 399.759 7.20502 415.733C16.3921 431.72 34.3683 440.889 56.5245 440.889H182.932C183.825 433.164 184.348 425.302 184.348 417.355C184.348 408.434 183.716 399.663 182.587 391.045C176.357 343.303 153.443 300.77 119.872 269.54L139.017 236.299C183.454 274.831 213.63 329.433 220.367 391.045C221.33 399.692 221.852 408.461 221.852 417.355C221.852 425.302 221.426 433.135 220.683 440.889H357.047C357.529 433.095 357.858 425.259 357.858 417.355C357.858 408.49 357.447 399.745 356.842 391.045C349.071 279.093 292.283 180.489 207.811 116.842L235.606 68.5515C236.691 66.7488 238.223 65.2571 240.054 64.2213C241.886 63.1855 243.954 62.6408 246.059 62.6402C248.218 62.6387 250.338 63.2122 252.202 64.3016C254.065 65.391 255.605 66.9569 256.662 68.8384L431.715 372.955C432.679 374.751 433.184 376.757 433.185 378.795C433.185 385.56 427.726 391.045 420.974 391.045L393.508 391.071C394.113 399.787 394.524 408.53 394.524 417.383C394.524 425.288 394.195 433.135 393.699 440.918H435.455C457.611 440.918 475.587 431.762 484.774 415.775Z" stroke="white" stroke-width="1"/> 3 | </svg> 4 | ```