Tutorial

How to Ground Cursor Agent with Live Search

Ground Cursor agent responses with live web data via MCP. Reduce hallucinations by giving the agent access to current documentation and search results.

Cursor's AI agent generates code and answers questions based on your codebase and its training data, but it can hallucinate about current API versions, library changes, and best practices. Grounding the agent with live web search reduces these errors by giving it access to current documentation and community discussions. This tutorial shows how to add the Scavio MCP server to Cursor so the agent can verify information against live search results. The setup takes under two minutes and dramatically improves the accuracy of agent responses for current topics.

Prerequisites

  • Cursor IDE installed (v0.40+)
  • A Scavio API key from scavio.dev
  • MCP support enabled in Cursor

Walkthrough

Step 1: Add MCP configuration to Cursor

Create or edit the MCP configuration file to add the Scavio search server.

Python
# Create .cursor/mcp.json in your project root:
# {
#   "mcpServers": {
#     "scavio": {
#       "url": "https://mcp.scavio.dev/mcp",
#       "headers": {
#         "x-api-key": "your_scavio_api_key"
#       }
#     }
#   }
# }

Step 2: Restart Cursor and verify

Restart Cursor to load the new MCP server and verify the connection.

Python
# After saving mcp.json:
# 1. Restart Cursor
# 2. Check Settings > MCP Servers - scavio should be connected
# 3. The agent now has a "search" tool available
# 4. Ask the agent to search for something to test

Step 3: Use grounded search in prompts

Ask the agent to verify information against live search data before answering.

Python
# Example prompts that trigger grounded search:
# "Search for the latest Next.js 15 migration guide and help me upgrade"
# "Check if this API endpoint is still current: [paste URL]"
# "What is the recommended way to handle auth in FastAPI in 2026?"

Step 4: Test the API directly

Verify the search API works to confirm your key and configuration are correct.

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 migration guide 2026"})
for r in resp.json().get("organic_results", [])[:3]:
    print(f"{r['title']}: {r['link']}")

Python Example

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": "FastAPI auth best practices 2026"})
for r in resp.json().get("organic_results", [])[:5]:
    print(r["title"])

JavaScript Example

JavaScript
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
const r = await fetch("https://api.scavio.dev/api/v1/search", {
  method: "POST", headers: H,
  body: JSON.stringify({platform: "google", query: "FastAPI auth best practices 2026"})
});
(await r.json()).organic_results.slice(0,5).forEach(r => console.log(r.title));

Expected Output

JSON
A Cursor IDE with live search grounding enabled, allowing the agent to verify information against current web data and reduce hallucinations in code suggestions.

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.

Cursor IDE installed (v0.40+). A Scavio API key from scavio.dev. MCP support enabled in Cursor. 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

Ground Cursor agent responses with live web data via MCP. Reduce hallucinations by giving the agent access to current documentation and search results.