Mastodon Scout: 只读时间轴与搜索工具 - Openclaw Skills
作者:互联网
2026-04-17
什么是 Mastodon Scout?
Mastodon Scout 是一款专门设计的工具,旨在弥合 AI 代理与去中心化社交网络之间的鸿沟。它提供了一个轻量级的只读接口,用于从任何 Mastodon 实例获取主页时间轴、用户帖子和提及。通过利用 Openclaw Skills,开发者可以将实时社交数据集成到自动化工作流中,且无需承担繁重的依赖项负担,因为该技能完全依赖于 Python 标准库。
该技能优先考虑安全性和简单性。它使用具有受限只读权限的 OAuth 持久令牌运行,确保您的账户保持安全,同时为代理提供社交图谱中的必要上下文。无论您是监控技术趋势还是跟进个人提及,此技能都提供了一种清晰、可解析的方式来与 Mastodon 数据进行交互。
下载入口:https://github.com/openclaw/skills/tree/main/skills/patelhiren/mastodon-scout
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install mastodon-scout
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 mastodon-scout。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Mastodon Scout 应用场景
- 从您的 Mastodon 主页时间轴获取最新帖子以进行早间简报。
- 在 Mastodon 网络中搜索特定关键词或标签,如 "golang" 或 "AI"。
- 监控账号提及,无需打开浏览器即可掌握社区互动动态。
- 以原始 JSON 格式导出社交数据,用于进一步的程序化分析或数据归档。
- 代理或用户使用特定命令(如 home、mentions 或 search)触发脚本。
- 脚本使用存储在环境变量中的安全 OAuth 令牌向指定的 Mastodon 实例进行身份验证。
- 向 Mastodon API 发送 GET 请求以检索请求的数据子集。
- 脚本处理原始 API 响应并应用格式化逻辑。
- 最终输出以易读的列表格式或原始 JSON 对象的形式返回给用户,以便在 Openclaw Skills 框架内进一步处理。
Mastodon Scout 配置指南
要将其与 Openclaw Skills 集成,请遵循以下安装和配置步骤:
- 在您的 Mastodon 实例上,通过导航至 设置 -> 开发 生成令牌。创建一个新应用并确保仅选中 read(读取)权限。
- 在终端或配置文件中设置环境变量:
export MASTODON_TOKEN="your_access_token"
export MASTODON_INSTANCE="https://mastodon.social"
- 通过运行简单命令验证安装:
python3 ./scripts/mastodon_scout.py home --limit 5
Mastodon Scout 数据架构与分类体系
该技能将其输出组织为两种主要模式,以同时适应人类用户和自动化代理。
文本模式组织
| 字段 | 描述 |
|---|---|
| 页眉 | 显示名称、句柄和时间戳 |
| 内容 | Mastodon 帖子的文本正文 |
| 交互 | 回复、转发和收藏的计数 |
| 元数据 | 指向原始帖子的直接 URL |
JSON 模式
当使用 --json 标志时,该技能将返回来自 Mastodon API 的原始 Status 实体,保留所有原始元数据和分类法以便进行深入分析。
name: mastodon-scout
description: Read-only Mastodon skill. Outputs human-readable timeline summaries or raw JSON.
metadata: {"clawdhub":{"emoji":"??"},"clawdis":{"envVars":[{"name":"MASTODON_TOKEN","required":true},{"name":"MASTODON_INSTANCE","required":false,"default":"https://mastodon.social"}]}}
Mastodon Scout
Purpose
Read-only Mastodon skill. Fetches data from the Mastodon API via a bundled Python script (scripts/mastodon_scout.py). Returns human-readable summaries by default, or raw JSON with --json.
Invocation Rules (MANDATORY)
python3 ./scripts/mastodon_scout.py [options]
Commands
| Command | What it fetches |
|---|---|
home |
Authenticated user's home timeline |
user-tweets |
Authenticated user's own posts |
mentions |
Mentions of the authenticated user |
search |
Posts matching the query |
Options
--instance Mastodon instance base URL (default: $MASTODON_INSTANCE or https://mastodon.social)
--limit Number of items to return (default: $LIMIT or 20)
--json Output raw JSON instead of human-readable text
Environment Variables
MASTODON_TOKEN Required. OAuth bearer token.
MASTODON_INSTANCE Optional. Instance base URL (default: https://mastodon.social).
Examples
python3 ./scripts/mastodon_scout.py home
python3 ./scripts/mastodon_scout.py mentions --limit 10
python3 ./scripts/mastodon_scout.py search "golang"
python3 ./scripts/mastodon_scout.py home --json
python3 ./scripts/mastodon_scout.py home --instance https://fosstodon.org
Output Modes
Text Mode (Default)
The script formats each post as:
[N] Display Name (@user@instance) ·
? ?? ?
The agent MAY add a brief summary after the list.
JSON Mode (--json)
Returns raw Mastodon API JSON. Return it verbatim — no interpretation.
Error Handling
The script prints a human-readable error to stderr and exits non-zero:
| Condition | Message |
|---|---|
| Token missing | Error: MASTODON_TOKEN is not set |
| 401 | Mastodon API error: 401 Unauthorized — check MASTODON_TOKEN |
| 403 | Mastodon API error: 403 Forbidden |
| 422 | Mastodon API error: 422 Unprocessable Entity |
| 429 | Mastodon API error: 429 Rate Limited — try again later |
Do not retry on error. Guide the user to Authentication Setup if the token is missing or invalid.
Examples That Trigger This Skill
mastodon-scout homeshow my mastodon timelinecheck mastodon mentionssearch mastodon for "golang"get my mastodon posts
Notes
- This skill is read-only (no posting, following, or other mutations)
scripts/mastodon_scout.pyuses stdlib only — no pip install required- In JSON mode: output verbatim, no interpretation
Authentication Setup (Agent MAY Help)
EXCEPTION TO STRICT MODE: If the user needs help obtaining a token, the agent may provide guidance before executing the skill.
How to Obtain a Token:
Step 1: Access Development Settings
- Log into your Mastodon instance (e.g., mastodon.social, fosstodon.org)
- Navigate to: Settings → Development (or Preferences → Development)
- Direct URL:
https://[instance-domain]/settings/applications
Step 2: Create Application
- Click "New Application"
- Application name:
mastodon-scout(or any name) - Redirect URI:
urn:ietf:wg:oauth:2.0:oob - Scopes: CRITICAL — only select
read(uncheck write, follow, push)
- Application name:
Step 3: Get Access Token
- Click Submit, then open the created application
- Copy the "Your access token" value
Step 4: Set Environment Variable
export MASTODON_TOKEN="paste_token_here"
Step 5: Verify
python3 ./scripts/mastodon_scout.py home --limit 5
Common Mastodon Instances:
mastodon.social— General purpose (default)fosstodon.org— FOSS/tech communitymas.to— Tech focusedhachyderm.io— Tech/infosec community
Security Notes:
- Token is read-only (cannot post, follow, or delete)
- Keep token secret (don't commit to git)
- Can be revoked anytime in Development settings
- Each Mastodon instance requires its own token
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
OpenClaw 简化版安装 无冗余步骤实操指南
最新 OpenClaw 安装包 简化版安装实操指南
OpenClaw 2.6.2 核心 Skill 推荐 新手快速上手教程
【含最新安装包】OpenClaw 2.6.2 Windows 安装与配置详细教程
重磅接入!GLM-5.7登陆阿里云模型广场,解锁企业AI高效落地新范式
什么是异构算力管理平台?一文讲清核心概念、能力边界与应用价值
(包含安装包)Windows一键部署OpenClaw教程5分钟搭建本地AI智能体
效果广告中点击IP与转化IP不一致?用IP查询怎么做归因分析?
百炼 Coding Plan 是什么?售罄抢不到怎么办?附抢购技巧及平替方案
AI 英语学习 App的开发
AI精选
