mattermost-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mattermost CLI

Mattermost CLI

Read-only CLI for fetching Mattermost messages. Output is automatically redacted for safe LLM processing.
一款只读CLI工具,用于获取Mattermost消息。输出会自动脱敏,以确保LLM处理的安全性。

When to Invoke Immediately

立即调用场景

Trigger this skill when the user:
  • Asks to check/read/fetch Mattermost messages, DMs, or channels
  • Wants to see what someone said ("what did alice say about X")
  • Needs to find tasks or action items from chat
  • Asks to search for something in Mattermost
  • Wants to check their mentions or unread messages
  • Needs to monitor a channel or DM in real-time
  • References a conversation or thread from Mattermost
当用户有以下需求时触发此技能:
  • 请求查看/读取/获取Mattermost消息、私信(DM)或频道内容
  • 想知道某人说了什么(比如“Alice关于X说了什么”)
  • 需要从聊天中查找任务或行动项
  • 请求在Mattermost中搜索内容
  • 想要查看提及自己的消息或未读消息
  • 需要实时监控某个频道或私信
  • 提到Mattermost中的对话或线程

When to Suggest (Don't Auto-Invoke)

建议使用场景(不自动调用)

Offer to use this skill when:
  • User mentions a task "from chat" without specifying Mattermost
  • User is looking for context that might be in messages
  • You need message history to understand a task better
  • User seems unaware of recent team discussions that might be relevant
Say: "want me to check your Mattermost messages for context?" — don't auto-invoke.
当出现以下情况时,可主动提供此技能:
  • 用户提到“来自聊天的任务”但未指定Mattermost
  • 用户正在寻找可能存在于消息中的上下文信息
  • 你需要消息历史来更好地理解某项任务
  • 用户似乎不了解可能相关的近期团队讨论
话术示例:“需要我帮你查看Mattermost消息获取上下文吗?”——不要自动调用。

Prerequisites

前置条件

The
mm
CLI must be installed and configured:
bash
mm channels  # test if working
If it fails, configure credentials using one of:
  1. Config file:
    mm config --init
    then edit
    ~/.config/mattermost-cli/config.toml
  2. Environment variables:
    MM_URL
    and
    MM_TOKEN
  3. CLI flags:
    --url
    and
    --token
必须安装并配置
mm
CLI:
bash
mm channels  # 测试是否可用
如果测试失败,可通过以下方式之一配置凭证:
  1. 配置文件:执行
    mm config --init
    ,然后编辑
    ~/.config/mattermost-cli/config.toml
  2. 环境变量:设置
    MM_URL
    MM_TOKEN
  3. CLI参数:使用
    --url
    --token

Commands

命令说明

List Channels

列出频道

bash
mm channels                  # all channels, sorted by last activity
mm channels --type dm        # DMs only
mm channels --type public    # public channels only
mm channels --type private   # private channels only
mm channels --type group     # group channels only
bash
mm channels                  # 所有频道,按最后活动时间排序
mm channels --type dm        # 仅列出私信频道
mm channels --type public    # 仅列出公开频道
mm channels --type private   # 仅列出私有频道
mm channels --type group     # 仅列出群组频道

Fetch Direct Messages

获取私信

bash
mm dms                             # all DMs, last 7 days
mm dms -u <username>               # from specific user
mm dms -u alice -u bob             # multiple users
mm dms --since 24h                 # last 24 hours
mm dms --since 30d --limit 100     # more history
mm dms -c <channel-id>             # specific DM channel by ID
mm dms --limit
is a total output cap across all matched DM channels.
bash
mm dms                             # 最近7天的所有私信
mm dms -u <username>               # 获取特定用户的私信
mm dms -u alice -u bob             # 获取多个用户的私信
mm dms --since 24h                 # 最近24小时的私信
mm dms --since 30d --limit 100     # 获取更早的历史消息(限制100条)
mm dms -c <channel-id>             # 通过ID获取特定私信频道的消息
mm dms --limit
是对所有匹配的私信频道设置的总输出上限。

Fetch Channel Messages

获取频道消息

bash
mm channel general                 # last 7 days from #general
mm channel dev-ops --team myteam   # specify team if multi-team
mm channel general --since 24h     # last 24 hours
mm channel general --limit 200     # more messages
bash
mm channel general                 # #general频道最近7天的消息
mm channel dev-ops --team myteam   # 如果是多团队环境,指定团队获取频道消息
mm channel general --since 24h     # #general频道最近24小时的消息
mm channel general --limit 200     # 获取更多消息(限制200条)

Search Messages

搜索消息

bash
mm search "deployment"                    # search across all channels
mm search "from:alice bug"                # Mattermost search syntax
mm search "in:general after:2026-01-01"   # channel + date filters
mm search "deployment" --team myteam      # scope to team
mm search "deployment" --limit 20         # limit results
bash
mm search "deployment"                    # 在所有频道中搜索
mm search "from:alice bug"                # 使用Mattermost搜索语法
mm search "in:general after:2026-01-01"   # 按频道和日期筛选
mm search "deployment" --team myteam      # 限定在指定团队内搜索
mm search "deployment" --limit 20         # 限制搜索结果数量

Check Mentions

查看提及消息

bash
mm mentions                        # messages mentioning you
mm mentions --since 24h            # recent mentions
mm mentions --channel general      # mentions in specific channel
mm mentions --team myteam          # scope to team
Mention detection uses your username plus any aliases configured in
mention_names
in the config file.
bash
mm mentions                        # 获取所有提及自己的消息
mm mentions --since 24h            # 获取最近24小时的提及消息
mm mentions --channel general      # 获取#general频道中提及自己的消息
mm mentions --team myteam          # 限定在指定团队内查看提及消息
提及检测会使用你的用户名,以及配置文件中
mention_names
字段设置的所有别名。

Unread Summary

未读消息摘要

bash
mm unread                          # list channels with unread counts
mm unread --peek 5                 # also fetch 5 messages per unread channel
mm unread --team myteam            # scope to team
Channels are sorted by mentions first, then by unread count.
bash
mm unread                          # 列出包含未读消息的频道及未读数量
mm unread --peek 5                 # 同时获取每个未读频道的最新5条消息
mm unread --team myteam            # 限定在指定团队内查看未读消息
频道排序优先级:先按提及次数排序,再按未读消息数量排序。

Watch (Real-Time)

实时监控

bash
mm watch general                   # live-stream channel messages
mm watch general --team myteam     # specify team
mm watch --dm alice                # live-stream DMs with a user
WebSocket-based, streams new messages as they arrive. Ctrl+C to stop.
bash
mm watch general                   # 实时流播频道消息
mm watch general --team myteam     # 指定团队实时流播频道消息
mm watch --dm alice                # 实时流播与指定用户的私信
基于WebSocket实现,消息到达时实时推送。按Ctrl+C停止监控。

Fetch a Thread

获取线程消息

bash
mm thread <postId>                 # fetch root post + all replies
bash
mm thread <postId>                 # 获取根帖子及所有回复

Manage Configuration

管理配置

bash
mm config                # show config status
mm config --init         # create config file template
mm config --path         # print config file path
bash
mm config                # 查看配置状态
mm config --init         # 创建配置文件模板
mm config --path         # 打印配置文件路径

Quick Reference

快速参考

TaskCommand
Recent DMs
mm dms --since 24h
DMs from specific person
mm dms -u alice
All channels list
mm channels
Channel history
mm channel general --since 7d
Search messages
mm search "deployment issue"
Check mentions
mm mentions --since 24h
Unread summary
mm unread
Unread with preview
mm unread --peek 5
Watch channel live
mm watch general
Watch DM live
mm watch --dm alice
Specific thread
mm thread <postId>
JSON for processing
mm dms --json
Setup config
mm config --init
任务命令
近期私信
mm dms --since 24h
特定用户的私信
mm dms -u alice
所有频道列表
mm channels
频道历史消息
mm channel general --since 7d
搜索消息
mm search "deployment issue"
查看提及消息
mm mentions --since 24h
未读消息摘要
mm unread
带预览的未读消息摘要
mm unread --peek 5
实时监控频道
mm watch general
实时监控私信
mm watch --dm alice
特定线程消息
mm thread <postId>
用于处理的JSON格式输出
mm dms --json
初始化配置
mm config --init

Global Options

全局选项

These apply to all commands:
FlagEffect
--json
JSON output (default: pretty terminal)
--no-color
Disable ANSI colors
-r, --relative
Relative timestamps ("2 days ago")
--no-relative
Absolute timestamps
--redact
Enable secret redaction (default)
--no-redact
Disable secret redaction
--threads
Show thread structure (default)
--no-threads
Flatten thread replies
以下选项适用于所有命令:
参数作用
--json
输出JSON格式内容(默认:终端友好的格式化输出)
--no-color
禁用ANSI颜色显示
-r, --relative
使用相对时间戳(如“2天前”)
--no-relative
使用绝对时间戳
--redact
启用敏感信息脱敏(默认开启)
--no-redact
禁用敏感信息脱敏
--threads
显示线程结构(默认开启)
--no-threads
扁平化线程回复内容

Output Formats

输出格式

ContextFormatUse Case
Terminal (TTY)PrettyReading directly — colors, grouping, thread indentation
Piped / non-TTYMarkdownPassing to other tools or LLMs
--json
flag
JSONParsing, analysis, programmatic access
Under AI agents, relative time is auto-enabled ("2 days ago" instead of "29 Jan 2026"). Override with
--no-relative
.
场景格式使用场景
终端(TTY)格式化输出直接阅读——带颜色、分组、线程缩进
管道/非TTYMarkdown格式传递给其他工具或LLM
--json
参数
JSON格式解析、分析、程序化访问
在AI Agent环境中,会自动启用相对时间(显示“2天前”而非“2026年1月29日”)。可使用
--no-relative
参数覆盖此设置。

Security

安全说明

All secrets are automatically redacted before output:
  • API keys and tokens (AWS, GitHub, GitLab, Slack, OpenAI, Anthropic, Stripe, etc.)
  • JWTs and Bearer/Basic auth headers
  • Connection strings (postgres://, mongodb://)
  • Private keys, passwords, credentials in config snippets
Masking preserves context:
ghp_abc123xyz789secret
ghp_...cret
Output is safe to include in context or pass to other LLMs. Disable with
--no-redact
if needed.
所有敏感信息会在输出前自动脱敏:
  • API密钥和令牌(AWS、GitHub、GitLab、Slack、OpenAI、Anthropic、Stripe等)
  • JWT及Bearer/Basic认证头
  • 连接字符串(postgres://、mongodb://等)
  • 私钥、密码、配置片段中的凭证信息
脱敏会保留上下文:
ghp_abc123xyz789secret
ghp_...cret
输出内容可安全地纳入上下文或传递给其他LLM。如有需要,可使用
--no-redact
参数禁用脱敏。

Configuration

配置说明

Credentials resolve in this order (first wins):
  1. CLI flags (
    --url
    ,
    --token
    )
  2. Environment variables (
    MM_URL
    ,
    MM_TOKEN
    )
  3. Config file (
    ~/.config/mattermost-cli/config.toml
    )
Config file format:
toml
url = "https://mattermost.example.com"
token = "your-personal-access-token"
redact = true
mention_names = ["Arda", "arda.sevinc"]  # aliases for mm mentions
凭证优先级(按顺序生效,前者优先):
  1. CLI参数(
    --url
    --token
  2. 环境变量(
    MM_URL
    MM_TOKEN
  3. 配置文件(
    ~/.config/mattermost-cli/config.toml
配置文件格式:
toml
url = "https://mattermost.example.com"
token = "your-personal-access-token"
redact = true
mention_names = ["Arda", "arda.sevinc"]  # 用于mm mentions命令的别名

Error Handling

错误处理

ErrorCauseSolution
"Mattermost URL required"Not configured
mm config --init
or set
MM_URL
"Mattermost token required"Not configuredEdit config or set
MM_TOKEN
"Could not find DM channel"User doesn't exist or no DM historyCheck username spelling
"Could not find channel"Channel name wrong or no accessVerify name and team
"Multiple teams found"Multi-team user without
--team
Add
--team <name>
Connection errorsNetwork/server issuesVerify URL is correct and accessible
WebSocket auth failureInvalid token for watch modeRegenerate access token
错误信息原因解决方案
"Mattermost URL required"未配置URL执行
mm config --init
或设置
MM_URL
环境变量
"Mattermost token required"未配置令牌编辑配置文件或设置
MM_TOKEN
环境变量
"Could not find DM channel"用户不存在或无私信历史检查用户名拼写
"Could not find channel"频道名称错误或无访问权限验证频道名称和所属团队
"Multiple teams found"多团队用户未指定
--team
参数
添加
--team <name>
参数
连接错误网络/服务器问题验证URL是否正确且可访问
WebSocket认证失败监控模式下令牌无效重新生成访问令牌

When NOT to Use

不适用场景

  • User is asking about Slack, Discord, or other chat platforms
  • User wants to send messages (this tool is read-only)
  • User needs webhook or bot integrations
  • 用户询问Slack、Discord或其他聊天平台的相关操作
  • 用户想要发送消息(此工具为只读工具)
  • 用户需要Webhook或机器人集成

Example Workflows

示例工作流

"What did Alice say about the deployment?"

“Alice关于部署说了什么?”

bash
mm dms -u alice --since 7d
Scan output for deployment-related content.
bash
mm dms -u alice --since 7d
扫描输出内容查找与部署相关的信息。

"Check my recent messages for any tasks"

“查看我近期的消息,看看有没有任务”

bash
mm dms --since 24h
Review output for action items, requests, or TODOs.
bash
mm dms --since 24h
检查输出内容中的行动项、请求或待办事项。

"Any mentions I missed?"

“有没有我漏掉的提及消息?”

bash
mm mentions --since 24h
Catch up on messages that tagged you.
bash
mm mentions --since 24h
查看所有@你的消息。

"What's happening in the dev channel?"

“dev频道里有什么动态?”

bash
mm channel dev --since 24h
Or for ongoing monitoring:
bash
mm watch dev
bash
mm channel dev --since 24h
或者进行实时监控:
bash
mm watch dev

"Find that discussion about the API migration"

“找到关于API迁移的讨论”

bash
mm search "API migration"
bash
mm search "API migration"

"Quick catch-up on everything unread"

“快速浏览所有未读内容”

bash
mm unread --peek 3
Shows unread channels with mention counts and previews 3 messages from each.
bash
mm unread --peek 3
显示未读频道及提及次数,并预览每个频道的3条最新消息。

"Get full context from a thread someone linked"

“获取某人分享的线程完整上下文”

bash
mm thread abc123def456
bash
mm thread abc123def456