Skip to main content

Use MetaForge from opencode

opencode can drive MetaForge as a remote MCP server. integrations/opencode/ is a package for it, generated by scripts/build_integrations.py from the same sources as the Claude Code and Codex packages and versioned with them through integrations/plugin-version.json. It is both an opencode server plugin (package.json and server.js) and a set of files install.sh copies into place. Either way it gives:

Partopencode formFrom
The metaforge MCP server, at the hosted gatewaymcp.servers.metaforge in opencode.json, type: "remote"the hosted gateway address the cloud package uses
14 slash commands, /metaforge/<name>commands/metaforge/<name>.mdthe curated workflows, with Claude Code wording adapted
3 subagentsagents/metaforge-*.md, mode: subagentthe Claude Code plugin agents
The skillsskills/metaforge/<id>/SKILL.mdthe same skills the Claude Code package ships
Working rulesmetaforge-rules.md, listed in instructionsthe rules the Claude Code SessionStart hook adds

Install​

Terminal
opencode plugin add 'github:FidelOdok/MetaForge#main::path:integrations/opencode'

This installs the package as an opencode server plugin and adds it to the global config (~/.config/opencode/opencode.json). opencode plugin add is global only, so the plugin applies to every project. When opencode starts, the plugin adds:

  • the metaforge server, unless one with that name is already configured, in which case yours is used;
  • the 14 /metaforge/<name> commands and the skills, read from the installed package rather than the working directory;
  • the three subagents;
  • the working rules, as a metaforge-rules instruction entry on each new session.

opencode plugin list shows it, opencode plugin update fetches a newer main, and opencode plugin remove takes it out. Right after the background service starts, the first plugin list or mcp list can come back empty while plugins load; run it again. The plugin is plain JavaScript with no dependencies, so there is nothing to build or fetch from npm.

Or with install.sh​

Use the install script for a single project, or when you want the command, agent and skill files in the project to read and commit:

Terminal
git clone --depth 1 https://github.com/FidelOdok/MetaForge.git
sh MetaForge/integrations/opencode/install.sh --project /path/to/your/project
# or, for every project:
sh MetaForge/integrations/opencode/install.sh --global

--project installs into the project's .opencode/ folder and --global into ~/.config/opencode/ (or $XDG_CONFIG_HOME/opencode). The script copies the commands, agents, skills and rules, then adds the metaforge server and the rules file to the opencode.json in that folder:

  • other settings are kept, and the previous file is saved as opencode.json.bak;
  • a metaforge server that is already configured is left as it is;
  • a config that still uses the V1 shape (servers directly under mcp) gets its entry in that shape;
  • an opencode.jsonc with comments is not rewritten: the script prints the entries to add and exits non-zero.

Running it again is safe. It needs python3.

Sign in​

Terminal
opencode mcp auth metaforge

Sign in with your MetaForge email and password, the ones you use on the dashboard. The gateway answers 401 and opencode runs OAuth (the gateway offers dynamic client registration), then stores the credentials outside your configuration. You reach only your own account's projects. /mcps inside opencode does the same, and opencode mcp logout metaforge signs out.

The package carries no API key and no Authorization header, and leaves OAuth on. An API key bypasses the per-account scope the sign-in gives.

Writes wait for a human​

The hosted gateway sees opencode as a remote caller, so a tool that writes is held for approval. Held calls appear on the dashboard's Approvals page, and /metaforge/approvals lists them.

Answering an approval in opencode​

opencode 2.3 does not show MetaForge's approval prompt. It receives the MCP elicitation and creates the form, but under the session global instead of the session whose tool call raised it, and the TUI only shows forms for the session you are in (reported to opencode). So the plugin adds two commands:

  • /metaforge/approve [approval id] approves the MetaForge write waiting for you. Then the agent makes the identical call again, and it runs once.
  • /metaforge/decline [reason] refuses it; the reason is recorded.

They are answered by the plugin's code, not by the model, and only when you type them. A held call's form exists only while the call waits (about 20 s), because opencode keeps no stream open between calls:

  1. Within those 20 s, /metaforge/approve answers the form and the call runs straight away.
  2. Later, /metaforge/approve finds no form, so it asks the agent to make the identical call again. The server puts the same approval to you again while that call waits (never a second approval), and you type /metaforge/approve once more to answer it.

You can always decide it on the dashboard's Approvals page instead.

Tool names​

opencode names an MCP tool <server>_<tool>, replacing anything other than letters, digits, _ and - with _. MetaForge's flow.propose is therefore metaforge_flow_propose, and under opencode's default Code Mode it is called as tools.metaforge.flow_propose(...). The skills and commands name tools by their MetaForge id; the rules file states the mapping.

The gateway's MCP prompts also appear once you are signed in, as /metaforge:<name>. They are the same workflows in client-neutral wording.

How the formats were established​

From the opencode 2.2.5 binary and the V2 documentation it points at (https://opencode.ai/v2/docs/), not the V1 documentation:

PartFormat
MCP servermcp.servers.<name>; remote servers use OAuth unless oauth: false
Commandscommand/ or commands/, **/*.md; the path below that folder is the name; frontmatter description, agent, model, subagent
Agentsagent/ or agents/, **/*.md; frontmatter description, mode (primary, subagent, all), model, permissions; name and tools are V1 fields
Skillsskills/**/SKILL.md, read natively; the id is the folder name
RulesAGENTS.md, or files listed in instructions
Pluginan npm package (here from git with ::path:), package.json with type: module and exports; the default export's id and setup(ctx); ctx.mcp, ctx.command, ctx.skill and ctx.agent transforms, session instruction entries

Agents have no add in a plugin's agent editor. update on an id that does not exist yet creates the agent, which is how opencode's own config loader adds them, so the plugin uses that.

The package was then loaded by opencode 2.2.5 with a scratch home directory, installed both per project and globally. opencode mcp list reports metaforge needs authentication, opencode debug agents lists the three agents as subagents, the server's command and skill lists include every MetaForge command and skill, and the log shows the rules file loaded from instructions with no warning about any packaged file. Signing in and calling a tool were not exercised, since they need an account.

The plugin route was checked the same way, after opencode plugin add from this repository: opencode plugin list shows metaforge and the server lists it as active; mcp list shows metaforge needs authentication, and a project that configures its own metaforge server keeps it; the command, skill and agent lists carry all 14 commands, all the skills and the three subagents; a session created through the API has the metaforge-rules instruction entry; and running metaforge/drive with an argument admits the command text with the argument after it.

What does not carry over​

  • The reminder after a held proposal. Claude Code's PostToolUse hook restates that a held flow.propose or flow.patch waits for a person. In opencode that is a line in the rules. A plugin could add it from a tool execute.after hook, but MCP tools run inside Code Mode by default and that path could not be checked without signing in.
  • Agent model choice. The Claude Code gate reviewer asks for opus; opencode wants a provider/model id, so the agents use the session's model.
  • Reasoning capture. Tool calls are recorded server-side once connected; a client plugin that sends reasoning to /sessions is not written yet. See Agent session capture.
MetaForge documentationGateway schema

ON THIS PAGE

See it end to end

A 4-layer PCB around the STM32F405RGT6, walked through six engineering disciplines on mock adapters.

Open the example