Connect OpenCode in the Terminal
Tutorial
Connect the OpenCode terminal client to a wiki's MCP endpoint, from installing it to a working authenticated session. Read Agent Authentication for what the connected client is then allowed to do. The browser sign-in in step 3 needs the XWiki OIDC Provider; the FAQ covers what to do without it.
- Download and install OpenCode from the project's download page.
- Add the MCP server to OpenCode's configuration file - either
~/.config/opencode/opencode.jsoncor an opencode.jsonc file in the root folder of your project - replacing the URL with your wiki's endpoint URL. Your administrator can copy that URL from the MCP administration page.{ "$schema": "https://opencode.ai/config.json", "mcp": { "xwiki": { "type": "remote", "url": "https://<server>/<webapp>/rest/wikis/xwiki/aiLLM/mcp", "enabled": true } } } - Run opencode mcp auth xwiki and open, in your browser, the URL it prints.

- Sign in and accept, then check the result: the browser reports the authorization as successful, and OpenCode is connected.

FAQ
Why I get an "MCP server not found" error when running the mcp auth command?
In the opencode mcp auth xwiki command, the last parameter is the name of the MCP server, and it should match the name inside your config file. If instead of "xwiki", you named your MCP server something else (e.g.: "xwiki-sales-wiki"), then the mcp auth command should reflect that as well (e.g.: opencode mcp auth xwiki-sales-team).
What if the auth command does not open a browser?
The browser sign-in needs the XWiki OIDC Provider on the wiki. Without it, there is no sign-in challenge to follow; an unauthenticated caller gets a bare 401 unless the wiki allows guest access. See Agent Authentication for how a client authenticates then, or ask your administrator for a client configuration.