An OpenCode plugin that connects your agent to SerpApi's hosted MCP server for Google, Amazon, Walmart, eBay, YouTube, Google Maps, Google Scholar, and 100+ other engines.
Sign up at serpapi.com and set the key:
Free tier – 250 searches/month, no credit card required.
export SERPAPI_API_KEY="your_serpapi_key"Add the npm package name to the plugin list in opencode.json. OpenCode
automatically installs npm plugins at startup:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-serpapi"]
}After the package is published to npm, restart OpenCode (or start a new session). The plugin registers SerpApi as a remote MCP server automatically.
Ask in natural language and the agent picks the tool and engine on its own:
Search Google for the best Python web frameworks
Compare prices for AirPods Pro on Amazon, Walmart, and eBay
Find academic papers about transformer architectures published after 2020
Find well-reviewed coffee shops near Times Square
This is an OpenCode MCP integration. The plugin adds the hosted SerpApi MCP server at https://mcp.serpapi.com/mcp and configures bearer-header authentication from SERPAPI_API_KEY. It also registers a local OpenCode skill with engine-selection and search guidance. OpenCode exposes the MCP search tool to the model. If MCP is unavailable, the plugin's native serpapi_search tool tries the official CLI and then HTTPS cURL; the REST fallback sends the key as a query parameter.
- MCP-native search — OpenCode receives the
searchtool from theserpapiMCP server. - All SerpApi engines — the MCP server supports Google, Bing, Amazon, Walmart, eBay, YouTube, Google Maps, Google Scholar, and other engines.
- MCP header authentication — the key is read from
SERPAPI_API_KEYand sent in the MCPAuthorizationheader, not embedded in the MCP URL or source code. - Structured results — the MCP server supports JSON, compact responses, Markdown output, and engine-specific parameter validation.
- Local search guidance — the bundled skill helps the model choose engines and use engine-specific parameters without owning credentials or making API requests.
- Fallback routes — when MCP is unavailable, the skill guides the agent to use the official SerpApi CLI, then HTTPS cURL as a last resort.
- CLI/REST search tool —
serpapi_searchtries the official CLI and then cURL when the MCP server is unavailable.
| Category | Engines |
|---|---|
| Web Search | Google, Google Light, Bing, DuckDuckGo, Yahoo, Yandex, Baidu, Naver |
| AI Search | Google AI Mode, Google AI Overview, Bing Copilot, Brave AI Mode |
| Shopping | Amazon, Walmart, eBay, Google Shopping, Home Depot |
| Local / Maps | Google Maps, Google Local, Yelp, TripAdvisor, OpenTable |
| Research | Google Scholar, Google Patents, Google Trends |
| News | Google News |
| Media | Google Images, Google Videos, YouTube, Google Lens |
| Travel | Google Flights, Google Hotels, Google Travel Explore |
| Jobs | Google Jobs |
| Finance | Google Finance |
| Apps | Google Play, Apple App Store |
See the full, current list at serpapi.com/search-engine-apis. Detailed engine, MCP, CLI, cURL, credential, and response guidance is bundled under skills/serpapi-web-search/references/.
- "Tool not showing up" — confirm
opencode-serpapiis listed underplugininopencode.json, confirmSERPAPI_API_KEYis available to OpenCode, and restart OpenCode.
If MCP is unavailable, install and authenticate the official CLI:
brew tap serpapi/homebrew-tap
brew install serpapi-cli
serpapi loginFor direct CLI use, authenticate with serpapi login or its secure configuration.
The plugin passes SERPAPI_API_KEY to its CLI fallback. Do not pass the key with
--api-key, because command-line arguments can be visible in process listings.
npm install
npx tsc --noEmit # type-checkThe plugin configures the serpapi MCP server, whose primary tool is search, and also exposes serpapi_search as a native CLI/cURL route. The bundled skill provides routing and operational guidance; the reference files contain detailed engine and route documentation. engines.ts supplies query-field mapping for native requests.
- SerpApi MCP Server — for Claude Desktop, VS Code, and Cursor
- SerpApi Docs — full API reference
- SerpApi Playground — interactive API explorer
- OpenCode Plugin Docs
MIT License — see LICENSE file for details.