Tutorial

How to Ground a Coding Agent with Live Web Search

Add live web search to any coding agent via MCP. Give your agent access to current documentation, package versions, and API references.

Coding agents hallucinate API signatures, recommend deprecated packages, and miss breaking changes because their training data is static. Adding live web search via MCP gives any coding agent access to current documentation, changelogs, and community discussions. The agent can verify its suggestions against real search results before writing code. This tutorial shows how to add a Scavio MCP search server to your coding agent, configure it to search before coding, and verify that generated code matches current API docs. You will have a coding agent that checks live docs before suggesting solutions.

Prerequisites

  • A coding agent (Claude Code, Cursor, Codex, or similar)
  • A Scavio API key from scavio.dev
  • MCP support in your agent

Walkthrough

Step 1: Add the MCP search server

Configure the Scavio MCP server in your agent's configuration.

Python
# Add to your agent's MCP config (.mcp.json or equivalent):
# {
#   "mcpServers": {
#     "scavio": {
#       "url": "https://mcp.scavio.dev/mcp",
#       "headers": {
#         "x-api-key": "YOUR_SCAVIO_API_KEY"
#       }
#     }
#   }
# }

Step 2: Configure search-before-code behavior

Set up instructions that tell the agent to verify docs before writing code.

Python
# Agent instructions (CLAUDE.md, .cursorrules, or system prompt):
# Before using any API or library:
# 1. Search for the current documentation
# 2. Verify the API signature matches the latest version
# 3. Check for breaking changes or deprecations
# 4. Use the verified API in your code

Step 3: Test with a documentation lookup

Verify the search integration works by looking up a current API.

Python
import os, requests

API_KEY = os.environ["SCAVIO_API_KEY"]
resp = requests.post("https://api.scavio.dev/api/v1/search",
    headers={"x-api-key": API_KEY},
    json={"platform": "google", "query": "Next.js 15 server actions documentation 2026"})
for r in resp.json().get("organic_results", [])[:3]:
    print(f"{r['title']}")
    print(f"  {r.get('link','')}")

Step 4: Verify code accuracy

Have the agent write code and verify it matches current documentation.

Python
# Example workflow:
# 1. Ask agent: "Write a Next.js server action for form submission"
# 2. Agent searches: "Next.js 15 server actions form handling"
# 3. Agent finds current docs and API signatures
# 4. Agent writes code that matches the latest API
# 5. No hallucinated imports or deprecated patterns

# Test the search that the agent would run:
resp = requests.post("https://api.scavio.dev/api/v1/search",
    headers={"x-api-key": API_KEY},
    json={"platform": "google", "query": "Next.js 15 server action form submission example"})
results = resp.json().get("organic_results", [])[:3]
for r in results:
    print(f"{r['title']}: {r.get('link','')}")

Python Example

Python
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
def check_docs(query):
    resp = requests.post("https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": "google", "query": query})
    return [{"title": r["title"], "url": r.get("link","")}
            for r in resp.json().get("organic_results",[])[:3]]

for doc in check_docs("Next.js 15 server actions docs"):
    print(doc["title"], doc["url"])

JavaScript Example

JavaScript
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
async function checkDocs(query) {
  const r = await fetch("https://api.scavio.dev/api/v1/search", {
    method: "POST", headers: H,
    body: JSON.stringify({platform: "google", query})
  });
  return (await r.json()).organic_results || [];
}
checkDocs("Next.js 15 server actions docs").then(rs =>
  rs.slice(0,3).forEach(r => console.log(r.title, r.link))
);

Expected Output

JSON
A coding agent configured with MCP web search that verifies documentation and API signatures against live search results before generating code.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

A coding agent (Claude Code, Cursor, Codex, or similar). A Scavio API key from scavio.dev. MCP support in your agent. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Add live web search to any coding agent via MCP. Give your agent access to current documentation, package versions, and API references.