Build a SERP MCP Server: Live Search in Claude & Cursor
I spent a weekend wiring up a Model Context Protocol server so Claude Desktop and Cursor could pull live Google results into any conversation. The first time Claude asked — without me prompting it — "let me check the latest version of that library" and came back with real, current docs, I knew the whole "AI knowledge cutoff" complaint was about to become a non-issue.
This guide walks you through the exact build. By the end you will have a tiny Node.js MCP server that exposes serp.search as a callable tool, wired into both Claude Desktop and Cursor, with real Google results powering whatever the model is doing.
What is MCP, in one minute
Model Context Protocol is an open standard from Anthropic. Think of it as USB-C for AI clients — one socket, many tools.
An MCP server exposes one or more tools (functions the model can call), resources (read-only data the model can fetch), and prompts (reusable prompt templates). An MCP client — Claude Desktop, Claude Code, Cursor, or any compatible app — discovers what the server offers and lets the model decide when to call which tool.
The protocol speaks JSON-RPC 2.0 over stdio or HTTP/SSE. For local desktop integrations, stdio is the default and the easiest to ship.
Why give your AI a search tool
Three reasons that turned up the moment I installed mine:
1. The knowledge cutoff disappears. Claude doesn't have to guess at 2026 library APIs — it queries Google, reads the snippet, and answers from real text on the live web.
2. Citations come for free. Every search returns URLs. The model naturally hyperlinks its claims, which is what you want for any "is this safe to merge" or "is this still best practice" question.
3. Coding agents stop fabricating CVEs. When Cursor wants to know if a dependency has a known vulnerability, it actually checks the NVD listing instead of guessing from the training corpus. Same goes for "is package X maintained?" questions.
If you want a deeper read on why coding agents specifically benefit, see our breakdown on SERP APIs for AI coding agents and the math behind LangChain agent search costs.
Prerequisites
- Node.js 20+ installed
- A Serpent API key — sign up free, 100 calls included, no card
- Claude Desktop and/or Cursor installed
- 5 minutes of focused time
Set your API key as an env var so we never hard-code it:
export SERPENT_API_KEY="sk_live_your_key_here"
Step 1: Write the MCP server
Create a fresh folder and install the official TypeScript SDK:
mkdir serp-mcp && cd serp-mcp
npm init -y
npm install @modelcontextprotocol/sdk zod
Now drop the whole server into server.js. It is 60 lines including comments — MCP is genuinely small once you've seen one.
#!/usr/bin/env node
// SERP MCP server — exposes Google search as a tool
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
const API_KEY = process.env.SERPENT_API_KEY;
if (!API_KEY) {
console.error("Missing SERPENT_API_KEY");
process.exit(1);
}
const server = new Server(
{ name: "serp-mcp", version: "0.1.0" },
{ capabilities: { tools: {} } }
);
// 1. Tell the client what tools we offer
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: "serp_search",
description:
"Run a live Google search and return the top organic results, including title, URL, and snippet.",
inputSchema: {
type: "object",
properties: {
query: { type: "string", description: "Search query" },
num: { type: "number", description: "Results to return (1-10)", default: 10 },
country: { type: "string", description: "ISO country code", default: "us" },
},
required: ["query"],
},
},
],
}));
// 2. Handle a tool call
server.setRequestHandler(CallToolRequestSchema, async (req) => {
if (req.params.name !== "serp_search") {
throw new Error("Unknown tool: " + req.params.name);
}
const { query, num = 10, country = "us" } = req.params.arguments ?? {};
const url = new URL("https://apiserpent.com/api/search/quick");
url.searchParams.set("q", query);
url.searchParams.set("num", String(num));
url.searchParams.set("country", country);
const r = await fetch(url, { headers: { "X-API-Key": API_KEY } });
if (!r.ok) throw new Error(`Serpent API ${r.status}`);
const data = await r.json();
const results = (data?.results?.organic ?? []).map((x) =>
`${x.position}. ${x.title}\n ${x.url}\n ${x.snippet ?? ""}`
).join("\n\n");
return { content: [{ type: "text", text: results || "No results." }] };
});
const transport = new StdioServerTransport();
await server.connect(transport);
That's the whole server. Add "type": "module" to package.json, then mark the file executable:
chmod +x server.js
Quick sanity check — pipe a JSON-RPC handshake into it:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node server.js
You should see a JSON line back listing serp_search. If yes, the server is healthy.
Don't have an API key yet? The Serpent Google SERP API ships with 100 free calls on signup — enough to test this MCP server end-to-end without spending a cent. Grab a key →
Step 2: Register it in Claude Desktop
Claude Desktop reads servers from a config file on disk. The exact location depends on your OS — Anthropic's MCP docs have the full table, but on macOS it lives at:
~/Library/Application Support/Claude/claude_desktop_config.json
Open it and merge in this block (create the file if it doesn't exist):
{
"mcpServers": {
"serp": {
"command": "node",
"args": ["/absolute/path/to/serp-mcp/server.js"],
"env": {
"SERPENT_API_KEY": "sk_live_your_key_here"
}
}
}
}
Save, quit Claude Desktop fully (it must restart for the config to load), and reopen. You should now see a small tools icon in the chat input. Click it and serp_search will be listed.
Try a test prompt: "What was announced at Google I/O 2026?" — Claude should call serp_search, get back fresh results, and answer from those.
Step 3: Register it in Cursor
Cursor uses the same MCP standard but reads from its own settings file at ~/.cursor/mcp.json (or via Settings → MCP in the UI).
{
"mcpServers": {
"serp": {
"command": "node",
"args": ["/absolute/path/to/serp-mcp/server.js"],
"env": { "SERPENT_API_KEY": "sk_live_your_key_here" }
}
}
}
Restart Cursor. Open the agent panel (Cmd-L on macOS) and ask: "Find me the latest Express 5 release notes and summarise breaking changes." The model will reach for serp_search, hand back the linked release notes, then summarise. No hallucinated changelog — just the real one.
Step 4: Test the end-to-end flow
Here is the prompt I use to stress-test a fresh install:
"Search Google for 'best vector database 2026', then for each of the top 3 results, search again for '<product name> pricing' and tabulate the prices."
This forces the model to chain 4 tool calls in sequence. If it works, your server is healthy and ready to ship. If a call returns "No results.", double-check the API key env var and that you have free credits available on the dashboard.
Extending the server: news, images, AI Rank
The single-tool version is a great start, but the Serpent platform exposes a lot more surface. A few useful extensions, each <10 extra lines:
Add a news tool
Duplicate serp_search as serp_news and point it at /api/news instead. Useful for "what happened today with X" questions. See the News API endpoint reference for the response shape.
Add an image-search tool
Same pattern against /api/images. Cursor users love this when they want a reference screenshot of a UI library before mocking up a component.
Add an AI Ranking tool
Wire up /api/ai/rank so the model can answer questions like "is my domain cited when ChatGPT is asked about prompt caching?" Documentation lives on the AI Rank API page.
Add structured output
MCP supports a resource primitive in addition to tools. If you want to expose, say, a weekly cached search log as a resource the model can read, return it via ReadResourceRequestSchema. The TypeScript SDK examples have a few working patterns.
Troubleshooting common errors
"MCP server failed to start." Check the absolute path in the config. Tilde expansion (~) does not work in JSON. Use the full path returned by pwd.
"Tool returns empty text." The query produced no results. Try a generic test query like q=hello+world first to confirm the API call itself is succeeding. If you see "credits exhausted", upgrade or wait for the daily free-tier reset.
"Claude/Cursor doesn't list the tool." The client only re-reads the config on full restart — not on window close. Quit the app entirely (Cmd-Q on macOS) and reopen.
"Logs are silent." Anything you console.error() from inside the server shows up in the client's MCP log panel — that's the safest place to put debug output. Don't use console.log() — stdout is reserved for the JSON-RPC stream and will break the transport.
Going beyond one search per minute? The free tier covers experimentation; paid plans start at $0.05 per 1,000 deep-search calls with no monthly minimum. Compare options on the pricing page.
What I changed in my own workflow after a week with this
I stopped opening a browser tab to check "is my code still the right way to do this in 2026?" The model just checks. I stopped pasting Stack Overflow answers into chat — the model finds the canonical doc itself. And I stopped accepting the "as of my training cutoff" hedge as an answer.
The same pattern works for non-coding work. If you want to see how a similar primitive plugs into retrieval pipelines, our RAG real-time search tutorial walks through the LangChain side. If you want to skip MCP and use a thinner integration directly inside Cursor, see our companion piece on grounding Cursor with live SERP results.
FAQ
What is an MCP server?
An MCP server is a small process that exposes tools, resources, or prompts over the Model Context Protocol. AI clients like Claude Desktop or Cursor discover what the server offers and let the model invoke tools during a chat.
Why use a SERP MCP server instead of a plain API call?
An MCP server lets the AI decide when to search, without you copy-pasting URLs or writing tool-use prompts. Install once, every session gets live web access.
Does the same server work in both Claude Desktop and Cursor?
Yes. Both clients consume the same MCP standard. Drop the same binary into each app's config file and you are done.
Do I need a paid API key?
No. Serpent's free tier gives 100 quick-search calls, which is plenty to verify the MCP integration. Deep search, images, news, and AI Rank tools need paid credits but start at $0.05 per 1,000 calls.
Can I deploy this server to a host so a team uses it remotely?
Yes, but switch the transport from StdioServerTransport to the SSE/HTTP variants in the SDK and put it behind auth. The MCP spec describes the remote transport pattern.
Wire Up Your AI to Live Google Results
Serpent API powers SERP MCP servers, AI agents, and RAG pipelines from $0.05 per 1,000 Google requests — the cheapest SERP API in the world. 100 free calls on signup, no card.
Get Your Free API KeyExplore: Google SERP API · AI Rank API · Playground · Docs


