mattermost-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMattermost 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 CLI must be installed and configured:
mmbash
mm channels # test if workingIf it fails, configure credentials using one of:
- Config file: then edit
mm config --init~/.config/mattermost-cli/config.toml - Environment variables: and
MM_URLMM_TOKEN - CLI flags: and
--url--token
必须安装并配置 CLI:
mmbash
mm channels # 测试是否可用如果测试失败,可通过以下方式之一配置凭证:
- 配置文件:执行,然后编辑
mm config --init~/.config/mattermost-cli/config.toml - 环境变量:设置和
MM_URLMM_TOKEN - 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 onlybash
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 IDmm dms --limitbash
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 --limitFetch 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 messagesbash
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 resultsbash
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 teamMention detection uses your username plus any aliases configured in in the config file.
mention_namesbash
mm mentions # 获取所有提及自己的消息
mm mentions --since 24h # 获取最近24小时的提及消息
mm mentions --channel general # 获取#general频道中提及自己的消息
mm mentions --team myteam # 限定在指定团队内查看提及消息提及检测会使用你的用户名,以及配置文件中字段设置的所有别名。
mention_namesUnread 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 teamChannels 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 userWebSocket-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 repliesbash
mm thread <postId> # 获取根帖子及所有回复Manage Configuration
管理配置
bash
mm config # show config status
mm config --init # create config file template
mm config --path # print config file pathbash
mm config # 查看配置状态
mm config --init # 创建配置文件模板
mm config --path # 打印配置文件路径Quick Reference
快速参考
| Task | Command |
|---|---|
| Recent DMs | |
| DMs from specific person | |
| All channels list | |
| Channel history | |
| Search messages | |
| Check mentions | |
| Unread summary | |
| Unread with preview | |
| Watch channel live | |
| Watch DM live | |
| Specific thread | |
| JSON for processing | |
| Setup config | |
| 任务 | 命令 |
|---|---|
| 近期私信 | |
| 特定用户的私信 | |
| 所有频道列表 | |
| 频道历史消息 | |
| 搜索消息 | |
| 查看提及消息 | |
| 未读消息摘要 | |
| 带预览的未读消息摘要 | |
| 实时监控频道 | |
| 实时监控私信 | |
| 特定线程消息 | |
| 用于处理的JSON格式输出 | |
| 初始化配置 | |
Global Options
全局选项
These apply to all commands:
| Flag | Effect |
|---|---|
| JSON output (default: pretty terminal) |
| Disable ANSI colors |
| Relative timestamps ("2 days ago") |
| Absolute timestamps |
| Enable secret redaction (default) |
| Disable secret redaction |
| Show thread structure (default) |
| Flatten thread replies |
以下选项适用于所有命令:
| 参数 | 作用 |
|---|---|
| 输出JSON格式内容(默认:终端友好的格式化输出) |
| 禁用ANSI颜色显示 |
| 使用相对时间戳(如“2天前”) |
| 使用绝对时间戳 |
| 启用敏感信息脱敏(默认开启) |
| 禁用敏感信息脱敏 |
| 显示线程结构(默认开启) |
| 扁平化线程回复内容 |
Output Formats
输出格式
| Context | Format | Use Case |
|---|---|---|
| Terminal (TTY) | Pretty | Reading directly — colors, grouping, thread indentation |
| Piped / non-TTY | Markdown | Passing to other tools or LLMs |
| JSON | Parsing, analysis, programmatic access |
Under AI agents, relative time is auto-enabled ("2 days ago" instead of "29 Jan 2026"). Override with .
--no-relative| 场景 | 格式 | 使用场景 |
|---|---|---|
| 终端(TTY) | 格式化输出 | 直接阅读——带颜色、分组、线程缩进 |
| 管道/非TTY | Markdown格式 | 传递给其他工具或LLM |
| JSON格式 | 解析、分析、程序化访问 |
在AI Agent环境中,会自动启用相对时间(显示“2天前”而非“2026年1月29日”)。可使用参数覆盖此设置。
--no-relativeSecurity
安全说明
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_abc123xyz789secretghp_...cretOutput is safe to include in context or pass to other LLMs. Disable with if needed.
--no-redact所有敏感信息会在输出前自动脱敏:
- API密钥和令牌(AWS、GitHub、GitLab、Slack、OpenAI、Anthropic、Stripe等)
- JWT及Bearer/Basic认证头
- 连接字符串(postgres://、mongodb://等)
- 私钥、密码、配置片段中的凭证信息
脱敏会保留上下文: →
ghp_abc123xyz789secretghp_...cret输出内容可安全地纳入上下文或传递给其他LLM。如有需要,可使用参数禁用脱敏。
--no-redactConfiguration
配置说明
Credentials resolve in this order (first wins):
- CLI flags (,
--url)--token - Environment variables (,
MM_URL)MM_TOKEN - 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凭证优先级(按顺序生效,前者优先):
- CLI参数(、
--url)--token - 环境变量(、
MM_URL)MM_TOKEN - 配置文件()
~/.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
错误处理
| Error | Cause | Solution |
|---|---|---|
| "Mattermost URL required" | Not configured | |
| "Mattermost token required" | Not configured | Edit config or set |
| "Could not find DM channel" | User doesn't exist or no DM history | Check username spelling |
| "Could not find channel" | Channel name wrong or no access | Verify name and team |
| "Multiple teams found" | Multi-team user without | Add |
| Connection errors | Network/server issues | Verify URL is correct and accessible |
| WebSocket auth failure | Invalid token for watch mode | Regenerate access token |
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| "Mattermost URL required" | 未配置URL | 执行 |
| "Mattermost token required" | 未配置令牌 | 编辑配置文件或设置 |
| "Could not find DM channel" | 用户不存在或无私信历史 | 检查用户名拼写 |
| "Could not find channel" | 频道名称错误或无访问权限 | 验证频道名称和所属团队 |
| "Multiple teams found" | 多团队用户未指定 | 添加 |
| 连接错误 | 网络/服务器问题 | 验证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 7dScan output for deployment-related content.
bash
mm dms -u alice --since 7d扫描输出内容查找与部署相关的信息。
"Check my recent messages for any tasks"
“查看我近期的消息,看看有没有任务”
bash
mm dms --since 24hReview output for action items, requests, or TODOs.
bash
mm dms --since 24h检查输出内容中的行动项、请求或待办事项。
"Any mentions I missed?"
“有没有我漏掉的提及消息?”
bash
mm mentions --since 24hCatch up on messages that tagged you.
bash
mm mentions --since 24h查看所有@你的消息。
"What's happening in the dev channel?"
“dev频道里有什么动态?”
bash
mm channel dev --since 24hOr for ongoing monitoring:
bash
mm watch devbash
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 3Shows 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 abc123def456bash
mm thread abc123def456