> For the complete documentation index, see [llms.txt](https://docs.serphouse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.serphouse.com/agent-harnesses/opencode.md).

# OpenCode

OpenCode is an open-source AI coding assistant that supports Model Context Protocol (MCP) servers. By connecting the SERPHouse MCP Server, OpenCode can use SERPHouse as a native search provider for SEO research, Google Search, News, Images, Shopping, and other supported tools.

***

### Prerequisites

Before configuring SERPHouse MCP Server, ensure you have:

* OpenCode installed
* An active SERPHouse account
* A valid SERPHouse API key

***

### Configure the SERPHouse MCP Server

Edit `~/.config/opencode/opencode.json` (or your project-local `opencode.json`) and add:

```json
{
  "mcp": {
    "serphouse": {
      "enabled": true,
      "type": "remote",
      "url": "https://mcp.serphouse.com/YOUR_SERPHouse_API_KEY/mcp"
    }
  }
}
```

Replace `YOUR_SERPHouse_API_KEY` with your actual SERPHouse API key.\
Save the configuration.\
Close the current OpenCode session, then start a new session.

***

### Verify Configuration

Open a new session and ask:

```
Search Google for "WordPress SEO Plugins".
```

If configured correctly, OpenCode automatically calls the SERPHouse MCP server.

***

### Using SERPHouse

Once configured, OpenCode automatically invokes SERPHouse whenever a request requires search engine data.

Example prompts:

```
Search Google for "Laravel Horizon".
```

```
Show me the top 10 search results for "AI SEO tools".
```

```
Find related searches for "Laravel queue monitoring".
```

```
Search Google News for "OpenAI".
```

No additional commands are required during normal usage.

***

### Troubleshooting

**Server doesn't load** — Verify that your OpenCode configuration file contains valid JSON. OpenCode ignores invalid MCP configurations without displaying an error.

**Unable to connect to the MCP server** — Confirm your MCP endpoint is in the format `https://mcp.serphouse.com/YOUR_SERPHouse_API_KEY/mcp` and that your internet connection or firewall is not blocking outbound HTTPS requests.

**401 Unauthorized or Authentication failed** — Verify that your SERPHouse API key is valid and active. Ensure you've replaced `YOUR_SERPHouse_API_KEY` in the endpoint URL with your actual API key. Make sure there are no extra spaces or missing characters in the API key.

**SERPHouse tools are unavailable** — Restart OpenCode after saving your configuration. MCP servers are loaded when a new session starts.

**Tool calls fail or return no results** — Check the OpenCode debug logs (`opencode --debug`) for MCP connection or configuration errors. Most issues are caused by an incorrect endpoint URL, malformed configuration, or an invalid API key.

**Search requests return no data** — Verify that your SERPHouse account has available API credits and that the requested search feature is enabled for your account.

**Still having issues?** — Remove the SERPHouse MCP configuration, add it again, restart OpenCode, and verify that your configuration matches the latest documentation.
