Skip to main content

OpenCode

Use this page to add your PolicyArc environment to OpenCode. These steps were run with OpenCode 1.14.28 on 2026-10-12. A tool call from OpenCode has not been run yet.

Config​

Copy your gateway URL from the Admin Portal first. Copy your gateway URL shows where it is. Then add this to opencode.json in your project, with your URL in place of https://your-environment.example/gateway/mcp.

{
"mcp": {
"policyarc": {
"type": "remote",
"url": "https://your-environment.example/gateway/mcp",
"enabled": true
}
}
}

Steps​

  1. From the project directory, list your servers.

    opencode mcp list

    You see policyarc marked needs authentication, with your gateway URL under it.

  2. Sign in.

    opencode mcp auth policyarc

    OpenCode registers itself with your environment, then opens your browser at the sign-in page of the identity provider your environment uses. After you sign in, OpenCode prints Authentication successful!.

  3. Run opencode mcp list again. You see policyarc marked connected.

Under Access Activity in the Admin Portal, the sign-in shows as a /register row followed by /authorize, /callback and /token rows for OpenCode's new client.

If something goes wrong​

  • If opencode mcp list prints No MCP servers configured, run it from the directory that holds opencode.json.
  • To sign out, run opencode mcp logout policyarc.