Skip to main content
Glama
Open Threads MCP Server

Open Threads MCP Server

by mkshaonexe

Open Threads 🧡

Your own Meta Threads account for AI agents: headless CLI, MCP server, and local API.

Node.js Version License: MIT MCP Compatible

Open Threads is an open-source bridge that connects your signed-in Meta Threads account to autonomous AI agents (such as Claude Code, Codex, Cursor, Antigravity, and OpenCode).

By providing a headless CLI, an MCP Server, and a local REST API, it empowers AI agents to browse feeds, scrape user profiles, analyze discussion topics, check pinned posts, publish new threads, attach media, reply, like, repost, and bookmark without needing a graphical user interface.


🌟 Key Capabilities

  • πŸ” Zero-Credential-Exposure Authentication: Log in once using a normal, visible browser session. Your cookies and profile are stored safely in ~/.open-threads/chrome-profile on your machine.

  • πŸ€– Built for AI Agents: Native Model Context Protocol (MCP) server so coding agents can invoke Threads tools directly from chat.

  • πŸ“„ Complete Profile & Pinned Post Scraping: Extract display names, handles, bios, follower counts, verified badges, avatars, profile links, and pinned threads.

  • 🧡 Full Thread & Reply Tree Inspection: Retrieve complete discussion threads, timestamps, view counts, like/reply/repost statistics, and nested replies.

  • πŸ”Ž Topic & Community Search: Discover discussions in communities (e.g. #study, #tech, #ai), with sorting by Top or Recent.

  • ✍️ Publishing & Interactions:

    • Publish threads with text and image/video uploads.

    • Reply to any thread post.

    • React/like or unlike posts.

    • Repost or quote repost.

    • Save / bookmark posts.

    • Follow or unfollow profiles.

  • ⚑ Background Daemon & Job Queue: Run open-threads serve to maintain a persistent browser instance with sub-second command response times.


Related MCP server: threads-mcp

πŸ—οΈ Architecture

+-------------------------------------------------------------+
|                     AI Coding Agents                        |
|       (Claude Code / Codex / Antigravity / Cursor)          |
+-------------------------------------------------------------+
               |                               |
       MCP (stdio)                        CLI (--json)
               |                               |
               v                               v
+-------------------------------------------------------------+
|                        open-threads                         |
|  - bin/cli.js (CLI entry point)                             |
|  - src/tools.js (MCP Server: @modelcontextprotocol/sdk)    |
|  - src/server.js (Local REST API & Background Job Queue)    |
|  - src/threads.js (Playwright / Chrome Driver & Parser)     |
+-------------------------------------------------------------+
                               |
                   CDP (127.0.0.1:9345)
                               v
+-------------------------------------------------------------+
|             Google Chrome (Persistent Profile)              |
|               ~/.open-threads/chrome-profile/               |
+-------------------------------------------------------------+
                               |
                               v
                       https://threads.net/

πŸš€ Quick Start

1. Installation

Clone and install dependencies:

git clone https://github.com/mkshaonexe/open-threads.git
cd open-threads
npm install

2. Initial Sign-in

Launch the sign-in window:

node bin/cli.js login

A visible Chrome window opens to https://www.threads.net/login. Log in using your Instagram / Threads credentials, security key, or QR code. Once signed in, Open Threads detects your authenticated state and closes the window. All future commands run headlessly.

Verify your session:

node bin/cli.js status

πŸ’» CLI Usage

All CLI commands support the --json flag for machine-readable output.

Browsing & Feeds

# Fetch Home "For You" feed (default 10 posts)
node bin/cli.js feed --limit 10

# Fetch "Following" feed
node bin/cli.js feed --filter following --limit 15 --json

Profile & Pinned Posts

# Fetch profile, bio, follower count, avatar, and pinned post
node bin/cli.js profile meta --json

# Fetch a user's recent threads
node bin/cli.js user-posts meta --limit 10

# Fetch a user's uploaded media
node bin/cli.js user-posts meta --tab media --limit 5

Inspecting Specific Posts

# View post details, view count, author, and thread replies
node bin/cli.js post DfX2w6Tndjo --json

# You can also pass the full URL
node bin/cli.js post "https://www.threads.net/@meta/post/DfX2w6Tndjo"
# Explore study-related topics and communities
node bin/cli.js topic "study" --sort top --limit 10 --json

# Explore recent posts in a topic
node bin/cli.js topic "technology" --sort recent --limit 10

# Search posts by keyword
node bin/cli.js search "artificial intelligence" --type top --limit 10

# Search user accounts by name or handle
node bin/cli.js search "google" --type user --limit 10

Creating Posts & Interactions

# Publish a new thread
node bin/cli.js create "Hello from Open Threads CLI! πŸš€"

# Publish with images or videos
node bin/cli.js create "Check out this visual architecture!" --media ./docs/architecture.png

# Reply to a thread post
node bin/cli.js reply DfX2w6Tndjo "This is very informative, thank you!"

# Like a post
node bin/cli.js like DfX2w6Tndjo

# Unlike a post
node bin/cli.js like DfX2w6Tndjo --unlike

# Repost a thread
node bin/cli.js repost DfX2w6Tndjo

# Quote a thread
node bin/cli.js repost DfX2w6Tndjo --quote "Fascinating update from the team!"

# Bookmark / save a post
node bin/cli.js save DfX2w6Tndjo

# Follow a user
node bin/cli.js follow meta

πŸ€– MCP Server Setup for AI Agents

To connect Open Threads to your AI coding agents, add the server configuration:

Configuration (mcp.json / Claude Desktop / Antigravity)

{
  "mcpServers": {
    "open-threads": {
      "command": "node",
      "args": ["/absolute/path/to/open-threads/bin/cli.js", "mcp"]
    }
  }
}

Available MCP Tools

  • threads_status: Check active sign-in status and account details.

  • threads_feed: Fetch home feed (for_you or following).

  • threads_profile: Retrieve user profile, bio, follower count, avatar, and pinned post.

  • threads_user_posts: Fetch timeline posts, replies, media, or reposts.

  • threads_post: Retrieve post detail with metrics and thread replies.

  • threads_create_post: Publish a thread with optional image/video files.

  • threads_reply: Reply to an existing thread.

  • threads_like: Like or unlike a post.

  • threads_repost: Repost or quote a post.

  • threads_save: Bookmark or unsave a post.

  • threads_delete_post: Delete a user-owned post (confirm: true).

  • threads_search: Search posts or user accounts.

  • threads_topic: Explore community topics / hashtags.

  • threads_follow: Follow or unfollow a profile.

  • threads_download: Download photo/video media to local storage.


⚑ Background HTTP Server & Daemon

To keep a single browser session warm for instant responses, start the local server:

node bin/cli.js serve --port 2795

When running, the server listens strictly on http://127.0.0.1:2795 and secures all calls with a local bearer token.

Print your local API key:

node bin/cli.js key

πŸ“ Repository Structure

open-threads/
β”œβ”€β”€ bin/
β”‚   └── cli.js                  # CLI executable and MCP stdio launcher
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ chrome.js               # Chrome lifecycle and CDP lock manager
β”‚   β”œβ”€β”€ client.js               # Client for local HTTP daemon
β”‚   β”œβ”€β”€ config.js               # Configuration and path resolution
β”‚   β”œβ”€β”€ errors.js               # Standardized error definitions
β”‚   β”œβ”€β”€ schema.js               # Zod validation schemas and method dictionary
β”‚   β”œβ”€β”€ server.js               # Local loopback HTTP REST server and job queue
β”‚   β”œβ”€β”€ threads.js              # Playwright automation driver and parser
β”‚   └── tools.js                # Model Context Protocol (MCP) server
β”œβ”€β”€ skills/
β”‚   └── open-threads/
β”‚       └── SKILL.md            # Agent Skill specification
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ config.test.js          # Config unit tests
β”‚   β”œβ”€β”€ mcp.test.js             # MCP tools unit tests
β”‚   └── schema.test.js          # Schema and validation unit tests
β”œβ”€β”€ AGENTS.md                   # AI Agent guidance rules
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ package.json
└── README.md                   # Complete documentation

πŸ›‘οΈ Ethical Usage & Security Disclosure

Open Threads is designed for personal productivity, agent-assisted automation, ethical testing, and research under user authorization. It operates on your own authenticated web session without attempting to bypass platform protections or access control mechanisms.

  • Always adhere to Meta's Terms of Service and community standards.

  • Respect rate limits and avoid spammy or high-frequency automated behavior.

  • Never store or commit private credentials, browser profiles, or cookies to public repositories.


πŸ“„ License

MIT Β© 2026 mkshaonexe

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables AI assistants to manage Instagram and Threads accounts β€” publish content, handle comments, view insights, search hashtags, and manage DMs through the Meta Graph API.
    59
    64 npm
    13
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    Enables posting and managing Threads content via Meta Threads API, including text, image, video, carousel, and replies.
    9
    51 npm
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Enables AI agents to interact with Meta Threads by fetching profile details, recent posts, post and account analytics, and conversation reply trees, as well as exporting posts as JSON for archiving or embedding.
    7
    -
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to manage a Threads profile through Meta's API, including posting, threads, replies, reply moderation, and insights.
    30
    25 npm
    2
    MIT