OpenCode Integration with Google Search MCP

📘 OverviewOpenCode MCP Overview →

You are troubleshooting an OOM issue on a remote server using OpenCode and see an unfamiliar kernel log. Previously, you could only copy the error message, disconnect the terminal, switch to a local browser to search, and then switch back. After connecting to the Serp MCP Server, OpenCode can directly search Google in the terminal, completing the entire chain of "view logs → search information → modify code" without leaving the command line.

Google Search MCP is suitable for debugging production issues in OpenCode, conducting technology selection research, checking official documentation, finding GitHub issues, and any scenario that requires "searching the web to continue working."

Obtain API Token

Before using the Google Search MCP Server, you need to prepare an Ace Data Cloud API Token. OpenCode and Claude Code share the same set of Tokens, and the acquisition process is the same:

  1. Open the Ace Data Cloud Console - Application List to obtain your API Token for backup.
  2. If you are not logged in or registered, you will be automatically redirected to the login page; after logging in or registering, you will automatically return to the current page.
  3. The first application will have a free quota available, allowing you to experience the Google Search MCP service for free.

Obtain Ace Data Cloud API Key

One Token can be used for all MCP Servers provided by Ace Data Cloud, and there is no need to apply separately for Google Search. The documentation and screenshots suggest displaying only the masked form, such as YOUR_ACEDATACLOUD_API_KEY, and do not paste the complete Token into public repositories, issues, screenshots, or chat records.

Want to use Claude Desktop / Claude.ai web version for direct OAuth one-click authorization? Please see the Claude.ai / Desktop tutorial for Google Search MCP.

Configure OpenCode

OpenCode describes all MCP Servers in a single opencode.json file, which can be placed in two locations; choose one according to the "scope of effect" below. The field structure in both locations is exactly the same, with the only difference being priority.

It is strongly recommended to first write the Token to an environment variable:

export ACEDATACLOUD_API_KEY="replace with your real Token"

Then reference it in opencode.json using the {env:ACEDATACLOUD_API_KEY} placeholder to avoid writing the real Token into the file.

Global: Shared by all projects

File location: ~/.config/opencode/opencode.json, suitable for "my own machine, configured once, usable by all projects."

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "serp": {
      "type": "remote",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

⚠️ "oauth": false cannot be omitted. AceData's MCP Server uses Bearer Token authentication and does not go through the OAuth process; OpenCode will automatically redirect 401 as an OAuth challenge by default, causing opencode mcp list to show SSE error: Non-200 status code (401). Explicitly declaring "oauth": false allows OpenCode to call directly with Authorization: Bearer ..., and opencode mcp debug serp will also echo OAuth explicitly disabled, indicating it is effective.

Project-level: Effective only for the current project

File location: opencode.json in the root directory of the current project, which will override the global configuration. Suitable for team sharing, single repository customization, or temporarily enabling a specific MCP in a certain project.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "serp": {
      "type": "remote",
      "url": "https://serp.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

If the project-level opencode.json will be committed to Git, please ensure to use the {env:ACEDATACLOUD_API_KEY} placeholder instead of the real Token to avoid leakage.

💡 If the .env in Shell is not explicitly exported, you need to use set -a && source .env && set +a to pass the variables to the OpenCode process; otherwise, opencode debug config will show "Authorization": "Bearer " (placeholder not resolved).

Verify Connection

After configuration, run:

opencode mcp list
opencode mcp debug serp

Seeing serp connected indicates a successful handshake. If it fails, check whether ACEDATACLOUD_API_KEY has been exported, whether oauth is set to false, and whether Authorization includes the Bearer prefix. The model and tool schema will continue to change, so please select models that support native tool calls from the current directory.

Typical Scenarios

After configuration, you can directly call using natural language in the OpenCode session without switching to /mcp:

Debugging Production Issues

Search how to solve nginx 502 bad gateway response header too large

Technology Selection Research

Search for the performance comparison of Python asynchronous ORM in 2025, SQLAlchemy 2.0 async vs Tortoise ORM

Check Official Documentation

Search the official documentation for Kubernetes CronJob concurrencyPolicy, the difference between Forbid and Replace

Tool List

The table below lists the main tools; you can obtain the current complete list by using curl -X POST https://serp.mcp.acedata.cloud/mcp -H 'Authorization: Bearer <token>' -H 'Accept: application/json' -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}':

Tool Description
serp_google_search Google web search, supports specifying country, language, and time range
serp_google_images Google image search
serp_google_news Google news search
serp_google_videos Google video search
serp_google_maps / serp_google_places Map / local business search