Connect OpenCode to the Explore API so your local AI coding assistant uses your server for knowledge, research and real-time data on every query.
npm i -g opencode-aiDownload both files and place them in the same directory on your machine, for example /home/youruser/explorer-mcp/
explorer-mcp.js — the MCP server package.json — Node package config
chmod +x /home/youruser/explorer-mcp/explorer-mcp.js
~/.opencode/opencode.json with the following content. Replace the path and token with your actual values.{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"explorer": {
"type": "local",
"command": ["node", "/home/youruser/explorer-mcp/explorer-mcp.js"],
"enabled": true,
"environment": {
"EXPLORER_API_URL": "https://carlostkd.ch/explore/api/explore.php",
"CODE_API_URL": "https://carlostkd.ch/explore/api/code.php",
"ASSISTANT_API_URL": "https://carlostkd.ch/explore/api/assistant.php",
"ASSISTANT_API_URL": "https://carlostkd.ch/explore/api/status.php",
"ASSISTANT_API_URL": "https://carlostkd.ch/explore/api/search.php",
"EXPLORER_TOKEN": "your_token_here"
}
}
}
}
$EXPLORER_TOKEN. OpenCode does not inherit shell environment variables.~/.config/opencode/AGENTS.md to tell the LLM when to use the tool.## Tool Usage Rules You have five tools. NEVER answer any message directly without using a tool first. ROUTING RULES: - "ping" → call ping tool and show full response without summarizing - Message starts with "explore" → call explore_topic - Message starts with "code" → call code_topic - Message starts with "search" → call search_web - Weather, news, prices, stocks → call search_web - Everything else including greetings, identity questions, general conversation → call ask_lumo Never answer directly without using one of these tools. The only exception is direct file editing operations like reading or writing files in the current project.
opencode mcp list
● ✓ explorer connected
node /home/youruser/explorer-mcp/explorer-mcp.js
pkill -f explorer-mcp.js && opencode mcp listopencode
opencode run "your question here"
| Trigger | Example | Result |
|---|---|---|
| explore | explore quantum computing | explore_topic |
| code | code how do I reverse a string in python | code_topic |
| weather / news / prices | weather in zurich | explore_topic |
| general question | what is your name | ask_lumo |
| anything else | what time is it in tokyo | ask_lumo |
| ping | Get the last news from the server | call this at anytime to get the last news |
Requests are limited per token per day. The counter resets at midnight. If you hit the limit you will see:
MCP error -32603: Rate limit reached. Resets at midnight.
pkill -f explorer-mcp.js opencode mcp list
code <question> to force code_topic, or just ask naturally and the LLM will route to ask_lumo automatically.