ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Connect Scavio MCP to Local LLMs
Tutorial

How to Connect Scavio MCP to Local LLMs

Set up Scavio MCP server with Ollama and llama.cpp. Give local models real-time search, TikTok data, and YouTube transcripts without custom integrations.

Get Free API KeyAPI Docs

MCP (Model Context Protocol) lets AI models call external tools through a standardized interface. The Scavio MCP server at mcp.scavio.dev/mcp exposes web search, TikTok analytics, and YouTube data as MCP tools that any compatible client can call. This tutorial connects the Scavio MCP server to local LLMs running on Ollama or llama.cpp, giving your local models the same search capabilities as cloud-hosted agents. Setup takes under 5 minutes and each tool call costs $0.005.

Prerequisites

  • Ollama installed and running locally
  • Python 3.9+ installed
  • A Scavio API key from scavio.dev
  • Basic understanding of MCP tool protocol

Walkthrough

Step 1: Create the MCP configuration file

Write a .mcp.json file that points to the Scavio MCP server. This file tells MCP-compatible clients where to find the search tools.

Python
import json

mcp_config = {
    'mcpServers': {
        'scavio': {
            'url': 'https://mcp.scavio.dev/mcp',
            'headers': {
                'Authorization': 'Bearer ${SCAVIO_API_KEY}'
            }
        }
    }
}

with open('.mcp.json', 'w') as f:
    json.dump(mcp_config, f, indent=2)
print('MCP config written to .mcp.json')
print('Available tools: web_search, tiktok_search, youtube_search')

Step 2: Test the MCP connection with a direct call

Before wiring to Ollama, test that the MCP server responds correctly by making a direct HTTP request to the search tool.

Python
import os, requests

SCAVIO_KEY = os.environ['SCAVIO_API_KEY']

# Direct test of the search endpoint
resp = requests.post('https://api.scavio.dev/api/v1/search',
    headers={'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'},
    json={'query': 'test search query', 'country_code': 'us', 'num_results': 3})
data = resp.json()
print(f'Status: {resp.status_code}')
print(f'Results: {len(data.get("organic_results", []))}')
for r in data.get('organic_results', [])[:3]:
    print(f'  {r["title"]}')

Step 3: Wire MCP tools to Ollama

Create an Ollama tool wrapper that translates MCP tool calls into Scavio API requests. This bridges the gap between Ollama's tool format and MCP.

Python
import ollama

def handle_mcp_tool(tool_name: str, args: dict) -> str:
    """Route MCP tool calls to the Scavio API."""
    if tool_name == 'web_search':
        resp = requests.post('https://api.scavio.dev/api/v1/search',
            headers={'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'},
            json={'query': args.get('query', ''), 'country_code': 'us', 'num_results': 5})
        results = resp.json().get('organic_results', [])
        return '\n'.join(f'{r["title"]}: {r.get("snippet", "")}' for r in results)
    elif tool_name == 'tiktok_search':
        resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
            headers={'Authorization': f'Bearer {SCAVIO_KEY}', 'Content-Type': 'application/json'},
            json={'keyword': args.get('query', ''), 'count': 5, 'cursor': 0})
        videos = resp.json().get('data', {}).get('videos', [])
        return '\n'.join(f'{v.get("desc", "")[:80]} ({v.get("stats", {}).get("playCount", 0)} plays)' for v in videos)
    return 'Unknown tool'

tools = [
    {'type': 'function', 'function': {'name': 'web_search', 'description': 'Search the web for current information',
        'parameters': {'type': 'object', 'properties': {'query': {'type': 'string'}}, 'required': ['query']}}},
    {'type': 'function', 'function': {'name': 'tiktok_search', 'description': 'Search TikTok videos',
        'parameters': {'type': 'object', 'properties': {'query': {'type': 'string'}}, 'required': ['query']}}},
]

response = ollama.chat(model='llama3.1', messages=[{'role': 'user', 'content': 'What is trending on TikTok right now?'}], tools=tools)
if response.message.tool_calls:
    for tc in response.message.tool_calls:
        result = handle_mcp_tool(tc.function.name, tc.function.arguments)
        print(f'Tool: {tc.function.name}')
        print(result[:300])

Python Example

Python
import os, requests, json

SCAVIO_KEY = os.environ['SCAVIO_API_KEY']

# Create MCP config
config = {'mcpServers': {'scavio': {
    'url': 'https://mcp.scavio.dev/mcp',
    'headers': {'Authorization': f'Bearer {SCAVIO_KEY}'}}}}
with open('.mcp.json', 'w') as f:
    json.dump(config, f, indent=2)

# Test search via MCP
def mcp_search(query):
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'country_code': 'us', 'num_results': 5})
    return resp.json().get('organic_results', [])

results = mcp_search('latest AI news')
print(f'MCP search returned {len(results)} results')
for r in results[:3]:
    print(f'  {r["title"]}')

JavaScript Example

JavaScript
const SCAVIO_KEY = process.env.SCAVIO_API_KEY;
const fs = require('fs');

// Create MCP config
const config = { mcpServers: { scavio: {
  url: 'https://mcp.scavio.dev/mcp',
  headers: { Authorization: `Bearer ${SCAVIO_KEY}` }
}}};
fs.writeFileSync('.mcp.json', JSON.stringify(config, null, 2));

// Test search
async function mcpSearch(query) {
  const resp = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query, country_code: 'us', num_results: 5 })
  });
  const data = await resp.json();
  return data.organic_results || [];
}

mcpSearch('latest AI news').then(r => {
  console.log(`MCP search: ${r.length} results`);
  r.slice(0, 3).forEach(x => console.log(`  ${x.title}`));
});

Expected Output

JSON
MCP config written to .mcp.json
Available tools: web_search, tiktok_search, youtube_search

Status: 200
Results: 3
  Latest AI News and Developments 2026
  Top AI Frameworks Released This Year
  AI Industry Update: May 2026

Tool: tiktok_search
Viral dance challenge takes over TikTok (2,345,678 plays)
New cooking hack everyone is trying (1,892,345 plays)

Related Tutorials

  • How to Add Search to Ollama After Google CSE Shutdown
  • How to Build a Search Fallback Stack for Local LLMs

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.

Ollama installed and running locally. Python 3.9+ installed. A Scavio API key from scavio.dev. Basic understanding of MCP tool protocol. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, 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.

Related Resources

Best Of

Best MCP Search Servers for Local LLMs (2026)

Read more
Use Case

MCP Custom Search Server

Read more
Best Of

Best MCP Search Servers: Community Edition, May 2026

Read more
Use Case

MCP Search Gateway for Multi-Agent Systems

Read more
Workflow

Daily Search Grounding for Ollama Assistant

Read more
Solution

Local LLM Search After Google Paywall

Read more

Start Building

Set up Scavio MCP server with Ollama and llama.cpp. Give local models real-time search, TikTok data, and YouTube transcripts without custom integrations.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy