mattermost
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMattermost CLI (mm
)
mmMattermost CLI(mm
)
mmRead and search Mattermost from the command line. JSON output by default, for markdown.
--human从命令行读取和搜索Mattermost内容。默认输出JSON格式,使用参数可输出markdown格式。
--humanSetup
安装配置
Check if is already available:
mmbash
mm whoamiIf that works, skip to "Start here" below.
If is not found, install it. Pick whichever works in your environment:
mmbash
pip install mattermost-cli # adds `mm` to PATH检查是否已可用:
mmbash
mm whoami如果命令正常执行,直接跳至下方的「入门」部分。
如果未找到,请进行安装。选择适合你环境的方式:
mmbash
pip install mattermost-cli # 将`mm`添加至PATHor
或
pipx install mattermost-cli # isolated global install
pipx install mattermost-cli # 隔离式全局安装
or
或
uvx --from mattermost-cli mm # run without installing (needs uvx)
Then authenticate (one-time):
```bash
mm login --url https://your.mattermost.server
mm whoami # verifyThe login command will prompt for credentials interactively. If your server supports Personal Access Tokens (Profile > Security > Personal Access Tokens in the Mattermost UI), you can skip the prompt:
bash
mm login --url https://your.mattermost.server --token YOUR_TOKENFor environment variables, multiple servers, and troubleshooting, see references/setup.md.
uvx --from mattermost-cli mm # 无需安装直接运行(需要uvx)
然后进行一次性身份验证:
```bash
mm login --url https://your.mattermost.server
mm whoami # 验证登录状态登录命令会交互式提示输入凭据。如果你的服务器支持个人访问令牌(在Mattermost界面中进入「个人资料 > 安全 > 个人访问令牌」),可跳过提示直接登录:
bash
mm login --url https://your.mattermost.server --token YOUR_TOKEN关于环境变量、多服务器配置和故障排查,请查看references/setup.md。
Start here: mm overview
mm overview入门:mm overview
mm overviewAlways run this first. It returns mentions, unread channels, and active channels in a single call.
bash
mm overview # last 6 hours (default)
mm overview --since 1d # last 24 hoursThe response has three sections:
- mentions - posts that @-mention you, with root message context when it's a reply
- unread - channels with unread messages, sorted by count
- active_channels - channels with recent posts, sorted by recency
Each entry includes a field you can pass directly to other commands.
ref请先运行此命令。它会一次性返回提及提醒、未读频道和活跃频道信息。
bash
mm overview # 最近6小时(默认)
mm overview --since 1d # 最近24小时响应包含三个部分:
- mentions - 提及你的帖子,如果是回复则包含根消息上下文
- unread - 包含未读消息的频道,按未读消息数量排序
- active_channels - 有近期帖子的频道,按更新时间排序
每个条目都包含一个字段,可直接传递给其他命令使用。
refReading messages
读取消息
bash
mm messages <channel> # last 30 messages, chronological
mm messages <channel> --since 2h # messages from last 2 hours
mm messages <channel> --threads # thread index: root + reply count + last reply
mm messages @username # DMs with someone<channel>off-topic@usernamebash
mm messages <channel> # 最近30条消息,按时间顺序排列
mm messages <channel> --since 2h # 最近2小时的消息
mm messages <channel> --threads # 线程索引:根消息 + 回复数 + 最新回复
mm messages @username # 与指定用户的私信<channel>off-topic@usernameThreads
对话线程
Every post includes a . Use it to read the full conversation:
thread_idbash
mm thread <thread_id> # root + last 9 replies
mm thread <thread_id> --limit 0 # entire thread
mm thread <thread_id> --since 1h # just recent replies (root always included)每条帖子都包含字段,可用于读取完整对话:
thread_idbash
mm thread <thread_id> # 根消息 + 最新9条回复
mm thread <thread_id> --limit 0 # 完整对话线程
mm thread <thread_id> --since 1h # 仅显示近期回复(始终包含根消息)Searching and mentions
搜索与提及提醒
bash
mm search "deployment issue"
mm search "from:alice in:devops after:2025-01-01"
mm mentions # @-mentions in last 24h
mm mentions --since 3dMentions for replies include a field with the original message, so you know what "this" or "it" refers to without a follow-up call.
rootbash
mm search "deployment issue"
mm search "from:alice in:devops after:2025-01-01"
mm mentions # 最近24小时内的@提及提醒
mm mentions --since 3d回复中的提及提醒包含字段,即被回复的原始消息,因此无需额外调用即可了解“this”或“it”指代的内容。
rootChannel context
频道信息
bash
mm channel <name> # purpose, header, member/pinned count
mm pinned <channel> # important/pinned posts
mm members <channel> # who's here + online status
mm channels --since 6h # all channels with recent activity
mm channels --type dm # just DMsbash
mm channel <name> # 频道用途、头部信息、成员/置顶帖子数量
mm pinned <channel> # 重要/置顶帖子
mm members <channel> # 频道成员及在线状态
mm channels --since 6h # 所有有近期活动的频道
mm channels --type dm # 仅显示私信频道People
用户信息
bash
mm user @someone # profile, role, status, timezonebash
mm user @someone # 用户资料、角色、状态、时区Key JSON fields
核心JSON字段
Every post includes these fields so you can navigate without guesswork:
| Field | What it's for |
|---|---|
| Pass to |
| On channel entries; pass to |
| Webhook and bot posts are flagged automatically |
| On reply-mentions; the original message being replied to |
| Thread structure |
| Emoji counts like |
Bot posts from webhooks automatically extract alert content from Slack-format attachments, so you see the actual alert text instead of empty messages.
每条帖子都包含以下字段,方便你无需猜测即可导航:
| 字段 | 用途 |
|---|---|
| 传递给 |
| 频道条目包含此字段;传递给 |
| 自动标记Webhook和机器人发布的帖子 |
| 回复提及提醒包含此字段;即被回复的原始消息 |
| 对话线程结构信息 |
| 表情计数,例如 |
来自Webhook的机器人帖子会自动从Slack格式的附件中提取告警内容,因此你看到的是实际告警文本而非空消息。
Further reading
拓展阅读
- references/scenarios.md - real use cases: "what did I miss?", "summarize this channel", "is this resolved?", "find that thing someone said"
- references/workflows.md - command sequences: morning triage, incident investigation, channel discovery
- references/commands.md - full command reference with all options and flags
- references/scenarios.md - 实际用例:“我错过了什么?”、“总结此频道内容”、“问题是否已解决?”、“找到某人说过的内容”
- references/workflows.md - 命令序列:晨间巡检、事件调查、频道发现
- references/commands.md - 完整命令参考,包含所有选项和参数