Threads Threads
Released已發布An open-source MCP (Model Context Protocol) server that wraps the Threads API into 6 AI-callable tools for social media content management.
一個開源的 MCP (Model Context Protocol) server,將 Threads API 包裝成 6 個 AI 可呼叫的工具,用於社群媒體內容管理。
Features功能特色
- 6 ready-to-use tools covering profile, posts, replies, mentions, publishing limits, and text posting
- MCP server (stdio JSON-RPC 2.0) — plug into Claude Code and start interacting with Threads immediately
- Minimal dependencies — built on
mcpSDK with no external API client libraries - Local stdio server — works with Claude Desktop, Claude Code, and any MCP-compatible host
- 6 ready-to-use tools covering profile, posts, replies, mentions, publishing limits, and text posting
- MCP server (stdio JSON-RPC 2.0) — plug into Claude Code and start interacting with Threads immediately
- Minimal dependencies — built on
mcpSDK with no external API client libraries - Local stdio server — works with Claude Desktop, Claude Code, and any MCP-compatible host
Quick Start快速開始
Install
pip install mcp-threads
Or use uvx (no install needed):
uvx mcp-threads serve
Set your token:
export THREADS_TOKEN="<your-token>"
Use with Claude Code
Add the server via the Claude CLI:
claude mcp add --transport stdio threads -- mcp-threads serve
Or with the environment variable inline:
claude mcp add --transport stdio threads -e THREADS_TOKEN=your_token_here -- mcp-threads serve
If you clone the repo locally, the .mcp.json config will be auto-detected by Claude Code and all 6 tools become available immediately.
Use with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"threads": {
"command": "mcp-threads",
"args": ["serve"],
"env": {
"THREADS_TOKEN": "your_token_here"
}
}
}
}
Or with uvx:
{
"mcpServers": {
"threads": {
"command": "uvx",
"args": ["mcp-threads", "serve"],
"env": {
"THREADS_TOKEN": "your_token_here"
}
}
}
}
Install
pip install mcp-threads
Or use uvx (no install needed):
uvx mcp-threads serve
Set your token:
export THREADS_TOKEN="<your-token>"
Use with Claude Code
Add the server via the Claude CLI:
claude mcp add --transport stdio threads -- mcp-threads serve
Or with the environment variable inline:
claude mcp add --transport stdio threads -e THREADS_TOKEN=your_token_here -- mcp-threads serve
If you clone the repo locally, the .mcp.json config will be auto-detected by Claude Code and all 6 tools become available immediately.
Use with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"threads": {
"command": "mcp-threads",
"args": ["serve"],
"env": {
"THREADS_TOKEN": "your_token_here"
}
}
}
}
Or with uvx:
{
"mcpServers": {
"threads": {
"command": "uvx",
"args": ["mcp-threads", "serve"],
"env": {
"THREADS_TOKEN": "your_token_here"
}
}
}
}
Available Tools可用工具
| Tool | Description |
|---|---|
threads_profile_me |
Read the authenticated Threads user profile |
threads_posts_list |
List posts created by the authenticated user |
threads_publishing_limit |
Read publishing quota usage and config |
threads_mentions_list |
List public Threads posts that mention the authenticated user |
threads_replies_list |
List replies created by the authenticated user |
threads_post_text |
Create and publish a text post or reply |
| Tool | Description |
|---|---|
threads_profile_me |
Read the authenticated Threads user profile |
threads_posts_list |
List posts created by the authenticated user |
threads_publishing_limit |
Read publishing quota usage and config |
threads_mentions_list |
List public Threads posts that mention the authenticated user |
threads_replies_list |
List replies created by the authenticated user |
threads_post_text |
Create and publish a text post or reply |
License授權
MIT
MIT
Usage ExamplesUsage Examples
User: 幫我看一下最近被提及的 Threads 貼文
Claude 會根據語意呼叫 threads_mentions_list,帶入推測出的參數:
{
"fields": ["id", "text", "timestamp"],
"limit": 10
}
Claude: 最近有 10 則 mentions,我幫你整理成可讀摘要:...
User: 幫我看一下最近被提及的 Threads 貼文
Claude 會根據語意呼叫 threads_mentions_list,帶入推測出的參數:
{
"fields": ["id", "text", "timestamp"],
"limit": 10
}
Claude: 最近有 10 則 mentions,我幫你整理成可讀摘要:...
需求需求
- Python 3.14+
- uv
THREADS_TOKEN
- Python 3.14+
- uv
THREADS_TOKEN
InstallInstall
uv sync
uv sync
如何取得 Token如何取得 Token
這個專案不會在執行時替你登入或交換 token。你需要先透過外部流程取得 Threads 的 account token,然後把它設定到 THREADS_TOKEN。
在本機開發時,你可以把 token 放進 shell 環境變數,或寫到 .env 後再透過 uv 執行指令。
這個專案不會在執行時替你登入或交換 token。你需要先透過外部流程取得 Threads 的 account token,然後把它設定到 THREADS_TOKEN。
在本機開發時,你可以把 token 放進 shell 環境變數,或寫到 .env 後再透過 uv 執行指令。
UsageUsage
作為 MCP Server(Claude Desktop / Claude Code)
專案內附有 .mcp.json,可直接給本機的 MCP host 使用:
{
"mcpServers": {
"threads": {
"command": "uv",
"args": ["run", "mcp-threads", "serve"],
"cwd": "${PWD}",
"env": {
"THREADS_TOKEN": "XXXXX"
}
}
}
}
目前會暴露六個 tool:
threads_profile_me — 讀取已驗證的 profile
回傳目前登入的 Threads 使用者資料。
threads_posts_list — 列出自己的貼文
回傳已驗證使用者建立的 Threads 貼文。
threads_publishing_limit — 讀取發文額度
回傳已驗證使用者的 quota usage 與 config。
threads_mentions_list — 列出提及你的貼文
回傳提及已驗證使用者的公開 Threads 貼文。
threads_replies_list — 列出自己的回覆
回傳已驗證使用者建立的回覆。
threads_post_text — 建立並發佈文字貼文
建立文字貼文或回覆,並立即發佈。
直接執行 CLI(除錯用)
# 顯示 CLI 說明
uv run mcp-threads --help
# 啟動 MCP stdio server
uv run mcp-threads serve
作為 MCP Server(Claude Desktop / Claude Code)
專案內附有 .mcp.json,可直接給本機的 MCP host 使用:
{
"mcpServers": {
"threads": {
"command": "uv",
"args": ["run", "mcp-threads", "serve"],
"cwd": "${PWD}",
"env": {
"THREADS_TOKEN": "XXXXX"
}
}
}
}
目前會暴露六個 tool:
threads_profile_me — 讀取已驗證的 profile
回傳目前登入的 Threads 使用者資料。
threads_posts_list — 列出自己的貼文
回傳已驗證使用者建立的 Threads 貼文。
threads_publishing_limit — 讀取發文額度
回傳已驗證使用者的 quota usage 與 config。
threads_mentions_list — 列出提及你的貼文
回傳提及已驗證使用者的公開 Threads 貼文。
threads_replies_list — 列出自己的回覆
回傳已驗證使用者建立的回覆。
threads_post_text — 建立並發佈文字貼文
建立文字貼文或回覆,並立即發佈。
直接執行 CLI(除錯用)
# 顯示 CLI 說明
uv run mcp-threads --help
# 啟動 MCP stdio server
uv run mcp-threads serve
開發與測試開發與測試
# 同步相依套件
uv sync
# 讀取自己的 profile
uv run mcp-threads me
# 列出自己的貼文
uv run mcp-threads posts --limit 10
# 讀取發文額度
uv run mcp-threads publishing-limit
# 讀取 mentions
uv run mcp-threads mentions --limit 10
# 讀取 replies
uv run mcp-threads replies --limit 10
# 發佈文字貼文
uv run mcp-threads post-text "Hello from Threads API"
# 同步相依套件
uv sync
# 讀取自己的 profile
uv run mcp-threads me
# 列出自己的貼文
uv run mcp-threads posts --limit 10
# 讀取發文額度
uv run mcp-threads publishing-limit
# 讀取 mentions
uv run mcp-threads mentions --limit 10
# 讀取 replies
uv run mcp-threads replies --limit 10
# 發佈文字貼文
uv run mcp-threads post-text "Hello from Threads API"
備註備註
- 這個專案只使用
THREADS_TOKEN,不需要其他 auth 環境變數。 - 需要 user id 時,程式會透過
/me自動取得THREADS_USER_ID。 - Threads 文字貼文上限是 500 字元。
- 貼文發佈分成兩步:先建立 container,再 publish。
serve會啟動 MCP stdio server;mcp-threads-server保留作為相容別名。
- 這個專案只使用
THREADS_TOKEN,不需要其他 auth 環境變數。 - 需要 user id 時,程式會透過
/me自動取得THREADS_USER_ID。 - Threads 文字貼文上限是 500 字元。
- 貼文發佈分成兩步:先建立 container,再 publish。
serve會啟動 MCP stdio server;mcp-threads-server保留作為相容別名。
Tags標籤
Related MCP Servers相關 MCP 伺服器
591 Real Estate 591 房地產資料
An MCP server to fetch and query real estate listings from 591.com.tw for AI assistants.
開源 MCP(Model Context Protocol) server,將台灣最大房地產平台 591 售屋網 包裝成 4 個 AI 可呼叫的 tool,支援售屋與租屋搜尋。
buy123 Vendor Portal buy123 供應商平台
Model Context Protocol server for read-only buy123 vendor portal queries
mcp-buy123-vendor 是針對 buy123 供應商後台的開源 Model Context Protocol (MCP) 伺服器。它讓 Claude Desktop、Claude Code...
CPBL Statistics 中華職棒統計
An MCP (Model Context Protocol) server that provides comprehensive statistics and data for the Chine...
一個中華職棒(CPBL)統計資料的 MCP 伺服器,透過 Model Context Protocol (MCP) 將資料查詢功能以 AI 可呼叫工具的形式對外開放。