mattermost-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mattermost CLI

Mattermost CLI

Fetch and display Mattermost messages using the
mm
command. Output is automatically redacted for safe LLM processing.
使用
mm
命令获取并显示Mattermost消息。输出会自动进行脱敏处理,以保障LLM处理的安全性。

When to Invoke Immediately

何时立即调用

Trigger this skill when the user explicitly:
  • Asks to check/read/fetch their Mattermost messages or DMs
  • Wants to see what someone said ("what did alice say about X")
  • Needs to find tasks or action items from chat
  • References a conversation they had on Mattermost
当用户明确提出以下需求时,触发该技能:
  • 要求检查/读取/获取他们的Mattermost消息或私信
  • 想查看某人的发言(例如「Alice关于X说了什么」)
  • 需要从聊天中查找任务或行动项
  • 提及他们在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
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
undefined
必须安装并配置
mm
CLI:
bash
undefined

Test if working

测试是否可用

mm channels

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 channels

如果测试失败,可通过以下方式之一配置凭据:
1. 配置文件:执行`mm config --init`,然后编辑`~/.config/mattermost-cli/config.toml`
2. 环境变量:设置`MM_URL`和`MM_TOKEN`
3. CLI参数:使用`--url`和`--token`

Commands

命令

List DM Channels

列出私信频道

bash
mm channels              # Pretty output - who have I chatted with?
mm channels --json       # Structured output
bash
mm channels              # 美观格式输出 - 我和哪些人聊过天?
mm channels --json       # 结构化输出

Fetch 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 --json                 # For parsing
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 --json                 # 用于解析的格式

Manage Configuration

管理配置

bash
mm config                # Show config status
mm config --init         # Create config file with template
mm config --path         # Print config file path
bash
mm config                # 查看配置状态
mm config --init         # 创建带模板的配置文件
mm config --path         # 打印配置文件路径

Quick Reference

速查表

TaskCommand
Recent messages
mm dms --since 24h
From specific person
mm dms -u alice
All channels list
mm channels
JSON for processing
mm dms --json
Extended history
mm dms --since 30d --limit 200
Setup config
mm config --init
任务命令
近期消息
mm dms --since 24h
特定用户的消息
mm dms -u alice
所有频道列表
mm channels
用于处理的JSON格式
mm dms --json
扩展历史记录
mm dms --since 30d --limit 200
配置初始化
mm config --init

Output Formats

输出格式

ContextFormatUse Case
Terminal (TTY)PrettyReading directly
Piped/non-TTYMarkdownPassing to tools
--json
flag
JSONParsing, analysis
场景格式使用场景
终端(TTY)美观格式直接阅读
管道/非TTYMarkdown传递给工具
--json
参数
JSON解析、分析

Date/Time Display

日期/时间显示

Dates use European format (DD Mon YYYY) and 24-hour time.
Under AI agents, relative time is enabled by default ("2 days ago" instead of "29 Jan 2026"). Override with
--no-relative
if needed.
bash
mm channels              # "2 days ago" (under agent)
mm channels --no-relative  # "29 Jan 2026"
mm channels --relative   # Force relative time
日期采用欧洲格式(DD Mon YYYY)和24小时制。
在AI Agent环境下,默认启用相对时间显示(例如「2天前」而非「29 Jan 2026」)。如有需要,可使用
--no-relative
参数覆盖该设置。
bash
mm channels              # 显示「2天前」(在Agent环境下)
mm channels --no-relative  # 显示「29 Jan 2026」
mm channels --relative   # 强制使用相对时间

Security

安全性

All secrets are automatically redacted:
  • API keys, tokens, passwords, JWTs
  • Connection strings
  • Credentials in config snippets
Example:
ghp_abc123xyz789secret
ghp_...cret
Output is safe to include in context or pass to other LLMs.
所有敏感信息会自动脱敏:
  • API密钥、令牌、密码、JWT
  • 连接字符串
  • 配置片段中的凭据
示例:
ghp_abc123xyz789secret
ghp_...cret
输出可安全地包含在上下文或传递给其他LLM。

Configuration Priority

配置优先级

Credentials are resolved in this order:
  1. CLI flags (
    --url
    ,
    --token
    )
  2. Environment variables (
    MM_URL
    ,
    MM_TOKEN
    )
  3. Config file (
    ~/.config/mattermost-cli/config.toml
    )
凭据的读取优先级如下:
  1. CLI参数(
    --url
    --token
  2. 环境变量(
    MM_URL
    MM_TOKEN
  3. 配置文件(
    ~/.config/mattermost-cli/config.toml

Error Handling

错误处理

ErrorCauseSolution
"Mattermost URL required"Not configuredRun
mm config --init
or set
MM_URL
"Mattermost token required"Not configuredEdit config file or set
MM_TOKEN
"Could not find DM channel"User doesn't exist or no DM historyCheck username spelling
Connection errorsNetwork/server issuesVerify URL is correct and accessible
错误信息原因解决方案
"Mattermost URL required"未配置执行
mm config --init
或设置
MM_URL
"Mattermost token required"未配置编辑配置文件或设置
MM_TOKEN
"Could not find DM channel"用户不存在或无私信历史检查用户名拼写
连接错误网络/服务器问题验证URL是否正确且可访问

When NOT to Use

何时不应使用

  • User is asking about Slack, Discord, or other chat platforms
  • User wants to send messages (this is read-only)
  • User needs real-time notifications (this is one-shot fetch)
  • 用户询问Slack、Discord或其他聊天平台
  • 用户想要发送消息(本工具仅支持读取)
  • 用户需要实时通知(本工具为一次性获取)

Example Workflows

示例工作流

"What did Alice say about the deployment?"

「Alice关于部署说了什么?」

bash
mm dms -u alice --since 7d
Then grep or scan output for deployment-related content.
bash
mm dms -u alice --since 7d
然后通过grep或扫描输出查找与部署相关的内容。

"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
查看输出中的行动项、请求或待办事项。

"Get context from a specific conversation"

「从特定对话中获取上下文」

bash
mm dms -u bob --limit 50 --json > /tmp/bob-chat.json
Parse JSON for relevant context to include in your response.
bash
mm dms -u bob --limit 50 --json > /tmp/bob-chat.json
解析JSON文件以提取相关上下文并用于你的回复。