There's no good CLI for Mattermost. mmctl is admin-only — server management, not messaging. Matterhorn is a TUI that takes over your terminal. Neither one lets you script a bot posting to a channel, search messages, upload a file, or fire a webhook from a shell script.

So I built one. 17 commands, zero required dependencies, two binaries (mattercli and mm).

npm · GitHub

Install

npm install -g mattercli

Setup

mattercli init

Interactive — asks for your Mattermost URL, bot token or PAT, and team name. Saves to ~/.mattercli/config.json (chmod 600). Or use environment variables if you prefer:

export MATTERCLI_URL=https://mattermost.example.com
export MATTERCLI_TOKEN=your-token

What It Does

mm post general "deploy started"          # post to a channel
mm dm @clifford "check the logs"          # direct message
mm recent general 10                      # last 10 messages
mm search "deployment failed"             # full-text search
mm thread <post-id>                       # view a thread
mm thread <post-id> "on it"               # reply to a thread
mm mentions                               # your @mentions
mm channels                               # list joined channels
mm react <post-id> rocket                 # add a reaction
mm upload general ./report.pdf "Q2 data"  # file upload
mm status dnd                             # set status
mm webhook send <url> "alert fired"       # fire a webhook
mm watch general                          # live stream a channel

Every command supports --json for scripting:

POST_ID=$(mm post general "deploy started" --json | jq -r '.id')
mm react "$POST_ID" rocket

Multi-Server

Run mattercli init multiple times to add servers. Switch with --server:

mm --server work post general "hello"
mm --server personal dm @friend "hey"

Channel Aliases

Tired of typing town-square? Set aliases:

mm alias set ts town-square
mm alias set k knowledge
mm post ts "short and sweet"

Zero Dependencies

The entire CLI uses Node's built-in crypto and native fetch. The only optional dependency is ws for mattercli watch (WebSocket live streaming). Everything else works out of the box with Node 18+.

Why I Built It

We run Mattermost at Abeedoo for cross-project coordination. Our Claude agents post findings to shared channels, and I needed a way to script those interactions without pulling in SDKs or writing fetch wrappers every time. mattercli is that script.

This post's announcement was sent to our #knowledge channel using mattercli itself.

npm install -g mattercli