OpenCode integration
OpenCode is an open-source AI coding agent that runs in your terminal. It reads and edits your codebase, runs commands, and completes multi-step development tasks.
The Apify plugin for OpenCode connects OpenCode to Apify's library of Actors by bundling the Apify MCP server for searching Apify Store, running Actors, and retrieving datasets through the Model Context Protocol (MCP).
This integration uses a third-party service. If you find outdated content, please submit an issue on GitHub.
Prerequisites
- An Apify account - sign up for free if you don't have one.
- OpenCode - installed and authenticated locally.
Install the plugin
You can add the plugin with the OpenCode CLI or by editing your configuration file directly.
Run the following command in your project:
opencode plugin opencode-apify
Alternatively, add the plugin to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-apify"]
}
Authenticate to Apify
The plugin bundles the Apify MCP server. Read-only tools like searching Apify Store and fetching Actor details work without signing in, but you need to authenticate to run Actors and access your account data.
-
List the configured MCP servers:
opencode mcp listThe Apify MCP server appears as not connected until you authenticate.
-
Start the Apify OAuth flow:
opencode mcp auth apifyOpenCode opens a browser tab for the Apify OAuth flow.
-
Review the permissions and select Allow access.
After you complete the flow, the Apify MCP server shows as connected and you're all set.
The connection stays authenticated for future sessions. You can revoke access at any time in Apify Console > Settings > Integrations.
Run your first prompt
Describe what you want in natural language. OpenCode routes the request to the Apify MCP server, so you don't need to name tools yourself.
Use Apify to find a good Actor for scraping Google Maps places. Show me the best option, its input requirements, pricing model, and what kind of dataset output it returns. Do not run the Actor yet.
OpenCode searches Apify Store, fetches the top Actor's details through the Apify MCP server, and summarizes its inputs, pricing, and output - all without running the Actor.
Troubleshooting
The Apify MCP server shows as not connected
Run opencode mcp list to confirm the server is registered. If it appears as not connected, authenticate with opencode mcp auth apify and complete the OAuth flow. See Authenticate to Apify.
OpenCode doesn't load the plugin
Print the resolved OpenCode configuration to confirm the plugin is registered:
opencode debug config
Check that opencode-apify is listed under plugin. If it's missing, add it to your opencode.json or run opencode plugin opencode-apify again.
Browser doesn't open, or OAuth fails
If the browser doesn't open automatically, copy the OAuth URL shown in the terminal and paste it into your browser manually.
If you're running OpenCode in a headless environment (SSH, remote container) or the OAuth flow still fails, authenticate with an API token instead. Copy your token from Apify Console > Settings > Integrations and set it before starting OpenCode:
export APIFY_TOKEN=<YOUR_API_TOKEN>
Limitations
- Long-running Actors may exceed the time a single tool call waits for completion. Reduce the scope or split the work across multiple prompts.
- Each Actor run consumes Apify platform usage from your plan in addition to any OpenCode usage. See Billing for details.
Related integrations
- Claude Code CLI integration - Install the Apify plugin for Claude Code CLI
- MCP server integration - Use the Apify MCP server with other clients
Resources
- Apify plugin for OpenCode - Plugin package and setup notes
- OpenCode documentation - Official OpenCode docs
- Apify Store - Browse Actors you can run from OpenCode