Expand AI logo
DocsDocs
Glow Active
API Reference
Login

Documentation

Get started

IntroductionWhy ExpandQuickstartAuthenticationConnect your agent (MCP)

Products

OverviewFetching a URLBatched Fetch
API reference

SDKs & tools

TypeScript SDK
CommandsSkill & hooks
MCP tools & resourcesDocs for agents

Reference

API referenceErrors & retriesPricing & UsageLimitsConcurrency tiersFAQ
Browse docs

Get started

IntroductionWhy ExpandQuickstartAuthenticationConnect your agent (MCP)

Products

OverviewFetching a URLBatched Fetch
API reference

SDKs & tools

TypeScript SDK
CommandsSkill & hooks
MCP tools & resourcesDocs for agents

Reference

API referenceErrors & retriesPricing & UsageLimitsConcurrency tiersFAQ

CLI, Skill & hooks

What installing the Expand CLI adds on top of the hosted MCP server. Terminal fetches, the Expand Skill, the OpenCode web-fetch hook, and proxy support.

The hosted MCP server gives an agent Fetch with nothing installed. The expandai CLI is the local path. Install it when you want one of these:

  • Fetch from a terminal. expandai fetch <url> prints Markdown text, for you or for an agent that runs shell commands.
  • The Expand Skill. A SKILL.md the agent loads on demand. It says when to use Expand, how to cite what it fetched, and how to read the Appendix.
  • Reroute OpenCode's own web fetch. A hook sends every webfetch call through Expand, so the agent gets rendered Markdown without being told to use a specific tool.
  • A restricted network. The CLI honors HTTP_PROXY, HTTPS_PROXY, and NO_PROXY.

Install and sign in

npm install -g expandai
expandai login

expandai login offers browser sign-in or an API key prompt. Credentials are stored in ~/.config/expandai/config.json, or under $XDG_CONFIG_HOME when it is set. No key is written into any agent's config file.

Every command also runs without a global install, through npx -y expandai <command>.

One command per agent

expandai init finds the coding agents on your machine, signs you in if needed, and configures the ones you pick.

expandai init --detect
expandai init

--detect lists what would be configured and changes nothing. Without it, init asks for a scope, shows the detected agents with all of them selected, and writes to the ones you confirm. Every agent gets the Expand Skill and the MCP server, and OpenCode also gets the web-fetch hook. The per-agent table is on CLI: Commands.

Scope is global or project. Project scope writes into the current repository, so collaborators who clone it inherit the setup. Global scope applies to every session on the machine.

Note
init does not write to Claude Code's settings.json, does not change its permissions, and does not install a hook there. Claude Code's built-in WebFetch keeps working as before, and the Expand Skill is what routes fetches through Expand.

To configure one agent and skip the questions, pass --harnesses and --scope:

expandai init --harnesses codex --scope project

Every flag, and the per-host mcp install, skill install, and hook install commands, are on CLI: Commands.

The Expand Skill

The Skill is one Markdown file, SKILL.md, named expandai. init, skill install, and hook install copy it into the agent's skills directory, such as ~/.claude/skills/expandai/ for Claude Code or .agents/skills/expandai/ for a Codex project. Every agent gets the same file.

It tells the agent:

  • To run expandai fetch <url> before curl or a built-in web-fetch tool on any public page, and to skip Expand for localhost, private hosts, and JSON APIs.
  • To run expandai snapshots get <snapshotId> --highlights <query> when it needs passages from a page it already fetched, instead of fetching the URL again.
  • What an [appendix omitted: …] {N} marker is, that it is not page content, and to read the block with expandai appendix rather than refetching.
  • How to follow the more link in the frontmatter to the Snapshot's catalog. See Progressive disclosure.
  • To cite every claim it takes from a page with a **Sources** block of <playground>?id=<evidence id> links, and how to narrow a table citation to one cell. See Citation links.
  • To recover from an authentication error by running expandai login --json itself and relaying the URL and code to the user.
Note
A new CLI version ships a new SKILL.md. init and status compare the installed file with the bundled one, so an outdated Skill shows as not configured until you run init again.

What the hook does

OpenCode's webfetch tool has no JavaScript engine, so a client-rendered page comes back as an empty shell. The hook is a plugin file, expandai-webfetch.js, that init or hook install copies into ~/.config/opencode/plugins/ or .opencode/plugins/. After every webfetch call it runs expandai hook opencode with the URL, and replaces the tool's output with the Markdown text Expand returns.

Note
This is the one thing the hosted MCP server cannot do. A remote server can offer tools, but it cannot change what the agent's own tools return.

The Markdown starts with a short note that carries the Snapshot ID and the capture link, and tells the agent to call get_snapshot or expandai snapshots get for more passages rather than fetching the URL again.

Note
Claude Code gets no hook. expandai hook install claude-code installs the Skill and the MCP server, then prints a notice for the hook step and writes nothing. The protocol runner expandai hook claude-code still exists, but setup does not register it.

Verifying and removing

expandai status --harness opencode --scope project
expandai whoami
expandai uninstall

status reports whether the Skill, the MCP server, and, for OpenCode, the hook are configured, and whether the agent needs a restart. It changes nothing. uninstall with no arguments removes every hook, Skill, and MCP entry the CLI installed, in both scopes.

Warning
Agents read their configuration when they start. After init, restart the agent, including the one that ran the command.

Running MCP locally

expandai mcp run serves the same three tools as the hosted server, over stdio, using the credentials from expandai login. init and mcp install register it for you. Use it where an editor cannot reach https://api.expand.ai. The config entry and the tools are on MCP tools & resources.

Windows

Everything above works without an elevated shell. Credentials are stored under your user profile. The CLI tightens the file's access control list when it can. When Windows refuses, which it does for a non-elevated account, the CLI logs a warning and continues. Run one elevated shell if you want the list tightened.

Next steps

  • Connect your agent (MCP): the hosted server, with no local process.
  • CLI: Commands: every command, flag, and default.
  • MCP tools & resources: the tools an agent gets, with their parameters and results.
  • Docs for agents: let an agent set Expand up itself from start.md.
PreviousCommands
NextMCP tools & resources

On This Page

Install and sign inOne command per agentThe Expand SkillWhat the hook doesVerifying and removingRunning MCP locallyWindowsNext steps