XgenPlusXgenPlusHelp Center

Connect OpenCode to XgenPlus Mail

To connect OpenCode, make your token, then add the XgenPlus server to opencode.json, either ~/.config/opencode/opencode.json for all projects or opencode.json in one project. Set the XGENPLUS_TOKEN environment variable to your token and start OpenCode from the same terminal. opencode mcp list should show xgenplus as connected.

For: EveryoneWebAI

How to connect OpenCode

  1. Create an agent password in webmail under Settings › Security › AI Agents (MCP) and copy its token, or make your token.
  2. Open ~/.config/opencode/opencode.json for all projects, or create opencode.json in one project folder.
  3. Paste the block below. If the file already has an mcp section, add xgenplus inside it.
  4. Set the token and start OpenCode in the same terminal. Windows PowerShell: $env:XGENPLUS_TOKEN = "<TOKEN>"; opencode. Mac or Linux: export XGENPLUS_TOKEN="<TOKEN>", then opencode.
  5. Run opencode mcp list and check that xgenplus shows as connected.
  6. Test the connection: ask the assistant to "Call xgenplus_get_mailbox_profile". If it lists your permissions, the token works. If it fails with a sign-in problem, the token is wrong or the mailbox is blocked. If it says the agent can't sign in right now, check the agent in webmail: it may be paused, expired or have Login unticked.

When to use it

Arjun writes code in OpenCode at acme.in. He asks it to find this week's bug reports from customers and turn them into a task list in his project.

Configuration

Making your token
  1. In XgenPlus webmail, go to Settings › Security › AI Agents (MCP) and click Create agent password.
  2. On Your agent is ready, copy the Token for AI apps. It is already encoded, so paste it where this guide says <TOKEN>, after Bearer with one space.

Chose your own password, or need to make the token again? It is your email address and agent password joined by a colon, with no spaces, in base64. Replace the sample values with yours, run the command on your own computer, and copy the line it prints.

Windows (PowerShell):
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('you@xgenplus.com:AGENT_PASSWORD'))
Mac or Linux (Terminal):
printf '%s' 'you@xgenplus.com:AGENT_PASSWORD' | base64 | tr -d '\n'

For example, you@xgenplus.com:AGENT_PASSWORD becomes eW91QHhnZW5wbHVzLmNvbTpBR0VOVF9QQVNTV09SRA==. Base64 is not encryption: keep the token as secret as a password. Never paste it into a chat with the AI, a shared file or a code repository, and never use online base64 encoder websites, because they would receive your agent password. If your agent password contains a single quote ('), these commands break, so create a new agent password without one. More help: Make your MCP token.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "xgenplus": {
      "type": "remote",
      "url": "https://mcp.xgenplus.com/mcp",
      "enabled": true,
      "headers": { "Authorization": "Bearer {env:XGENPLUS_TOKEN}" }
    }
  }
}

Keep {env:XGENPLUS_TOKEN} exactly as shown. OpenCode fills in the token from the environment variable when it starts.

Good to know

  • OpenCode writes environment variables as {env:NAME}, not ${env:NAME} as Cursor does. With the wrong form, or with the variable not set, OpenCode sends an empty token and the server refuses the connection.
  • When the server refuses a token, OpenCode may offer an OAuth sign-in. XgenPlus does not offer OAuth sign-in yet, so check the token and the variable instead.
  • "max_tokens cannot exceed ..." errors come from your AI model's provider, not from XgenPlus. OpenCode asked for a longer answer than the model allows. Set a lower output limit for that model in opencode.json, below the provider's limit for that model:
"provider": {
  "<provider>": { "models": { "<model>": { "limit": { "context": 128000, "output": 8000 } } } }
}

Common questions

How do I keep the token for every new terminal?

On Windows, run setx XGENPLUS_TOKEN "<TOKEN>" once and open a new terminal. On Mac or Linux, add the export XGENPLUS_TOKEN="<TOKEN>" line to your shell profile.

Why are the tools called xgenplus_list_folders and so on?

OpenCode puts the server name in front of each tool name. xgenplus_list_folders is the list_folders tool from the XgenPlus server.

Was this page helpful? Updated 2026-11-03