Use SEOmatic in OpenCode
Updated
Before you start
OpenCode installed and set up with a model provider, and a free SEOmatic account. For CI or a machine with no browser, create an API key in Settings, AI Agents, API Keys.
Connect OpenCode#
- Open opencode.json. Open opencode.json in your repo, or ~/.config/opencode/opencode.json if you want SEOmatic in every project. Or skip the file: from the repo, run opencode mcp add seomatic --url https://app.seomatic.ai/api/mcp, and add --global for every project. On OpenCode 1, run opencode mcp add and answer its prompts.
- Add the seomatic server. Under mcp, add an entry named seomatic with "type": "remote" and "url": "https://app.seomatic.ai/api/mcp". Keep any servers already there. This shape works in OpenCode 1 and 2. If your file already uses mcp.servers, put the entry there instead.
- Sign in to SEOmatic. Start OpenCode, run /mcps, pick seomatic and sign in. Or run opencode mcp auth seomatic, which opens your browser. Sign in or create a free account and pick your site.
- Check the connection. Run opencode mcp list and check that seomatic shows as connected. If the first run in a folder says no MCP servers are configured, run it again a few seconds later, or check in /mcps.
- Ask about your site. Ask: “How did my site do on Google over the last 28 days?” The answer should name the date range and your real numbers.
OpenCode setup
// opencode.json in the repo,
// or ~/.config/opencode/opencode.json for every project
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"seomatic": {
"type": "remote",
"url": "https://app.seomatic.ai/api/mcp"
}
}
}
// or let OpenCode write it (add --global for every project),
// then sign in and check
opencode mcp add seomatic --url https://app.seomatic.ai/api/mcp
opencode mcp auth seomatic
opencode mcp list
// OpenCode 1: opencode mcp add asks the same questions
// CI or no browser: an API key header instead of OAuth
"seomatic": {
"type": "remote",
"url": "https://app.seomatic.ai/api/mcp",
"oauth": false,
"headers": {
"Authorization": "Bearer {env:SEOMATIC_API_KEY}"
}
}Note
If seomatic shows as needing authentication, sign in again with /mcps or opencode mcp auth seomatic. This is also needed once after moving from OpenCode 1 to 2, which does not carry MCP sign-ins over. opencode mcp logout seomatic clears the stored sign-in if you want to switch workspaces. On OpenCode 1, opencode mcp debug seomatic shows what went wrong. If seomatic shows as failed after your computer sleeps, reconnect it in /mcps or run opencode service restart. Config files merge, and the project opencode.json wins over the global one. Tool names start with seomatic_. They run without asking by default; to be asked first, add the rule { "action": "seomatic_*", "resource": "*", "effect": "ask" } to permissions (OpenCode 2), or "permission": { "seomatic_*": "ask" } (OpenCode 1).
OAuth, API Key or Skills?
| Route | Best for | How |
|---|---|---|
| opencode.json with OAuth | Most people working on their own machine | Add the block above to opencode.json in the repo or ~/.config/opencode/opencode.json. Sign in with /mcps in OpenCode, or run opencode mcp auth seomatic. |
| opencode mcp add | The same entry without opening a file | Run opencode mcp add seomatic --url https://app.seomatic.ai/api/mcp. Add --global for every project. On OpenCode 1, run opencode mcp add and answer the prompts. |
| opencode.json with an API key | CI, servers with no browser, or shared runners | Add "oauth": false and "headers": { "Authorization": "Bearer {env:SEOMATIC_API_KEY}" } to the seomatic entry and set the variable. |
| Skills only | Running SEO checks through the SEOmatic CLI | npx skills add Minh42/seomatic-mcp -a opencode, with SEOMATIC_API_KEY set. |
Pick OAuth, with the file or the command. No key to copy, and OpenCode stores the sign-in for next time. Switch to the key only where no browser can open.
Try Asking#
- “Clicks dropped last month. Which pages lost them, and is it something we shipped?”
- “Which pages get impressions on Google but few clicks? Rewrite their titles in the code.”
- “List the pages Google has not indexed and find the cause in this repo.”
- “Audit the site before I deploy and fix anything that would hurt rankings.”
- “Which keywords rank on page two, and what would move each page up?”
- “Which questions do AI assistants answer without citing us?”
What It Costs#
Connecting is free. Reading your own data never uses credits: Search Console performance and insights, index status, rankings, site audits, AI citations, traffic and your tasks. Only live market lookups (keyword metrics, search results, backlinks), AI visibility scans and the fixes you approve use AI credits; every tool is labelled free or billed. On the Free plan, market lookups count against 5 free questions a month. The workspace Owner sees every credit spent, by feature, in Settings > Usage. OpenCode itself is billed by its maker, not by SEOmatic: nothing on our side counts tokens.
Nothing Changes on Your Site Without Your Approval#
OpenCode works in two places, and both keep you in charge. In your repo, it edits files and you review the diff before anything ships. In your CMS, it can only stage a fix in SEOmatic. A staged change is a proposal: it says what will change and why, and in Approval mode nothing touches your site until you approve it. The assistant records your decision, and it is told never to approve anything on its own judgment. Approved fixes start within seconds, the page's previous state is stored, and any applied change can be rolled back. Changes that could take a page out of Google, like a noindex, need an extra explicit confirmation.
- OpenCode says SEOmatic is connected but answers without my data.
- Start a new chat and check that SEOmatic is enabled for that conversation in the tools menu. This is the step most people miss.
- The SEOmatic page says "This connection request expired".
- Start the connection again from OpenCode, or paste the setup prompt again.
- The Authorize page shows the wrong email or no workspace.
- Click Switch account on that page and sign in with the SEOmatic account that owns the site.
- Why does OpenCode say it cannot change my site?
- Fixes need a live paid plan or trial. On the Free plan, or when billing is paused or failed, your assistant can read and answer only.
- How do I disconnect?
- Open Settings > AI Agents, scroll to API Keys and delete the row named OAuth: OpenCode. See disconnect an assistant.
Was This Article Helpful?
Still need help?Email contact@seomatic.ai with your site address and a screenshot. A person replies, usually within one business day.


