Mismcp Qwen Edition
opencode multi-agent bus (qwen edition): agents ask each other questions over a shared SQLite queue; single leading system message for Qwen compatibility
0
215
17 in 7 days
33.3
Multi-signal model
26 days ago
2026-09-25
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["mismcp-qwen-edition@0.5.2"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["mismcp-qwen-edition@0.5.2"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D mismcp-qwen-editionOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Run multiple opencode agents side by side and let them ask each other questions and get answers — even when each lives in its own opencode instance. mismcp is a single opencode plugin using a shared SQLite queue; no MCP server, no build step, no Node required.
agent A ──► bus.db (SQLite) ◄── agent B
▲ ▲
└── plugin delivers ───────────┘
qwen edition. This fork is adapted for users of the Qwen model family (and other OpenAI-compatible backends with strict chat templates). It keeps exactly one leading
systemmessage in every request, fixing the400 System message must be at the beginning.error that Qwen models raise when a plugin appends a second system message. See Qwen compatibility.
Distributed as a git repository (no npm package).
Install
git clone https://github.com/mdementev/mismcp-qwen-edition.git
opencode plugin /path/to/mismcp-qwen-edition
or add a local path to opencode.json (absolute, or relative to the project),
then restart opencode:
{
"plugin": ["/path/to/mismcp-qwen-edition"]
}
You can also point directly at the plugin file with "plugin": ["./plugin/mismcp.ts"],
or let opencode auto-discover it from the plugin//plugins/ directory of a
cloned project.
Qwen compatibility
Qwen chat templates (vLLM / SGLang with the stock HF template, DashScope
compatible-mode, …) reject any system message that is not the single one
at position 0:
OpenAIException / 400 BadRequestError: System message must be at the beginning.
opencode itself serialises every entry of the experimental.chat.system.transform
hook output as a separate role: "system" message, so a bus plugin that appends
the roster ("Available agents to ask via …") would otherwise turn every request
into [system, system, user, …] and Qwen models would fail on the very first
message. This edition fixes it in the plugin (upstream: anomalyco/opencode#47003):
experimental.chat.system.transform— coalesces all system fragments into a single leading system message (in-place, safe when other plugins also add to the system prompt).experimental.chat.messages.transform— defense-in-depth: merges any straysystem/developermessages in the conversation history into one entry atmessages[0](no-op for a normal user/assistant history).
Remove the plugin and the error comes back, because the second system message is gone — it is not a Qwen-side workaround around broken prompts, it is the plugin no longer introducing the offending message.
Get started
Start a couple of instances. AGENT_ID is optional — if you omit it, the plugin derives a name for you:
AGENT_ID=tester opencode
opencode # auto-named from the working directory
The plugin injects the live roster into the session context — a line like Available agents to ask via mismcp_bus_send: sut_expert — then just call the tool:
mismcp_bus_send(recipient: "sut_expert", type: "question", content: "What does the API return for an invalid token?")
Replies come back the same way (type: "answer"). Everything runs in-process inside the opencode runtime — no Node, no config, no extra services.
BUS_PATH is optional and defaults to ~/.mismcp/bus.db.
Config file
On first run the plugin creates ~/.config/opencode/mismcp.jsonc if it does not
exist yet (JSONC — comments allowed). Edit it and restart opencode to apply:
{
// Name for this agent. Tokens: {dir} {worktree} {projectId} {host} {user} {pid}.
// A 6-char base36 suffix is always appended. For a stable, suffix-free name,
// set the AGENT_ID env var instead — it wins over this file.
"nameTemplate": "{dir}-agent",
// Shared SQLite queue. Default: ~/.mismcp/bus.db. Override with the BUS_PATH env var.
"busPath": "~/.mismcp/bus.db"
}
A project can override it with <project>/.opencode/mismcp.jsonc (or .json);
the project file wins. This is read by the plugin itself, so it works no matter
how the plugin was loaded — via the plugin config array or auto-discovered from
the plugin//plugins/ directory. Set MISMCP_CONFIG_DIR to relocate the file.
Agent names
Every instance always gets a name. The first source that is set wins:
AGENT_ID— used verbatim (stable, no suffix).MISMCP_NAME_TEMPLATEenv var.nameTemplatein the config file (~/.config/opencode/mismcp.jsonc, or the project override).nameTemplateplugin option.- default
{dir}.
For template-derived names, the rendered template is normalized to [a-z0-9_-]
and a 6-character base36 suffix is always appended, so several agents can share
one directory without colliding. AGENT_ID is the exception — it is used
verbatim, with no suffix. Auto-generated names are ephemeral: they change on
every restart. Set AGENT_ID when you need a stable, addressable name.
Template tokens: {dir}, {worktree}, {projectId}, {host}, {user},
{pid}. Unknown tokens are dropped; a template that normalizes to nothing falls
back to agent. Example: MISMCP_NAME_TEMPLATE='{dir}-agent' gives names like
opencode-plugin-agent-3rkog4.
The nameTemplate plugin option is only a fallback — the config file above is
preferred, so you rarely need it:
// opencode.json — optional, only if you don't want a config file
{
"$schema": "https://opencode.ai/config.json",
"plugin": [["mismcp", { "nameTemplate": "agent-{dir}" }]]
}
Storage
Everything lives in one SQLite file — BUS_PATH, default ~/.mismcp/bus.db.
Messages and agent registrations older than 2 days are deleted automatically
(on startup and then hourly while an instance is running), so the file does not
grow without bound. Undelivered messages older than the window are dropped too.
The retention window is currently not configurable.
Examples
Ready-made launcher scripts that set the env vars for you:
- Windows: agents-startup-scripts-demo/windows —
tester.bat,analyst.bat, etc. - macOS: agents-startup-scripts-demo/mac —
tester.command,analyst.command, etc.
Each isolated/ variant gives every agent its own working directory.
License
MIT
Similar plugins
Mismcp
mismcp
opencode multi-agent bus: agents ask each other questions over a shared SQLite queue
Ocm
@wntic/ocm
Plugin marketplace for opencode: install skills, agents, commands, JS plugins and MCP servers from any git repo — once, globally, kept up to date
Qodercn Bridge
opencode-qodercn-bridge
Qoder provider plugin for OpenCode powered by the official Qoder Agent SDK, with streaming, tools, MCP, sessions, multimodal input, and quota tracking.