Build a remote MCP server for web search: tools, auth and review-ready metadata
Design a remote MCP server for web search: tool set, auth, a TypeScript example, tool-selection tips and the checks to pass before you submit.
Build a remote MCP server for web search
Short answer: a web search server needs two or three distinct tools, no authentication, explicit annotations with openWorldHint true, and descriptions that say what comes back (titles, URLs, snippets), how fresh it is and what it is not for.
Basis: the MCP specification, the official TypeScript SDK docs (v2, package @modelcontextprotocol/server, read 2026-12-04) and our scanner rule pages. Tool sets are our recommendation, not a requirement. Anything marked (unverified) is not confirmed in those sources.
Recommended tool set
One general search tool beats ten near-identical ones. Add a news variant only if its results differ in kind.
search_web
- Title: Search the web
- Description: see the example below.
- Input:
querystring, required;recencyenum day, week, month, any (default any);limitinteger 1 to 10 (default 5);regionstring, optional ISO country code - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHinttrue
search_news
- Title: Search news
- Description: "Use this for news articles from the last 30 days. Returns up to 10 items with headline, outlet, publication time and URL. Not for evergreen reference questions; use search_web for those."
- Input:
querystring, required;daysinteger 1 to 30 (default 7);limitinteger 1 to 10 - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHinttrue
get_search_suggestions
- Title: Suggest related queries
- Description: "Use this to get up to 8 related search phrases for a topic when a query returned too little or too much."
- Input:
querystring, required - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHinttrue
Annotations are hints, not security (see annotations explained). Here openWorldHint is true only where a tool reaches arbitrary outside parties, and false for a fixed domain. Search reaches the open web, so openWorldHint stays true.
Auth
Recommendation: no authentication. This is public read-only data, which the checks accept. Hold any upstream key on your server so no user ever types one (schema.secret-param). Add no write tools to a no-auth server, because auth.write-tools-unauthenticated warns when it lists create, update or delete tools. Without sign-in your protection is rate limiting and bounded results; see rate limits and 429s.
Transport
Serve Streamable HTTP on one HTTPS path such as https://mcp.example.com/mcp (auth.https). In the v2 SDK, createMcpHandler(factory) builds a fresh McpServer for every request, so the endpoint is stateless and needs no sticky sessions (sessions and serverless). The handler checks no Host, Origin or token itself, so put those checks in front of it. Still on SSE? See the migration guide. Keep the handshake fast (latency.handshake).
Minimal TypeScript example
This targets SDK v2; coming from v1, use the SDK's migration guide. In v2 inputSchema is a z.object(...). Replace lookup with your own code.
import { createMcpHandler, McpServer } from '@modelcontextprotocol/server';
import * as z from 'zod/v4';
const handler = createMcpHandler(() => {
const server = new McpServer({ name: 'acme-search', version: '1.0.0' });
server.registerTool(
'search_web',
{
title: "Search the web",
description:
"Use this to find current web pages for a question. Returns up to 10 results with title, URL and a short snippet, newest-first when recency is set. Does not open pages or search private data; use fetch_page to read a result.",
inputSchema: z.object({
query: z.string().describe('What to search for, as a plain-language query'),
recency: z.enum(['day', 'week', 'month', 'any']).default('any'),
limit: z.number().int().min(1).max(10).default(5)
}),
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true }
},
async (args) => {
const result = await lookup(args); // your upstream call
if (!result) return { isError: true, content: [{ type: 'text', text: 'No results for this query. Try fewer or broader words.' }] };
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
}
);
return server;
});
export default handler; // web-standard runtimes; wrap with toNodeHandler on Node
The error text tells the model what to try next, which errors.unhelpful-message rewards. lookup must return titles, URLs and snippets only.
Errors, size and speed
Return isError: true with text that says what was wrong and how to fix it; messages such as "Internal Server Error" fail review (errors.unhelpful-message). Reviewers run every tool with valid input and reject failures (errors.fixture-failed). Keep a call under 3 seconds where you can: the scanner warns above 3 and fails above 15 (latency.tool-call). For slower work see tool timeouts, cap result size (response size limits) and never echo keys or tokens in output (errors.secrets-in-output). Run the same calls in CI so a regression never reaches review.
Getting models to pick your tools
The leaderboard method shows the model every tool in the category as a function named <server>__<tool>, with your description and input schema, and records the first tool it calls. Your name, description and schema are the whole pitch. In the December 4 2026 run, 2.8% (3 of 108) of web search trials ended with no tool called. Search is a crowded category, so wording matters: name the output ("titles, URLs and snippets"), the freshness and the limit. Put the user's own words in the description ("find", "latest", "look up online") so indirect requests match. Keep search_web and search_news visibly different, since near-duplicate descriptions split a model's choice. Limits apply: the harness is offline, uses one model family, and measures selection, not correct answers. Rewrite method and prompt sets are in writing tool descriptions models pick; write about your own task and sibling tools, never about other servers (desc.injection-directive).
Pitfalls our rules catch
- Wrapping everything in one
querytool trips catchall.generic-executor. - Marketing words and credit or plan text trip desc.promotional and desc.pricing-mention.
- Search results are untrusted text. Never copy snippets into tool metadata, and avoid "always call this first" (desc.injection-directive).
- Cold starts on the handshake fail latency.handshake.
Submission checklist
- Run the scan at https://mcpshipyard.com/scan and clear every blocker.
- Every tool has
title, a description, aninputSchemaand explicitreadOnlyHint,destructiveHintandopenWorldHint(annotations explained). - Reproduce the failures in works in Inspector, fails in Claude before you submit.
- Claude: walk the Claude connector directory submission checklist.
- ChatGPT: walk the ChatGPT app submission checklist.
- Optional listings: Grok Build (formerly Cursor) and the official registry.
- Set up monitoring before launch.
- Description states result fields, freshness and the 10 result cap.
- No tool takes an upstream search key as a parameter.
Check your server against these rules at https://mcpshipyard.com/scan.
Check your server against these rules
Scan runs the checks from this guide against a live URL and lists each failing rule with its fix.