Managing mbm2 from the shell: providers, agents, MCP, skills, plugins, serve
These are v1's mbm management commands with the same options, output and exit codes, run by mbm2
on its own engine: with the interface open they use its engine, otherwise they start the local mBm
engine for the one command and stop it again. Run from another directory than the open
interface's, they answer for the directory they run in: mcp list shows its MCP servers,
plugin installs into its .mbm, providers and github install offer its providers; only
agent list shows the interface's agents. Commands that only change files (mcp add, skill)
need no engine. They work the same way on Linux, macOS and Windows.
| Command | Does |
|---|---|
mbm2 providers list (auth ls) |
Lists the stored credentials and the provider keys set in the environment |
mbm2 providers login [-p <provider>] [-m <method>] |
Stores an API key, or signs in to ChatGPT, for a provider the engine can use |
mbm2 providers login <url> |
Signs in to an organisation's well-known auth provider and stores its token |
mbm2 providers logout |
Removes one stored credential |
mbm2 agent list |
Lists every agent with its mode and permission rules |
mbm2 agent create [--path <dir>] [--description <text>] [--mode <mode>] [--permissions <list>] [-m <provider/model>] |
Has the model write a new agent from your description and saves it as a markdown file |
mbm2 mcp list (mcp ls) |
Lists the configured MCP servers and whether they are connected |
mbm2 mcp add |
Adds an MCP server to the project's or your global mbm.json |
mbm2 mcp auth [name], mbm2 mcp auth list |
Signs in to an MCP server that asks for OAuth, or lists each OAuth server's sign-in state |
mbm2 mcp logout [name] |
Forgets an MCP server's stored OAuth tokens and client registration |
mbm2 mcp debug <name> |
Shows an MCP server's stored credentials and tests its connection and OAuth |
mbm2 skill install [url] [name] |
Installs skills from a catalogue into ~/.config/mbm/skills |
mbm2 skill list, mbm2 skill remove <name> |
Lists or removes installed skills |
mbm2 plugin <module or directory> [-g] (plug) |
Installs a plugin package for this project, or with -g for you |
mbm2 serve [--port <n>] [--hostname <h>] [--mdns] [--cors <origin>] |
Runs the engine as a headless server until Ctrl-C |
mbm2 web [--port <n>] [--hostname <h>] [--mdns] [--cors <origin>] |
Runs the engine as a server and opens its web chat client in the browser (Web client) |
mbm2 generate |
Prints the engine's OpenAPI document with a code sample per operation |
Providers
$ mbm2 providers login -p deepseek
┌ Add credential
│
◇ Enter your API key
│ ••••••••
│
└ Done
$ mbm2 providers list
┌ Credentials ~/.local/share/mbm/mbm2/credentials.json
│
● DeepSeek api
│
● mBm api
│
└ 2 credentials
-p takes a provider id or its name (-p DeepSeek). Without -p you get a numbered list: type the
number, the id or the name. Other stores a key under an id you type, for a provider you configure
yourself in mbm.json. For mbm the key is checked with the licence service first, as mbm2 auth mbm
does; for openai choose ChatGPT Pro/Plus (browser), (headless) or Manually enter API Key, or
pass it with -m. A key can also come from a pipe:
$ printf '%s\n' "$DEEPSEEK_KEY" | mbm2 providers login -p deepseek
Signing in to a well-known auth provider
An organisation can publish its sign-in at https://<its host>/.well-known/mbm, a JSON document
such as {"auth": {"command": ["acme-login", "--print-token"], "env": "ACME_TOKEN"}}. Give mbm2 the
URL and it runs that command, keeps what the command prints as the token, and stores it under the
URL:
$ mbm2 providers login https://auth.acme.example
┌ Add credential
│
● Running `acme-login --print-token`
│
◆ Logged into https://auth.acme.example
│
└ Done
The command's own messages (a browser link, a code to type) appear in the terminal; only its output
is the token. From then on the engine gives your providers the token as ACME_TOKEN, so a provider in
mbm.json with "env": ["ACME_TOKEN"] uses it, ahead of the same variable in your environment. A
command that fails prints Failed and stores nothing (exit 0, as v1); a URL without the document is
Error: Failed to load auth provider metadata from <url>: …, exit 1. mbm2 providers list shows the
credential as <url> wellknown, and mbm2 providers logout removes it. Run only a URL you trust: its
command runs on your machine.
mbm2 providers logout lists the stored credentials and removes the one you pick. Only providers the
mBm engine can call are offered; any other name is Error: Unknown provider "<name>", exit 1.
Agents
$ mbm2 agent list
build (primary)
[
{
"permission": "*",
"pattern": "*",
"action": "allow"
},
…
Built-in agents come first, then yours by name.
mbm2 agent create asks where the agent goes (in a git project: this project's .mbm/agents, or
your global ~/.config/mbm/agents), what it should do, which permissions it keeps and its mode. The
engine's default model (or -m provider/model) writes the agent's name, when to use it and its
system prompt:
$ mbm2 agent create
┌ Create agent
│
◆ Location
│ 1. Current project (/home/me/src/app)
│ 2. Global (/home/me/.config/mbm)
└ 1
│
◇ Description
│ reviews Go code for wrapped errors
│
◇ Agent go-error-reviewer generated
│
◆ Select permissions to allow (Space to toggle)
│ 1. auto_correct
│ 2. bash
│ 3. read
…
└ 3, 5, 6
│
◆ Agent mode
│ 1. All (Can function in both primary and subagent roles)
│ 2. Primary (Acts as a primary/main agent)
│ 3. Subagent (Can be used as a subagent by other agents)
└ 3
│
◆ Agent created: /home/me/src/app/.mbm/agents/go-error-reviewer.md
│
└ Done
Press Enter at the permissions question to keep all of them; type numbers or names, separated by
commas or spaces, to keep only those. Every permission you do not keep is written as deny in the
file's front matter:
---
description: Use this agent when Go code that returns errors has been written…
mode: subagent
permission:
auto_correct: deny
bash: deny
edit: deny
…
---
You are a Go reviewer…
With --path, --description, --mode and --permissions all given (--permissions "" keeps
all), nothing is asked: the file goes to <path>/agents/ and only its path is printed. An agent of
the same name that already exists is not overwritten: Agent file already exists: <path>, exit 1.
When the model's answer is not the agent it was asked for, LLM failed to generate agent: …, exit 1.
MCP servers
$ mbm2 mcp add
┌ Add MCP server
│
◆ Location
│ 1. Current project (/home/me/src/app/mbm.json)
│ 2. Global (/home/me/.config/mbm/mbm.json)
└ 1
│
◇ Enter MCP server name
│ fs
│
◆ Select MCP server type
│ 1. Local (Run a local command)
│ 2. Remote (Connect to a remote URL)
└ 1
│
◇ Enter command to run
│ npx -y @modelcontextprotocol/server-filesystem .
│
◆ MCP server "fs" added to /home/me/src/app/mbm.json
│
└ MCP server added successfully
$ mbm2 mcp list
┌ MCP Servers
│
● ✓ fs connected
│ npx -y @modelcontextprotocol/server-filesystem .
│
└ 1 server(s)
The location question appears only inside a git project. A remote server asks for its URL and whether it needs OAuth (and a client id and secret). The file keeps its comments and other settings.
Signing in to an MCP server (OAuth)
A remote server that answers 401 Unauthorized shows as needs authentication in mbm2 mcp list
and in the TUI's /status. Sign in once:
$ mbm2 mcp auth github
┌ MCP OAuth Authentication
│
◇ Authentication successful!
│
└ Done
mbm2 opens the server's sign-in page in your browser (if it cannot, it prints the URL to open). The
engine registers itself with the server's authorization server when no oauth.clientId is
configured, uses PKCE, and receives the answer on http://127.0.0.1:19876/mcp/oauth/callback
(oauth.redirectUri changes it). The tokens are kept in the engine's data directory in
mcp-auth.json, readable only by you, and are refreshed when they expire; the server is connected
right away. A server whose authorization server cannot register clients needs a client id:
"mcp": {
"github": {
"type": "remote",
"url": "https://example.com/mcp",
"oauth": { "clientId": "your-client-id", "clientSecret": "your-client-secret" }
}
}
$ mbm2 mcp auth list
┌ MCP OAuth Status
│
● ✓ github authenticated
│ https://example.com/mcp
│
└ 1 OAuth-capable server(s)
mbm2 mcp logout github forgets the tokens and the registration. mbm2 mcp debug github prints
what is stored (the token's first 20 characters, its expiry, the client id), sends the server an
initialize request and, on a 401, says whether a sign-in would start and with which client. Set
"oauth": false on a server to send it no token and never ask.
Skills
$ mbm2 skill install https://example.com/skills review
Installed 2 file(s) from 1 skill(s) to /home/me/.config/mbm/skills
review
Restart mbm to load the new skills.
$ mbm2 skill list
review Reviews a diff for bugs and missing tests
Built-in: sessions, troubleshooting, permissions, auto-skill, rag-aware, customize-mbm, team-edit
A catalogue is a URL serving index.json ({"skills":[{"name":"review","files":["SKILL.md"]}]}) and
the files beside it. Without a URL, or with official, the catalogue is https://tui.mbm.mn/docs/skill-files,
which holds twelve shared skills: code-review, database-operations, debugging, docker-operations,
git-workflow, kubernetes-operations, nginx-tls, refactoring, security-basics, ssh-remote-ops,
systemd-services and testing-practices. mbm2 skill install official debugging installs one;
https://tui.mbm.mn/docs/skill-files/index.json lists them.
Unsafe file names (.., absolute paths) are skipped and counted. mbm2 skill remove review deletes it.
Plugins
$ mbm2 plugin ./my-plugin -g
┌ Install plugin ./my-plugin
│
◇ Plugin package ready
│
◇ Detected mcp + skills targets
│
◆ Installed ./my-plugin
│
● Scope: global (/home/me/.config/mbm)
│
└ Done
A plugin is an MCP and skills package with an mbm-plugin.json (see the interface's /plugins). A
directory is copied; any other name is fetched from npm. Without -g it is installed for this project.
mbm2 serve
$ MBM_SERVER_PASSWORD=s3cret mbm2 serve --port 4096
mbm server listening on http://127.0.0.1:4096
Without MBM_SERVER_PASSWORD on 127.0.0.1 (or localhost, ::1) the password is mbmTUI123
and mbm2 says so. On any other address, or with --mdns, mbm2 instead makes up a new random
password each time it starts and prints it once, with the user name, to stderr:
$ mbm2 serve --hostname 0.0.0.0
Generated server password for this start (username mbm): 3q2-7wVd0cJ8fN_kXyR1pLm9sT4uB6eA
The engine is reachable from the network; to choose one: MBM_SERVER_PASSWORD=<your-password> mbm2 serve
mbm server listening on http://0.0.0.0:8027
v1 used mbmTUI123 on every address, which let anyone on the network who knew it run commands
on your machine. Without --port it
listens on 8027, or any free port when 8027 is taken. Connect with
mbm2 --attach http://127.0.0.1:4096 -p s3cret. It cannot run while the interface is open on the
same data directory.
| Option | Does |
|---|---|
--hostname <host> |
Listens there instead of 127.0.0.1: 0.0.0.0 (or ::) for every network, or one address of this machine. Anyone who can reach the port can sign in with the password: without MBM_SERVER_PASSWORD it is generated and printed at each start |
--mdns |
Announces the server on the local network as mbm-<port> (_http._tcp) on the host mbm.local, so other machines find it with Bonjour or Avahi. Without --hostname it listens on 0.0.0.0; on a loopback hostname nothing is announced |
--mdns-domain <name> |
The host name announced instead of mbm.local |
--cors <origin> |
Lets a web page at that origin call the server from a browser; repeat it for more. Pages on http://localhost:<port>, http://127.0.0.1:<port> and https://*.mbm.mn are always allowed; any other origin is refused |
$ MBM_SERVER_PASSWORD=s3cret mbm2 serve --mdns --port 4096 --cors https://app.example
mbm server listening on http://0.0.0.0:4096
$ curl -i -X OPTIONS -H 'Origin: https://app.example' http://127.0.0.1:4096/session
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://app.example
Exit Codes
| Code | When |
|---|---|
0 |
The command finished, including v1's soft results such as No credentials found, a failed browser sign-in, an unknown MCP server or a failed MCP sign-in |
1 |
A usage error, an unknown provider or method, a refused key, a failed download or plugin install, a cancelled prompt (stdin closed), a serve hostname that does not resolve, a well-known URL without its document, or an engine that did not start |
Published from revision f88fc66f 2026-11-30