工具 API 與 MCP 伺服器
具有伺服器介面的 Bluesky.bot 工具都可以從程式碼和 AI 代理程式免費使用,形式是 REST 端點和 MCP 工具。不需要註冊,也不需要密鑰。每個回應都會連結到該工具的頁面。CAR 檔案瀏覽工具明確只在本機執行:它沒有上載、API 或 MCP 介面,所以它的檔案會留在瀏覽器中。
端點
| 工具 | API | MCP 工具 |
|---|---|---|
| 回跟檢查工具 | GET /api/v1/tools/follow-back-checker?q=… | check_follow_back |
| 個人檔案分析 | GET /api/v1/tools/profile-analytics?q=… | analyse_profile_posts |
| 進階搜尋建立工具 | GET /api/v1/tools/search-builder?words=astronomy | build_bluesky_search |
| DID 查詢工具 | GET /api/v1/tools/did-finder?handle=… | find_did |
| 帳號代碼查詢工具 | GET /api/v1/tools/handle-finder?did=… | find_handle |
| Bluesky whois | GET /api/v1/tools/whois?actor=… | whois_lookup |
| 帳號年齡查詢工具 | GET /api/v1/tools/account-age?actor=… | check_account_age |
| AT-URI 轉換工具 | GET /api/v1/tools/at-uri-converter?uri=… | convert_at_uri |
| TID 解碼器 | GET /api/v1/tools/tid-decoder?tid=… | decode_tid |
| 帖文字數計算器 | GET /api/v1/tools/character-counter?text=…&numbered=true | count_post_characters |
| 富文字 facet 生成器 | GET /api/v1/tools/facet-builder?text=…&langs=en | build_post_facets |
| 自訂網域帳號代碼檢查工具 | GET /api/v1/tools/custom-handle-checker?domain=…&expected=… | check_custom_handle |
| 帳號代碼可用性查詢工具 | GET /api/v1/tools/handle-availability?name=… | check_handle_availability |
| PLC 歷史記錄檢視器 | GET /api/v1/tools/plc-history?q=…&limit=50&page=1&include_raw=false | plc_history |
| 新手包分析工具 | GET /api/v1/tools/starter-pack-analyser?q=… | analyse_starter_pack |
| 帖文與討論串檢視器 | GET /api/v1/tools/post-viewer?post=…&embed=false | view_bluesky_post |
| 動態源檢查工具 | GET /api/v1/tools/feed-inspector?feed=…&check=false | inspect_bluesky_feed |
| 標記檢查工具 | GET /api/v1/tools/label-inspector?q=…&all=false | inspect_bluesky_labels |
| 跟隨者清單匯出 | GET /api/v1/tools/follower-export?q=…&list=followers | preview_bluesky_follows |
| 自動化聲明檢查工具 | GET /api/v1/tools/bot-checker?actor=… | bot_signals |
| 儲存庫瀏覽工具 | GET /api/v1/tools/repo-explorer?q=…&cursor=…&reverse=false | explore_atproto_repo |
基礎網址是 https://bluesky.bot/api/v1。每個工具的參數和回應都列在 API 參考文件和 OpenAPI 文件 /api/v1/openapi.json 中。
回應的結構永遠相同:工具的 slug、它的頁面網址,以及它的 result。
{
"tool": "character-counter",
"url": "https://bluesky.bot/tools/character-counter",
"result": { "graphemes": 16, "bytes": 19, "over": false, "parts": [] }
}限制
- 免費且匿名: 每個 IP 位址每分鐘 60 次呼叫、每天 2,000 次。在背後發出多個請求的工具,消耗的不只一次呼叫;API 參考文件會註明。
- 使用 API 權杖: 兩者都提高為 10 倍,依帳號計算。在 Bluesky.bot 上至少有一個機械人的創作者,可以在控制台的設定 → API 和 CLI 存取權下建立權杖;命令列工具的權杖也可以使用。請以
Authorization: Bearer <token>傳送。權杖的效期是 30 天;請不要把它放在公開的程式碼中。 - 控制台權杖能做甚麼: 只能呼叫工具,別無其他。它的範圍是
tools:它無法管理你的機械人、領取或釋出帳號代碼(handle),也無法使用 CLI 的/api/v1/me/*路由,這些路由會對它回應401。 - 超過限制時,回應是
429,並附上以秒為單位的Retry-After標頭。 - 未知、過期或已撤銷的權杖會得到
401:移除該標頭即可匿名呼叫。
錯誤採用 API 一貫的結構 { "error": { "code", "message" } },代碼包括 bad_request(以及 parameter)、unauthorized、not_found、rate_limited 和 upstream_error(工具所查詢的服務沒有回應)。回應帶有 CORS 標頭,所以網頁可以呼叫它們,也帶有快取標頭:純計算(例如帖文字數計算器)會被永久快取。
範例
使用 curl,它會替你編碼文字:
curl -G "https://bluesky.bot/api/v1/tools/character-counter" \
--data-urlencode "text=Hello Bluesky! 👋"在 JavaScript 或 TypeScript 中(Node.js 18 或更新版本、Deno、Bun 或瀏覽器):
// tools-api.ts:用免費的工具 API 計算一則帖文的字數。
// 不需要密鑰。
const url = new URL("https://bluesky.bot/api/v1/tools/character-counter");
url.searchParams.set("text", "Hello Bluesky! 👋");
// 從控制台設定建立的 API 權杖
// 會把限制提高為 10 倍。
const token = process.env.BSBOT_TOKEN;
const response = await fetch(url, {
headers: token ? { Authorization: `Bearer ${token}` } : {},
});
if (response.status === 429) {
const wait = response.headers.get("Retry-After");
throw new Error(`Rate limited: retry in ${wait} s.`);
}
const answer = (await response.json()) as {
url: string;
result: { graphemes: number; graphemesLeft: number; over: boolean };
};
const { graphemes, graphemesLeft } = answer.result;
console.log(`${graphemes} graphemes, ${graphemesLeft} left. ${answer.url}`);
// 讓這個檔案成為 ES 模組,頂層 await 需要這樣做。
export {};在 Python 中,使用 requests:
# tools_api.py:用免費的工具 API 計算一則帖文的字數。
# 不需要密鑰。
import os
import requests
# 從控制台設定建立的 API 權杖
# 會把限制提高為 10 倍。
token = os.environ.get("BSBOT_TOKEN")
headers = {"Authorization": f"Bearer {token}"} if token else {}
response = requests.get(
"https://bluesky.bot/api/v1/tools/character-counter",
params={"text": "Hello Bluesky! 👋"},
headers=headers,
timeout=10,
)
if response.status_code == 429:
wait = response.headers["Retry-After"]
raise SystemExit(f"Rate limited: retry in {wait} s.")
response.raise_for_status()
answer = response.json()
result = answer["result"]
print(f"{result['graphemes']} graphemes, {result['graphemesLeft']} left. {answer['url']}")文字會放在 GET 請求的網址中傳送,而伺服器會在大約 8 KB 處截斷。較長的文字請使用 MCP 伺服器:它會在請求本文中傳送輸入內容。
MCP 伺服器
MCP 伺服器為 AI 代理程式和編輯器列出相同的工具,以及它們的輸入和輸出結構定義:https://bluesky.bot/api/mcp(Streamable HTTP,無工作階段)。每個工具都是唯讀的。適用相同的限制;在 Authorization 標頭中放入權杖即可提高限制。
一鍵連線
比起貼上權杖,更想直接登入?請改為新增 https://bluesky.bot/api/mcp/connect。你的 AI App 會開啓一個 Bluesky.bot 頁面:使用你的 Bluesky 帳號登入(我們絕不會要求你的密碼),確認 App 的名稱和它會把你送回的位址,然後核准。接着 App 會取得它自己的權杖,並自行更新。
在 Claude Code 中:
claude mcp add --transport http bluesky-bot https://bluesky.bot/api/mcp/connect在 Claude Desktop 或 claude.ai 上,用這個網址新增自訂連接器,然後選擇 Connect。在 Cursor 或 VS Code 中,把它設為下方設定的 url,然後在編輯器要求時登入。
- App 會取得
tools範圍:可以使用工具,當你在 Bluesky.bot 上有機械人時,還能享有你帳號的較高限制。它無法發文、管理你的機械人或領取帳號代碼。 - 你核准過的 App 會被記住。隨時都可以在設定 → 已連結的應用程式下撤銷;在所有裝置登出和刪除你的帳號都會撤銷所有 App。
- 只有少數知名的 App 會標示為已驗證。對於其他 App,請在核准之前確認它會把你送回的位址。
https://bluesky.bot/api/mcp不登入也能繼續使用。
在 Claude Code 中:
claude mcp add --transport http bluesky-bot https://bluesky.bot/api/mcp在 Cursor(.cursor/mcp.json)、VS Code(.vscode/mcp.json,以 "servers" 取代 "mcpServers")和大多數其他用戶端中:
{
"mcpServers": {
"bluesky-bot": { "url": "https://bluesky.bot/api/mcp" }
}
}在 Claude Desktop 或 claude.ai 上,用相同的網址把它新增為自訂連接器。使用權杖時,請加上標頭:在 Claude Code 中使用 --header "Authorization: Bearer $BSBOT_TOKEN",或在 JSON 設定中的 url 旁加上 "headers": { "Authorization": "Bearer …" }。絕對不要提交含有權杖的設定檔:請把權杖放在環境變數中,或放在用戶端的私人設定裏。
會傳送甚麼、會保留甚麼
你傳給工具的內容只會用來產生回應:它絕不會被儲存,也會從我們的錯誤報告中移除。API 呼叫會把它放在網址中傳送:我們伺服器的請求日誌會略過這些網址,但它們會經過承載本站流量的 Cloudflare 網絡。MCP 則會在請求本文中傳送,沒有任何請求日誌會保留本文:處理敏感文字時,你可能會比較偏好這種方式。分析只會計算呼叫了哪個工具、從哪裏呼叫(頁面、API 或 MCP),以及結果如何。需要查詢資料的工具,會把輸入內容傳送到它所需的公開服務,就和它的頁面一樣。請參閱私隱政策。