feat: add Web Search MCP server (stateless, /mcp, OAuth + API token)#383
Open
G4brym wants to merge 1 commit into
Open
feat: add Web Search MCP server (stateless, /mcp, OAuth + API token)#383G4brym wants to merge 1 commit into
G4brym wants to merge 1 commit into
Conversation
8e63bcb to
b08df33
Compare
f41f54b to
5ed0d64
Compare
mattzcarey
reviewed
Jun 1, 2026
| "mcpServers": { | ||
| "cloudflare": { | ||
| "command": "npx", | ||
| "args": ["mcp-remote", "https://websearch.mcp.cloudflare.com/mcp"] |
Collaborator
There was a problem hiding this comment.
pls dont use mcp-remote now
mattzcarey
reviewed
Jun 1, 2026
Comment on lines
+1
to
+5
| import type { TestEnv } from './vitest.config' | ||
|
|
||
| declare module 'cloudflare:test' { | ||
| interface ProvidedEnv extends TestEnv {} | ||
| } |
Collaborator
There was a problem hiding this comment.
this might need to change with the upgrade to vitest 4
mattzcarey
reviewed
Jun 1, 2026
| "kv_namespaces": [ | ||
| { | ||
| "binding": "OAUTH_KV", | ||
| "id": "REPLACE_WITH_WEBSEARCH_PRODUCTION_OAUTH_KV_ID" |
mattzcarey
reviewed
Jun 1, 2026
| .describe('Maximum number of results to return (up to 20).') | ||
|
|
||
| export function registerWebSearchTools(server: McpServer) { | ||
| server.tool( |
Collaborator
There was a problem hiding this comment.
if you use the same account logic as the other servers that would be awesome.
80e6dcf to
0962fde
Compare
0962fde to
b77f7f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new Web Search MCP server (
apps/websearch), deployed atwebsearch.mcp.cloudflare.com.Design
createMcpHandler(a freshMcpServerper request); no Durable Objects, noUserDetails, no session state./mcponly — streamable HTTP; no/sse.accounts_list/set_active_account. Theweb_searchtool takes anaccount_idparameter instead, so an agent can connect and search immediately./authorize,/token,/register,.well-known/*) so tokenless clients get the OAuth flow.Bearertoken, OAuth is skipped and the token is used directly against the Web Search API. (OAuth-issued tokens are detected viaisApiTokenRequestand still flow through the OAuth provider.)web_searchis gated behind thewebsearch.runOAuth scope; reads the access token viagetMcpAuthContext().Dependencies
agentsbumped to0.13.3(forcreateMcpHandler/getMcpAuthContext), with@modelcontextprotocol/sdk@1.29.0+zod@3.25.76to match. Scoped to this app only — no other server's versions change.Validation
pnpm -F websearch check:types✅pnpm -F websearch check:lint✅prettier --check✅wrangler deploy --dry-run✅ (bundles cleanly)TODO before deploy
McpServerrather thanCloudflareMCPServer, because the shared@repo/mcp-commonis pinned tozod 3.24.2/SDK 1.20.2 and can't be bumped without changing the other servers.TODO(RAG-1300)to add stateless-server support toCloudflareMCPServer/metrics so this server can report tool-call metrics (and per-useruserIdviagetMcpAuthContext).OAUTH_KVids areREPLACE_WITH_*placeholders pending infra.