Expand AI logo
DocsDocs
Glow Active
API Reference
Login

Documentation

Get Started

OverviewWhy ExpandQuickstartWays to Use Expand

Agent Quickstarts

OverviewExpand SkillClaude CodeCursorCodexOpenCodeSkill-Based AgentsOther MCP Clients

Fetch

OverviewHow Fetch WorksOutput ModelInclude OptionsBrowser BehaviorHighlightsPlayground & ReplayBatched Fetch

Reference

API ReferenceCLI CommandsMCP Tools & ResourcesTypeScript SDKPython SDK

Account & Billing

Pricing & UsageTiersFAQ

Machine-Readable Docs

start.mdllms.txtllms-full.txtDocs as Markdown
Browse docs

Get Started

OverviewWhy ExpandQuickstartWays to Use Expand

Agent Quickstarts

OverviewExpand SkillClaude CodeCursorCodexOpenCodeSkill-Based AgentsOther MCP Clients

Fetch

OverviewHow Fetch WorksOutput ModelInclude OptionsBrowser BehaviorHighlightsPlayground & ReplayBatched Fetch

Reference

API ReferenceCLI CommandsMCP Tools & ResourcesTypeScript SDKPython SDK

Account & Billing

Pricing & UsageTiersFAQ

Machine-Readable Docs

start.mdllms.txtllms-full.txtDocs as Markdown

OpenCode

Set up Expand for OpenCode with the webfetch hook and MCP tools.

Route OpenCode's native webfetch through Expand. Install the hook to replace webfetch output with rendered Markdown and a snapshot reference, and register the Expand MCP server in the same command so OpenCode can also fetch pages directly or call Expand tools when it needs more control.

expandai login
expandai hook install opencode project

Run the project command from the project root. Expand writes OpenCode project config into the current working directory, not a detected git root.

Verify the hook intercepts native webfetch:

Use OpenCode webfetch to read https://news.ycombinator.com through Expand.
Confirm that the output includes an Expand snapshot reference, then show me the first 10 lines of page Markdown.

The hook output can start with a snapshot note before the page content. That is expected, and it is the fastest signal that OpenCode is seeing the Expand hook.

Verify the MCP tools are wired up:

Use the Expand MCP fetch tool to fetch https://news.ycombinator.com.
Show me the first 10 lines of Markdown and confirm the tool call succeeded.

See also: Expand Skill, MCP Tools & Resources, and CLI Commands.

Recommended setup

The hook path is the OpenCode default because it improves the thing users already ask OpenCode to do: webfetch. OpenCode still runs its native webfetch tool, then the Expand plugin takes over the result.

The plugin hooks tool.execute.after for the native webfetch tool, shells out to expandai hook opencode, and replaces the tool output with Expand Markdown. The same installer registers the Expand MCP server, so OpenCode can call Expand tools directly when a task needs snapshot search, JSON output, or more precise control.

MCP is not a separate Expand product. It is one integration surface onto Fetch, the same product the hook uses.

What gets installed

expandai hook install opencode project writes two things: the webfetch plugin and the MCP server entry.

PieceProject pathGlobal path
Webfetch plugin.opencode/plugins/expandai-webfetch.js~/.config/opencode/plugins/expandai-webfetch.js
MCP configopencode.json~/.config/opencode/opencode.json

OpenCode MCP config uses a top-level mcp key, not mcpServers. The installed entry is a local server, enabled, that runs expandai mcp run:

{
  "mcp": {
    "expandai": {
      "type": "local",
      "command": ["expandai", "mcp", "run"],
      "enabled": true
    }

The installer writes this for you. Copy the install command rather than hand-editing JSON.

Project and global scope

Project scope is the safer default.

ScopeCommandWrites toUse when
Projectexpandai hook install opencode project.opencode/plugins/, opencode.jsonYou want Expand enabled for this project.
Globalexpandai hook install opencode global

Commit .opencode/plugins/expandai-webfetch.js and opencode.json only if the team wants Expand enabled for collaborators.

Hook, MCP, and Skill

OpenCode has three Expand surfaces. Start with the hook; the others are additive.

SurfaceCommandWhat it doesRecommended
Hookexpandai hook install opencode projectReplaces native webfetch output with Expand Markdown and installs MCP.Yes, default
MCPexpandai mcp install opencode projectRegisters Expand tools without changing native .

Use the hook first. Add the Skill only if you want OpenCode to carry explicit Expand usage guidance in its skill system. The Skill installs to .opencode/skills/expandai/SKILL.md for project scope or ~/.config/opencode/skills/expandai/SKILL.md for global scope. Read Expand Skill for its behavior and lifecycle.

Uninstall

expandai hook uninstall opencode project
expandai hook uninstall opencode global

Hook uninstall removes the OpenCode webfetch plugin and the Expand MCP entry for the selected scope. It does not touch unrelated OpenCode config or other MCP servers. If you installed only MCP or only the Skill, uninstall it with the matching command (expandai mcp uninstall opencode <scope> or expandai skill uninstall opencode <scope>).

Troubleshooting

OpenCode still uses normal webfetch

  • Confirm the plugin exists at .opencode/plugins/expandai-webfetch.js or ~/.config/opencode/plugins/expandai-webfetch.js.
  • Restart OpenCode if it does not pick up plugin changes.
  • Confirm the prompt actually uses OpenCode webfetch.
  • Run expandai login and retry.

MCP tools are missing

  • Confirm opencode.json or ~/.config/opencode/opencode.json contains the mcp.expandai entry.
  • Confirm the command is expandai mcp run.
  • Confirm the CLI is on the same PATH OpenCode uses.
  • Restart OpenCode if needed.

Config landed in the wrong place

Expand writes project-scoped OpenCode files into the current directory, not a detected git root. If OpenCode cannot see the plugin or MCP server, check whether you ran the installer from a subfolder.

Authentication fails

Run expandai login in your terminal, then ask OpenCode to try again. Local OpenCode setup should not require putting an API key into OpenCode config.

I want instructions too

Install the Expand Skill if you want OpenCode to keep explicit guidance for when to fetch, reuse snapshots, and return citations.

Next steps

  • Agent Quickstarts overview
  • Expand Skill
  • MCP Tools & Resources
  • CLI Commands
PreviousCodex
NextSkill-Based Agents

On This Page

Recommended setupWhat gets installedProject and global scopeHook, MCP, and SkillUninstallTroubleshootingOpenCode still uses normal webfetchMCP tools are missingConfig landed in the wrong placeAuthentication failsI want instructions tooNext steps
}
}
~/.config/opencode/plugins/, ~/.config/opencode/opencode.json
You want Expand available in every OpenCode workspace.
webfetch
When you only want tools
Skillexpandai skill install opencode projectAdds agent-readable instructions for when and how to use Expand.Optional