Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cloudflare/mcp
/ functions
Functions
369 in github.com/cloudflare/mcp
⨍
Functions
369
◇
Types & classes
469
↓ 86 callers
Method
get
(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>)
worker-configuration.d.ts:1873
↓ 53 callers
Method
json
()
worker-configuration.d.ts:2026
↓ 40 callers
Method
replace
(content: string | ReadableStream | Response, options?: ContentOptions)
worker-configuration.d.ts:1578
↓ 37 callers
Function
seedSpec
(paths: SpecPaths, products: string[] = ['workers'])
tests/helpers/spec.ts:15
↓ 32 callers
Function
buildInputSchema
( operation: OperationInfo, path: string )
src/openapi.ts:278
↓ 32 callers
Function
createServer
(props: AuthProps, codemode = true)
src/server.ts:10
↓ 30 callers
Function
callTool
( token: string, name: string, args: Record<string, unknown> | null, options?: { method: 'tools/list'
tests/helpers/mcp.ts:62
↓ 20 callers
Function
cfSuccess
(result: unknown)
tests/helpers/cloudflare-api.ts:8
↓ 20 callers
Method
fetch
(request: Request)
worker-configuration.d.ts:520
↓ 19 callers
Function
acctProps
(accountId: string)
tests/non-codemode.test.ts:568
↓ 18 callers
Method
error
* The **`console.error()`** static method outputs a message to the console at the 'error' log level. * * [MDN Reference](https://developer.m
worker-configuration.d.ts:192
↓ 18 callers
Function
getUserAndAccounts
( accessToken: string, caller = 'oauth_callback_identity_probe' )
src/auth/oauth-handler.ts:372
↓ 17 callers
Function
fetchWithRetry
( input: RequestInfo, init?: RequestInit, options?: RetryOptions )
src/utils/fetch-retry.ts:37
↓ 16 callers
Function
guardRefreshTokenExchange
( kv: KVNamespace, refreshToken: string, refresh: () => Promise<TokenExchangeCallbackResult | undefined>
src/auth/oauth-handler.ts:215
↓ 16 callers
Function
mockIdentityProbe
(opts: { user?: { id: string; email: string } | null accounts: Array<{ id: string; name: string }> })
tests/helpers/cloudflare-api.ts:37
↓ 15 callers
Function
mockProbes
Register MSW handlers for the two identity-probe endpoints by path.
tests/auth/oauth-handler.test.ts:20
↓ 15 callers
Function
sanitizeHtml
* Sanitizes HTML content to prevent XSS attacks
src/auth/workers-oauth-utils.ts:224
↓ 15 callers
Function
userToken
(overrides: Partial<Extract<AuthProps, { type: 'user_token' }>>)
tests/auth/account-access.test.ts:18
↓ 14 callers
Function
computeRetryDelay
( attempt: number, opts: Required<Omit<RetryOptions, 'caller'>>, retryAfterHeader?: string | null )
src/utils/fetch-retry.ts:17
↓ 14 callers
Function
pathToToolName
(method: string, path: string)
src/openapi.ts:55
↓ 14 callers
Method
put
(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions)
worker-configuration.d.ts:1888
↓ 14 callers
Method
text
()
worker-configuration.d.ts:2025
↓ 13 callers
Function
mockFetchJson
(data: unknown, ok = true)
tests/non-codemode.test.ts:587
↓ 13 callers
Function
mockRequest
* Helper to create a mock Request with given Authorization header
tests/auth/api-token-mode.test.ts:18
↓ 12 callers
Function
accountList
(n: number)
tests/auth/account-access.test.ts:28
↓ 12 callers
Method
toString
()
worker-configuration.d.ts:531
↓ 12 callers
Function
toolText
(result: McpToolResult)
tests/helpers/mcp.ts:77
↓ 12 callers
Function
truncateResponse
(content: unknown)
src/truncate.ts:5
↓ 11 callers
Method
logEvent
(event: MetricsEvent)
src/metrics.ts:195
↓ 11 callers
Function
resolveRefs
( obj: unknown, spec: Record<string, unknown>, seen = new Set<string>() )
src/spec-processor.ts:18
↓ 10 callers
Function
buildAuthProps
( token: string, user?: { id: string; email: string } | null, accounts?: Array<{ id: string; name: strin
src/auth/api-token-mode.ts:136
↓ 10 callers
Method
warn
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level. * * [MDN Reference](https://de
worker-configuration.d.ts:259
↓ 9 callers
Function
beginAuthorization
(options: { state?: string; scopes?: string } = {})
tests/auth/oauth-routes.test.ts:44
↓ 9 callers
Function
cfAccountsSuccess
(result: Array<{ id: string; name: string }>)
tests/helpers/cloudflare-api.ts:13
↓ 9 callers
Function
isMultiAccountUser
(props?: AuthProps)
src/auth/account-access.ts:57
↓ 9 callers
Method
log
* The **`console.log()`** static method outputs a message to the console. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/con
worker-configuration.d.ts:222
↓ 8 callers
Function
isDirectApiToken
(request: Request)
src/auth/api-token-mode.ts:56
↓ 8 callers
Method
toHtmlResponse
()
src/auth/workers-oauth-utils.ts:70
↓ 7 callers
Method
delete
(key: Key)
worker-configuration.d.ts:1903
↓ 7 callers
Function
processSpec
(spec: Record<string, unknown>)
src/spec-processor.ts:62
↓ 7 callers
Method
set
* Set a new stored value
worker-configuration.d.ts:9707
↓ 6 callers
Function
autoResolvedAccountId
(props?: AuthProps)
src/auth/account-access.ts:38
↓ 6 callers
Function
buildNonCodemodeTools
( paths: Record<string, Record<string, OperationInfo>> )
src/openapi.ts:186
↓ 6 callers
Function
clearKv
(kv: KVNamespace)
tests/helpers/kv.ts:6
↓ 6 callers
Function
extractBearerToken
(request: Request)
src/auth/api-token-mode.ts:70
↓ 6 callers
Function
extractProduct
(path: string)
src/spec-processor.ts:8
↓ 6 callers
Method
list
(options?: KVNamespaceListOptions)
worker-configuration.d.ts:1887
↓ 6 callers
Method
toDataPoint
()
src/metrics.ts:150
↓ 5 callers
Function
callNonCodemodeTool
POST a non-codemode tools/call to the real worker.
tests/non-codemode-worker.test.ts:63
↓ 5 callers
Function
fetch
(request: Request, env: Env, ctx: ExecutionContext)
src/index.ts:67
↓ 5 callers
Function
generatePKCECodes
()
src/auth/cloudflare-auth.ts:45
↓ 5 callers
Function
isSingleAccountUser
(props?: AuthProps)
src/auth/account-access.ts:29
↓ 5 callers
Function
runScheduled
()
tests/index.test.ts:37
↓ 4 callers
Function
accountTokenId
(props?: AuthProps)
src/auth/account-access.ts:24
↓ 4 callers
Function
clearSpec
()
tests/helpers/spec.ts:29
↓ 4 callers
Method
close
()
worker-configuration.d.ts:3174
↓ 4 callers
Function
createMcpResponse
* Create an MCP response for the authenticated session described by `props`.
src/index.ts:23
↓ 4 callers
Function
extractProducts
(spec: Record<string, unknown>)
src/spec-processor.ts:98
↓ 4 callers
Function
extractTitle
(filename: string)
src/tools/docs-search.ts:181
↓ 4 callers
Function
formatError
(error: unknown)
src/utils/errors.ts:9
↓ 4 callers
Function
getAuthToken
(params: { client_id: string client_secret: string redirect_uri: string code: string code_verifier:
src/auth/cloudflare-auth.ts:105
↓ 4 callers
Function
hasIncompleteLegacyAccountList
(props: UserToken)
src/auth/account-access.ts:49
↓ 4 callers
Function
inlineableAccounts
(props?: AuthProps)
src/auth/account-access.ts:68
↓ 4 callers
Function
parseMcpResult
(res: Response)
tests/helpers/mcp.ts:51
↓ 4 callers
Function
refreshCallback
(refreshToken = 'old-refresh-token', getHelpers?: () => OAuthHelpers)
tests/auth/oauth-handler.test.ts:598
↓ 4 callers
Function
renderErrorPage
( title: string, message: string, details?: string, status = 400 )
src/auth/workers-oauth-utils.ts:1595
↓ 4 callers
Function
runExecute
Run an `execute` tool call whose code hits `path`, with MSW returning `body`.
tests/executor.test.ts:28
↓ 4 callers
Function
sourceToUrl
(filename: string)
src/tools/docs-search.ts:170
↓ 4 callers
Function
toolError
(message: string)
src/tools/non-codemode.ts:130
↓ 4 callers
Function
toolNameToTitle
(name: string)
src/openapi.ts:86
↓ 4 callers
Function
useCloudflareAuthSuccess
()
tests/auth/oauth-routes.test.ts:88
↓ 4 callers
Function
writtenEvents
Index1 values of every datapoint written via the spied MCP_METRICS binding.
tests/auth/oauth-routes.test.ts:120
↓ 3 callers
Function
authErrorMessage
Format an unknown thrown value into a stable `auth_user` error message.
src/auth/oauth-handler.ts:59
↓ 3 callers
Function
authorizeUrl
(params: Record<string, string>)
tests/auth/oauth-routes.test.ts:38
↓ 3 callers
Method
connect
* Connect directly to Hyperdrive as if it's your database, returning a TCP socket. * * Calling this method returns an identical socket to if
worker-configuration.d.ts:9721
↓ 3 callers
Function
expectAuthTokenOAuthError
Run the REAL getAuthToken against an MSW-mocked upstream `response`.
tests/auth/cloudflare-auth.test.ts:54
↓ 3 callers
Function
findToolCall
(spy: ReturnType<typeof vi.spyOn>)
tests/metrics.test.ts:121
↓ 3 callers
Function
fresh
(entry: Entry<T> | undefined, now: number)
src/isolate-cache.ts:28
↓ 3 callers
Function
handleApiTokenRequest
( request: Request, createMcpResponse: (props: AuthProps) => Promise<Response> )
src/auth/api-token-mode.ts:80
↓ 3 callers
Function
logRefreshTelemetry
* Structured, greppable telemetry for refresh failures. Logged as a single JSON * line prefixed with `[refresh-telemetry]` so it can be counted in Wo
src/auth/oauth-handler.ts:128
↓ 3 callers
Function
mcpToolCallRequest
( token: string, name: string, args: Record<string, unknown>, id = 1 )
tests/helpers/mcp.ts:27
↓ 3 callers
Function
registerDocsTool
(server: McpServer)
src/tools/docs-search.ts:109
↓ 3 callers
Function
resetIsolateCache
()
src/isolate-cache.ts:90
↓ 3 callers
Function
runGraphql
(body: unknown)
tests/executor.test.ts:114
↓ 3 callers
Method
values
(options?: ReadableStreamValuesOptions)
worker-configuration.d.ts:2228
↓ 2 callers
Method
append
(content: string | ReadableStream | Response, options?: ContentOptions)
worker-configuration.d.ts:1551
↓ 2 callers
Function
base64urlEncode
(value: string)
src/auth/cloudflare-auth.ts:33
↓ 2 callers
Function
bindStateToSession
(stateToken: string)
src/auth/workers-oauth-utils.ts:1564
↓ 2 callers
Function
cfError
(errors: Array<{ code: number; message: string }>, result: unknown = null)
tests/helpers/cloudflare-api.ts:26
↓ 2 callers
Function
clearR2
(bucket: R2Bucket)
tests/helpers/r2.ts:6
↓ 2 callers
Function
cookiesFrom
Collapse a response's Set-Cookie header(s) into a Cookie request header.
tests/auth/oauth-routes.test.ts:109
↓ 2 callers
Function
createOAuthState
( oauthReqInfo: AuthRequest, kv: KVNamespace, codeVerifier: string )
src/auth/workers-oauth-utils.ts:1549
↓ 2 callers
Function
errorCodeOf
(e: unknown)
src/metrics.ts:243
↓ 2 callers
Function
expectRefreshOAuthError
Run the REAL refreshAuthToken against an MSW-mocked upstream `response`.
tests/auth/cloudflare-auth.test.ts:41
↓ 2 callers
Function
formatDocsResults
(results: DocsSearchResult[])
src/tools/docs-search.ts:156
↓ 2 callers
Function
getApprovedClientsFromCookie
* Parses the signed cookie and verifies its integrity.
src/auth/workers-oauth-utils.ts:139
↓ 2 callers
Function
getAuthorizationURL
(params: { client_id: string redirect_uri: string stateToken: string scopes: string[] codeChallenge:
src/auth/cloudflare-auth.ts:69
↓ 2 callers
Method
getEntrypoint
(name?: string, options?: WorkerStubEntrypointOptions)
worker-configuration.d.ts:3339
↓ 2 callers
Function
getNonCodemodeTools
()
src/isolate-cache.ts:56
↓ 2 callers
Function
getSpec
()
src/isolate-cache.ts:37
next →
1–100 of 369, ranked by callers