threads-private-api
Provides access to Threads' private API, enabling AI agents to search posts in real time, retrieve nested discussion trees, reply to external threads, publish posts, fetch user profiles and thread feeds, and interact with trending topics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@threads-private-apisearch for recent posts about AI agents and summarize the discussion"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
threads-private-api
Unofficial Threads Private API & Trend Radar SDK for Python and TypeScript.
High-performance headless protocol engine for Threads (com.instagram.barcelona). Sub-80ms real-time keyword search, full nested discussion tree ingestion, external thread replies, and zero residential proxy cost.
Companion Project: Looking for full Instagram mobile automation, DM outreach, warmup loops, and Reels publishing? Check out instagram-private-api — Pure HTTP/2 zero-device engine with authentic Android 14 / iOS 17 JA4 TLS 1.3 signatures.
Why this instead of Official Threads API or Playwright
Feature | Official Threads API ( | Browser Scraping (Playwright / Puppeteer) | threads-private-api SDK |
Meta App Review | Mandatory (Tech Provider status required) | Not needed | Not needed |
Search Public Threads | Restricted / Closed to public apps | High latency DOM parsing | Direct Sub-80ms Real-Time Search |
Reply to External Threads | Impossible (Only own threads allowed) | Brittle DOM selectors & high ban risk | Native Protocol Direct Reply |
Nested Discussion Trees | Limited pagination | Unstable infinite scroll rendering | Full Recursive Comment Hierarchy |
RAM per Worker | Minimal (Cloud API) | 2 - 4 GB per browser instance | < 60 MB |
Residential Proxy Need | None | Mandatory (Aggressive Cloudflare/Bot IP bans) | Standard Datacenter / IPv6 Compatible |
Execution Latency | 250 - 600 ms | 3,000 - 8,000 ms | 35 - 80 ms |
Related MCP server: threads-mcp
Key Highlights
Direct Reply to Any External Thread: The official Graph API strictly blocks replying to threads created by other accounts. This SDK uses native mobile protocol endpoints to discover any thread's internal media ID and dispatch replies directly.
Sub-80ms Real-Time Ingestion: Query keyword streams, emerging topics, and brand mentions at wire speed without browser overhead.
Full Nested Reply Trees: Traverses complex multi-level conversations, quotes, parent-child comments, and author engagement metadata.
Dual Platform Hardware Presets:
Threads iOS:
Barcelona 410.2.0.33.71 (iPhone16,1; iOS 17_6_1),X-IG-App-ID: 1546306509211461.Threads Android:
Barcelona 410.2.0.33.71 Android (34/14; Samsung SM-A346B),X-IG-App-ID: 3419628305025917.
Unified Meta Auth: Shares the identical bearer token format with Instagram (
Authorization: Bearer IGT:2:...). Drive both platforms using a single unified session.Shared Social Graph: Follows, unfollows, and block states automatically reflect across both Instagram and Threads.
Installation
Python
git clone https://github.com/molkex/threads-private-api.git
cd threads-private-api
pip install -e .TypeScript / Node.js
cd ts
npm install
npm run buildQuickstart (Python)
1. Real-Time Keyword Search (<80ms)
from threadsflow import ThreadsAPI
# Unauthenticated public discovery or authenticated session
threads = ThreadsAPI(device_preset="threads_ios")
# Search public discussions in real-time
posts = threads.search_posts(query="ai agents", limit=15)
for post in posts:
print(f"[@{post.author.username}] ({post.like_count} likes): {post.caption[:80]}...")
print(f"Post ID: {post.id} | Code: {post.code}")2. Reading Nested Discussion Trees & Replying to External Threads
from threadsflow import ThreadsAPI, ThreadsSession
# Load session
session = ThreadsSession.load_from_file("session_threads.json")
threads = ThreadsAPI(session=session)
# Ingest complete nested discussion tree
tree = threads.get_thread(post_id="3141592653589793238")
print(f"Root OP by @{tree.root_post.author.username}: {tree.root_post.caption}")
for reply in tree.replies:
print(f"-> @{reply.author.username}: {reply.caption}")
# Reply directly to ANY public thread post (prohibited in official Graph API)
res = threads.reply(
parent_post_id="3141592653589793238",
text="Great perspective! We solved this with headless HTTP/2 protocol emulation."
)
print("Reply sent successfully:", res.get("status"))3. Publishing New Posts & Engagement
# Publish top-level text thread
post = threads.content.publish_text(
text="Deploying sub-80ms real-time trend radar for Threads today."
)
# Like and repost
threads.like(post_id="3141592653589793238")
threads.repost(post_id="3141592653589793238")Quickstart (TypeScript / Node.js)
import { ThreadsAPI, ThreadsSession } from "@molkex/threads-private-api";
async function run() {
const threads = new ThreadsAPI({ devicePreset: "threads_ios" });
// 1. Sub-80ms search
const posts = await threads.searchPosts("open source", 10);
for (const post of posts) {
console.log(`[@${post.author.username}] ${post.caption.slice(0, 70)}...`);
}
// 2. Fetch full discussion hierarchy
const tree = await threads.getThread("3141592653589793238");
console.log(`Root: ${tree.rootPost.caption}`);
console.log(`Replies count: ${tree.replies.length}`);
// 3. Direct reply (authenticated)
// const session = ThreadsSession.loadFromFile("session_threads.json");
// const authThreads = new ThreadsAPI({ session });
// await authThreads.reply("3141592653589793238", "Excellent breakdown!");
}
run();Model Context Protocol (MCP) Server
AI agents (Claude Desktop, Cursor, Windsurf, Antigravity) can use Threads tools directly via the built-in MCP server:
python -m threadsflow.mcp_serverTools exposed:
threads_search_posts: Sub-80ms real-time keyword searchthreads_get_discussion_tree: Extract complete nested discussion treethreads_reply_post: Reply directly to any external thread postthreads_publish_post: Publish new top-level threadthreads_user_profile: Fetch user profile by ID or usernamethreads_user_threads: Retrieve user thread feedthreads_trending_topics: Fetch real-time trending topicsthreads_like_post: Like postthreads_repost: Repost / amplify post
See AGENT_GUIDE.md for full agent configuration.
Endpoint Modules
Module | Methods & Capabilities |
|
|
|
|
|
|
|
|
|
|
Technical Documentation
Licensing & Enterprise Access
Private builds, cluster deployment packages, and custom scrapers are available for growth teams, PR monitoring platforms, and automation agencies.
Direct Inquiries: @mxmtkchk on Telegram
Enterprise Features:
Continuous persisted GraphQL doc_id synchronization service
Real-time keyword webhook daemon
High-throughput multi-account reply clusters
Custom data pipeline integration (Postgres, ClickHouse, Kafka)
For questions, pricing plans, and integration support, contact @mxmtkchk on Telegram.
Disclaimer
This repository is provided for educational and reverse-engineering research purposes only. Not affiliated with, authorized, or endorsed by Threads, Instagram, or Meta Platforms, Inc. Use responsibly and in accordance with applicable platform policies and legal requirements.
This server cannot be deployed
Maintenance
Related MCP Connectors
Threads tools for AI — generate viral posts, download videos, export profiles
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Social network for AI builders: agents post, reply, search, remix and compose in styles over MCP.
Connect Claude or any MCP client to Thread Otter, a GTM agent for founders. Free tools with no key: find_buyer_threads (give it a website URL and get recent Reddit threads where that product's buyers are asking for it, report in ~3 minutes), reddit_demand_board (weekly demand across 40 communities with thread receipts), and subreddit_rules (promotion posture for 2,000+ profiled subreddits). With an API key: read your buying-intent mentions across Reddit, X, LinkedIn, and Bluesky, check your pipeline, and propose posts and reply drafts in your voice. Propose-only by design: nothing sends without your approval flow. Keys at threadotter.com/connect.
Related MCP Servers
- AlicenseAqualityCmaintenanceUnofficial MCP server for Meta's Threads API. Enables LLMs like Claude to publish posts, manage replies, and track insights through the Model Context Protocol.15MIT
- FlicenseAqualityDmaintenanceMCP server for the Threads API, enabling profile management, content reading, publishing, replies, and discovery through 26 tools.26-
- AlicenseAqualityCmaintenanceCustom MCP server for Threads (Meta) — post, reply, and read insights via the official free Threads API.56 npmMIT
- AlicenseNot gradedqualityBmaintenanceMCP server for Meta's Threads API that enables publishing posts and reply chains, reading timelines and insights, and managing long-lived credentials with proactive refresh and safety checks.MIT