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 and run opencode mcp add, which asks the same questions and writes the entry for you.
- 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.
- Sign in to SEOmatic. Start OpenCode. When it first gets a 401 from SEOmatic, it starts the OAuth sign-in. If no browser window appears, run opencode mcp auth seomatic, which opens one. 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 and signed in.
- 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, then sign in and check
opencode mcp add
opencode mcp auth seomatic
opencode mcp list
// CI or no browser: add an API key header instead
"seomatic": {
"type": "remote",
"url": "https://app.seomatic.ai/api/mcp",
"headers": {
"Authorization": "Bearer {env:SEOMATIC_API_KEY}"
}
}Note
If seomatic shows as connected but not signed in, run opencode mcp auth seomatic again. opencode mcp debug seomatic shows what went wrong, and opencode mcp logout seomatic clears the stored sign-in if you want to switch workspaces. Config files merge, and the project opencode.json wins over the global one. Tool names start with seomatic; if you turn them off globally with "tools": { "seomatic*": false }, turn them back on in the agent that needs them.
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. OpenCode starts the sign-in when needed, or run opencode mcp auth seomatic. |
| opencode mcp add | The same entry without opening a file | Run opencode mcp add, choose a remote server, name it seomatic and paste https://app.seomatic.ai/api/mcp. It writes the same block for you. |
| opencode.json with an API key | CI, servers with no browser, or shared runners | Add "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 opencode.json with OAuth. It is four lines, 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 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.


