mattermost-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMattermost CLI
Mattermost CLI
Fetch and display Mattermost messages using the command. Output is automatically redacted for safe LLM processing.
mm使用命令获取并显示Mattermost消息。输出会自动进行脱敏处理,以保障LLM处理的安全性。
mmWhen 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 CLI must be installed and configured:
mmbash
undefined必须安装并配置 CLI:
mmbash
undefinedTest 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 outputbash
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 parsingbash
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 pathbash
mm config # 查看配置状态
mm config --init # 创建带模板的配置文件
mm config --path # 打印配置文件路径Quick Reference
速查表
| Task | Command |
|---|---|
| Recent messages | |
| From specific person | |
| All channels list | |
| JSON for processing | |
| Extended history | |
| Setup config | |
| 任务 | 命令 |
|---|---|
| 近期消息 | |
| 特定用户的消息 | |
| 所有频道列表 | |
| 用于处理的JSON格式 | |
| 扩展历史记录 | |
| 配置初始化 | |
Output Formats
输出格式
| Context | Format | Use Case |
|---|---|---|
| Terminal (TTY) | Pretty | Reading directly |
| Piped/non-TTY | Markdown | Passing to tools |
| JSON | Parsing, analysis |
| 场景 | 格式 | 使用场景 |
|---|---|---|
| 终端(TTY) | 美观格式 | 直接阅读 |
| 管道/非TTY | Markdown | 传递给工具 |
| 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 if needed.
--no-relativebash
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-relativebash
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_abc123xyz789secretghp_...cretOutput is safe to include in context or pass to other LLMs.
所有敏感信息会自动脱敏:
- API密钥、令牌、密码、JWT
- 连接字符串
- 配置片段中的凭据
示例: →
ghp_abc123xyz789secretghp_...cret输出可安全地包含在上下文或传递给其他LLM。
Configuration Priority
配置优先级
Credentials are resolved in this order:
- CLI flags (,
--url)--token - Environment variables (,
MM_URL)MM_TOKEN - Config file ()
~/.config/mattermost-cli/config.toml
凭据的读取优先级如下:
- CLI参数(、
--url)--token - 环境变量(、
MM_URL)MM_TOKEN - 配置文件()
~/.config/mattermost-cli/config.toml
Error Handling
错误处理
| Error | Cause | Solution |
|---|---|---|
| "Mattermost URL required" | Not configured | Run |
| "Mattermost token required" | Not configured | Edit config file or set |
| "Could not find DM channel" | User doesn't exist or no DM history | Check username spelling |
| Connection errors | Network/server issues | Verify URL is correct and accessible |
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| "Mattermost URL required" | 未配置 | 执行 |
| "Mattermost token required" | 未配置 | 编辑配置文件或设置 |
| "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 7dThen 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 24hReview 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.jsonParse JSON for relevant context to include in your response.
bash
mm dms -u bob --limit 50 --json > /tmp/bob-chat.json解析JSON文件以提取相关上下文并用于你的回复。