Configure Expand for MCP clients that are not covered by first-class agent pages.
Point any MCP-compatible agent at the local Expand MCP server and it gets Fetch as native tools. Use this page when your agent supports MCP but does not have a first-class Expand installer. The server runs over stdio through expandai mcp run.
Need the CLI first? Start with Quickstart or CLI Commands, then come back to configure your MCP client.
Authenticate once in your terminal:
expandai loginThen give your client this stdio config. The client launches the server; you do not run it yourself.
{
"mcpServers": {
"expandai"
Most clients should not run expandai mcp run in your terminal directly. Put it in the client's MCP config so the client starts the server over stdio and owns its lifecycle.
Next: read MCP Tools & Resources for the full tool schemas, or jump to your first-class page if you use Claude Code, Cursor, Codex, or OpenCode.
The command is always the same: command is expandai, args are ["mcp", "run"]. Only the surrounding schema changes between clients.
Claude-style JSON:
{
"mcpServers": {
"expandai": {
"type": "stdio",
"command": "expandai",
"args": ["mcp", "run"]
}
}
OpenCode-style JSON:
{
"mcp": {
"expandai": {
"type": "local",
"command": ["expandai", "mcp", "run"],
"enabled": true
}
Codex-style TOML:
[mcp_servers.expandai]
command = "expandai"
args = ["mcp", "run"]
enabled = trueThese are schema patterns, not a substitute for first-class setup pages. If you actually use Claude Code, Cursor, Codex, or OpenCode, use the dedicated page — the installer writes and maintains this config for you.
Add --docs when you want the MCP server to expose local documentation resources alongside the Fetch tools. This adds the expand://about and expand://start resources.
expandai mcp run --docs{
"mcpServers": {
"expandai": {
"type": "stdio",
"command": "expandai",
"args": ["mcp", "run", "--docs"]
}
First-class installers do not enable --docs by default. Do not assume expand://start exists unless the configured MCP command includes --docs.
The raw MCP server exposes two tools. Read MCP Tools & Resources for parameters, schemas, and examples.
| Tool | Use |
|---|---|
fetch | Fetch a URL and return Markdown, optional metadata, optional State JSON, optional appendix, and optional Highlights snippets. |
fetch_search | Technical tool name for Highlights on a previous snapshot by snapshotId, without fetching the URL again. |
Search snippets include citationUrl; agents should return those links when grounding claims in fetched content.
Use this page if:
Use another page if:
| You use | Go to |
|---|---|
| Claude Code | Claude Code |
| OpenCode | OpenCode |
| Cursor | Cursor |
| Codex |
For local MCP clients, run expandai login once in your terminal. The MCP server uses the same local Expand credentials as the CLI, so the config carries no secrets.
Do not put EXPAND_API_KEY in the primary local config. API keys belong in CI, server, direct API, advanced, or non-interactive setups. If advanced users need environment variables, see MCP Tools & Resources or CLI Commands.
expandai is not foundYour MCP client may have a different PATH than your terminal. Use an absolute path to the expandai binary or configure the client's environment.
Run expandai login, then verify with expandai whoami. Restart the MCP client after authentication if it keeps a long-running server process.
Keep the command the same and adapt the surrounding schema to your client's MCP format: command expandai, args ["mcp", "run"].
Add --docs to the MCP server args if you want expand://about and expand://start.
Call fetch first, read the returned snapshot ID, then use Highlights through fetch_search with that snapshotId.
| No MCP support | Skill-Based Agents or Quickstart |