Phone notifications from OpenCode

Updated December 2, 2026

Desktop notification plugins for OpenCode work great at your desk, but they never reach your phone when you run OpenCode over SSH/tmux on a remote dev box or step away during a long refactor. Wire up NextMsg in two minutes via Remote MCP or a small OpenCode plugin.

1. Connect via Remote MCP (zero local install)

Add NextMsg to your opencode.json (global ~/.config/opencode/opencode.json or project root) using the stateless remote endpoint. Set NEXTMSG_KEY in your shell from Settings → Send keys → Add send key → Copy a key:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "nextmsg": {
      "type": "remote",
      "url": "https://api.nextmsg.app/mcp",
      "headers": {
        "Authorization": "Bearer {env:NEXTMSG_KEY}"
      },
      "enabled": true
    }
  }
}

2. Or use local @nextmsg/mcp with a pairing code

If you prefer pairing with an 8-character code instead of setting an environment variable, use the local MCP package:

{
  "mcp": {
    "nextmsg": {
      "type": "local",
      "command": ["npx", "-y", "@nextmsg/mcp"],
      "enabled": true
    }
  }
}

Pair once with npx -y @nextmsg/mcp --pair K73M-QX9P (code from NextMsg → Settings → Send keys → Add send key → Use a pairing code).

3. Automatic push on session idle or error (plugin)

Want automatic phone alerts without asking the model to call a tool? Drop this file into .opencode/plugins/nextmsg.ts (or ~/.config/opencode/plugins/nextmsg.ts):

import type { Plugin } from "@opencode-ai/plugin";

async function push(message: string) {
  const key = process.env.NEXTMSG_KEY;
  if (!key) return;
  await fetch("https://api.nextmsg.app/v1/send", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${key}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ channel: "opencode", message: message.slice(0, 640) })
  }).catch(() => {});
}

export const NextMsgPlugin: Plugin = async ({ directory }) => ({
  event: async ({ event }) => {
    if (event.type === "session.idle") {
      await push(`OpenCode finished in \`${directory.split("/").pop()}\``);
    } else if (event.type === "session.error") {
      await push(`**OpenCode error** in \`${directory.split("/").pop()}\``);
    }
  }
});

More guides