Connect OpenCode
Choose OpenCode if model choice matters to you. OpenCode is a coding agent with terminal, desktop, and editor interfaces. You can use models from your connected providers, including Claude and OpenAI; see OpenCode model options. Model usage is billed by each provider.
The trade-off: you get more choice, but more setup and separate usage limits for each provider. Compare apps in Choose your AI.
Connect it to SolarSENS, then ask read-only questions about the Plants your SolarSENS account can see.
Before you start
- Install OpenCode 2.x.
- Use a project folder where OpenCode can create
opencode.json.
OpenCode registers itself with Cloudflare Managed OAuth automatically, so you do not need a client ID, client secret, scope, or advanced OAuth settings.
Do not put a password or an access token in opencode.json.
Server address
Use the email that AVA Asia allowed for SolarSENS AI with this server. The first connection links it to your existing SolarSENS user:
https://mcp.solarsens.co/mcp
See Sign in for the sign-in steps. Let OpenCode discover the OAuth settings.
Do not use a date-stamped workers.dev URL, a server named
solarsens-preview, or a fixture token. Those were test deployments and are
not connected to the signed-in SolarSENS account or its Plant scope. If an old
server appears in an OpenCode session, start a new session and keep only the
solarsens entry in opencode.json.
Add the server
From your project folder, run:
opencode mcp add solarsens --url https://mcp.solarsens.co/mcp
This writes the following to opencode.json. It contains no account, Plant,
or token data.
{
"mcp": {
"servers": {
"solarsens": {
"type": "remote",
"url": "https://mcp.solarsens.co/mcp"
}
}
}
}
Check the connection entry:
opencode mcp list
Before sign-in, OpenCode shows:
solarsens needs authentication
This means OpenCode found the server. It has not received an OAuth token yet.
Complete OAuth sign-in
Run:
opencode mcp auth solarsens
OpenCode registers its own OAuth client with SolarSENS and opens your
browser. Sign in with your linked account, then approve the read:data
consent screen.
opencode mcp auth solarsens uses a loopback callback on port 19876 by
default. On some OpenCode 2.x versions, sign-in fails if
opencode serve --service already holds that port on your machine. See
Connection help for the exact error and fix.
You can also start the flow from inside OpenCode instead of the command line.
Type / in the chat box and choose the command that opens MCPs. In
OpenCode 2.x, the command is /mcp. The panel shows the solarsens entry
before sign-in completes.
After you approve the consent screen, OpenCode stores the OAuth token in its
local credential store. It does not write the token to opencode.json.
Check the connection again:
opencode mcp list
The expected state is:
solarsens connected
Say hello, then test access
Start with a simple chat message:
Hello SolarSENS
Then test the MCP connection and account scope with one message:
Say hello SolarSENS. Then list only the SolarSENS Plants this signed-in account is authorised to view. Return each Plant name and ID. Do not query any Plant outside that scope.
The greeting confirms that OpenCode can chat in the project. The Plant question confirms the MCP connection, OAuth session, and SolarSENS access scope. Do not use a Plant name that you are not authorised to view. If you need to find a named Plant, provide its name or code; do not ask the agent to probe one-letter or one-digit search terms.
The response should show the canonical MCP URL and stay inside your account's scope. It must list only Plants that your signed-in account can access. The homepage uses a separate dedicated demo account; use your own authenticated account for this scope check.
Connection help
| What you see | What to do |
|---|---|
needs authentication | Run opencode mcp auth solarsens. |
failed or 401 after sign-in | Run opencode mcp logout solarsens, authenticate again, and wait for connected before asking for Plant data. |
dynamic client registration is disabled | Remove the saved server entry, add the current production URL again, and retry so OpenCode discovers Cloudflare Managed OAuth. |
| Sign-in fails with a port or address-in-use error | opencode serve --service is holding port 19876. Stop the service, or see Connection help. |
| Tool calls fail with "not linked to an active SolarSENS user" | Open the secure link URL from the error, sign in to SolarSENS once, and reconnect. |
| OAuth succeeds but no Plants appear | Ask AVA Asia to check the Plant access of your SolarSENS user. |
| A Plant is forbidden | The Plant is outside the signed-in account scope. Do not try another Plant ID. |
An old workers.dev or solarsens-preview server appears | Remove that project entry, start a new session, and use the address for the SolarSENS sign-in guide. |
| The MCP panel is empty | Open the project folder that contains opencode.json, then reload OpenCode. |
The SolarSENS MCP is read-only. It does not acknowledge alarms, create work orders, or change Plant configuration.
For OpenCode's current OAuth options, see the OpenCode MCP server guide.



