Tutorial

How to Add Web Search to OpenCode Multi-Expert

Configure OpenCode CLI as a multi-expert agent with Scavio web search MCP. Each expert gets the same fresh web baseline.

OpenCode CLI multi-expert setups need a shared web-search layer so each expert agent sees the same fresh baseline. Scavio's hosted MCP at `https://mcp.scavio.dev/mcp` plugs in once and exposes search to every expert. This tutorial covers config, expert prompt setup, and a routing pattern.

Prerequisites

  • OpenCode CLI installed
  • Scavio API key

Walkthrough

Step 1: Add Scavio MCP to OpenCode config

Single endpoint, single API key.

JSON
// ~/.opencode/config.json
{
  "mcpServers": {
    "scavio": {
      "url": "https://mcp.scavio.dev/mcp",
      "apiKey": "${SCAVIO_API_KEY}"
    }
  }
}

Step 2: Define expert prompts

One markdown file per expert role.

# experts/seo-expert.md
You are an SEO expert. Always search Scavio for current SERP data before answering.

# experts/code-expert.md
You are a code expert. Search Scavio for current docs and GitHub issues.

Step 3: Wire up routing

OpenCode routes user queries to the right expert.

# experts/router.md
Classify the query: SEO -> seo-expert, code -> code-expert, default -> generalist.

Step 4: Test with a SEO query

Verify Scavio is called with the right query.

Bash
$ opencode 'rank top 5 cars 2026'
# router -> seo-expert
# seo-expert calls Scavio /api/v1/google
# returns SERP plus AI Overview citations

Step 5: Test with a code query

Verify code expert pulls GitHub via SERP.

Bash
$ opencode 'find async-await issues in tokio repo'
# router -> code-expert
# code-expert calls Scavio with site:github.com/tokio-rs filter

Python Example

Python
# OpenCode is a CLI; use Python to orchestrate experts directly via Scavio
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']

EXPERTS = {'seo': 'site: in any', 'code': 'site:github.com'}

def expert_search(role, q):
    scope = EXPERTS.get(role, '')
    r = requests.post('https://api.scavio.dev/api/v1/google',
        headers={'x-api-key': API_KEY},
        json={'query': f'{q} {scope}'}).json()
    return r.get('organic_results', [])[:10]

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const EXPERTS = { seo: '', code: 'site:github.com' };
export async function expertSearch(role, q) {
  const scope = EXPERTS[role] || '';
  const r = await fetch('https://api.scavio.dev/api/v1/google', { method:'POST', headers:{'x-api-key':API_KEY,'Content-Type':'application/json'}, body: JSON.stringify({ query: `${q} ${scope}` }) });
  return (await r.json()).organic_results || [];
}

Expected Output

JSON
OpenCode CLI routes user queries to the right expert; each expert calls Scavio MCP for fresh data. Same fresh baseline across all experts.

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. Scavio API key. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 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

Configure OpenCode CLI as a multi-expert agent with Scavio web search MCP. Each expert gets the same fresh web baseline.