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.
# 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.
# 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.
# 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.
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
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
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
An opencode configuration with Scavio MCP search enabled, giving the AI assistant live web search capabilities during terminal coding sessions.