Tutorial

How to Configure MCP Search in opencode.json

Add a search MCP server to your opencode.json configuration. Give your opencode AI assistant live web search across Google, Reddit, and YouTube.

opencode is an open-source terminal AI assistant that supports MCP (Model Context Protocol) servers for extending its capabilities. Adding a search MCP server to opencode gives your assistant the ability to query live web data during coding sessions. This tutorial shows how to configure the Scavio MCP server in your opencode.json file so the assistant can search Google, Reddit, YouTube, and other platforms. The setup takes one configuration change and requires no code modifications.

Prerequisites

  • opencode CLI installed
  • A Scavio API key from scavio.dev
  • Basic familiarity with JSON configuration files

Walkthrough

Step 1: Locate your opencode config

Find the opencode.json configuration file in your project or home directory.

Python
# opencode.json is typically at:
# ./opencode.json (project-level)
# ~/.config/opencode/config.json (global)

# Check if it exists:
import os
for path in ["./opencode.json", os.path.expanduser("~/.config/opencode/config.json")]:
    print(f"{path}: {'exists' if os.path.exists(path) else 'not found'}")

Step 2: Add the Scavio MCP server

Add the Scavio MCP server configuration to your opencode.json file.

Python
# Add this to your opencode.json under mcpServers:
# {
#   "mcpServers": {
#     "scavio": {
#       "url": "https://mcp.scavio.dev/mcp",
#       "headers": {
#         "x-api-key": "your_scavio_api_key"
#       }
#     }
#   }
# }

Step 3: Verify the connection

Restart opencode and verify the MCP server is connected.

Python
# After editing opencode.json, restart opencode
# The assistant should now have access to search tools
# Test with: "Search for Python FastAPI best practices 2026"

Step 4: Test the equivalent API call

Verify the underlying API works before relying on the MCP integration.

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": "Python FastAPI best practices 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": "opencode mcp setup"})
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: "opencode mcp setup"})
});
(await r.json()).organic_results.slice(0,5).forEach(r => console.log(r.title));

Expected Output

JSON
An opencode configuration with Scavio MCP search enabled, giving the AI assistant live web search capabilities during terminal coding sessions.

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.

opencode CLI installed. A Scavio API key from scavio.dev. Basic familiarity with JSON configuration files. 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 a search MCP server to your opencode.json configuration. Give your opencode AI assistant live web search across Google, Reddit, and YouTube.