oMLX runs LLMs locally on Apple Silicon but has no built-in web search. Adding a search MCP server gives local models live web access for grounded responses. This tutorial configures the MCP connection, creates a search tool, and tests it with oMLX queries. Each search costs $0.005.
Prerequisites
- oMLX installed on macOS
- Python 3.8+
- A Scavio API key from scavio.dev
- Apple Silicon Mac
Walkthrough
Step 1: Create MCP search server for oMLX
Build a lightweight MCP server that oMLX can connect to for web search.
import os, requests, json
from http.server import HTTPServer, BaseHTTPRequestHandler
API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
def web_search(query, num_results=5):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': query, 'country_code': 'us', 'num_results': num_results}).json()
return [{'title': r.get('title', ''), 'link': r.get('link', ''),
'snippet': r.get('snippet', '')} for r in data.get('organic_results', [])[:num_results]]
# MCP tool definition for oMLX
mcp_tool = {
'name': 'web_search',
'description': 'Search the web for current information. Use for any question about recent events, current data, or facts you are not certain about.',
'input_schema': {
'type': 'object',
'properties': {
'query': {'type': 'string', 'description': 'The search query'}
},
'required': ['query']
}
}
# Test the tool
results = web_search('latest macOS release 2026')
for r in results:
print(f'{r["title"]}: {r["link"]}')
print(f'\nTool definition ready for oMLX')
print(json.dumps(mcp_tool, indent=2))Step 2: Configure oMLX to use the search tool
Add the MCP server configuration to oMLX settings.
# oMLX MCP configuration file: ~/.omlx/mcp.json
omlx_config = {
'mcpServers': {
'scavio-search': {
'command': 'npx',
'args': ['-y', '@anthropic-ai/mcp-server-scavio'],
'env': {
'SCAVIO_API_KEY': os.environ.get('SCAVIO_API_KEY', 'your-key-here')
}
}
}
}
# Alternative: direct HTTP MCP server
# If oMLX supports HTTP MCP servers:
omlx_http_config = {
'mcpServers': {
'web-search': {
'url': 'http://localhost:3100/mcp',
'tools': [mcp_tool]
}
}
}
config_path = os.path.expanduser('~/.omlx/mcp.json')
print(f'Save this config to: {config_path}')
print(json.dumps(omlx_config, indent=2))
print(f'\nThen restart oMLX to pick up the new MCP server')Step 3: Test search grounding with oMLX
Verify that oMLX models use the search tool for current information.
def test_grounded_query(query):
"""Simulate what oMLX does: search then format context."""
results = web_search(query)
context = '\n'.join([f'[{i+1}] {r["title"]}: {r["snippet"]}' for i, r in enumerate(results)])
print(f'Query: {query}')
print(f'Search returned {len(results)} results')
print(f'\nContext for LLM:')
print(context[:500])
print(f'\nThe local LLM now has current data to answer accurately.')
print(f'Cost: $0.005')
test_queries = [
'what is the latest version of python',
'best local LLM for coding 2026',
'apple silicon m5 benchmarks',
]
for q in test_queries:
test_grounded_query(q)
print()Python Example
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
def omlx_search(query):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': query, 'country_code': 'us', 'num_results': 5}).json()
for r in data.get('organic_results', [])[:3]:
print(f'{r["title"]}: {r.get("snippet", "")[:60]}')
omlx_search('latest macOS release 2026')
print('Cost: $0.005')JavaScript Example
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function omlxSearch(query) {
const data = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: SH,
body: JSON.stringify({ query, country_code: 'us', num_results: 5 })
}).then(r => r.json());
(data.organic_results || []).slice(0, 3).forEach(r => console.log(`${r.title}`));
}
await omlxSearch('latest macOS release 2026');Expected Output
Query: what is the latest version of python
Search returned 5 results
Context for LLM:
[1] Python Release Python 3.13.2: Python 3.13.2 is the latest stable release...
[2] Download Python: The current production versions are Python 3.13.2 and...
[3] What's New In Python 3.13: This article explains the new features in...
The local LLM now has current data to answer accurately.
Cost: $0.005