Skip to main content
Glama
threads-mcp-server

threads-mcp-server

by N-Graves

threads-mcp-server

A Model Context Protocol server for the Meta Threads API.

MIT licensed.

Install

npm install -g @nasdigitaluk/threads-mcp

Related MCP server: meta-threads-mcp

Configuration

{
  "env": {
    "THREADS_ACCESS_TOKEN": "your-long-lived-token",
    "THREADS_USER_ID": "your-numeric-id"
  }
}

THREADS_USER_ID is optional — it just defaults the user_id argument. threads_get_profile with user_id: "me" will tell you yours.

Getting a token: the Threads app dashboard has a built-in User Token Generator, much simpler than a full OAuth redirect flow. It only works once the Threads account is set to public — otherwise it silently produces nothing useful rather than saying why.

⚠️ The token goes in a header, not the URL

Meta's own examples put access_token=... in the query string, and the server this replaces followed them. That puts the credential in access logs, proxy logs and browser history for every single request.

Here it is an Authorization: Bearer header, and there is a test asserting no request URL contains access_token.

Publishing is two calls, and the wait is the interesting part

Threads publishing is: create a container, wait for it to process, then publish it. Meta's guidance is to wait in between — longer for an image, because Meta fetches and processes it from a URL you supply.

The server this replaces waited a flat 30 seconds for text and 45 for an image, blocking the whole tool call regardless of whether the container was ready. That is slower than necessary in the common case and, on a slow image fetch, still not long enough.

This one polls the container's own status instead, and:

  • publishes as soon as it reports FINISHED;

  • refuses to publish a container reporting ERROR or EXPIRED, passing Meta's own reason through — publishing a broken container is how you get a post that is not there, reported as a success;

  • is bounded by attempts as well as by the clock, so a fast-responding status endpoint cannot turn the wait into a request storm;

  • falls back to waiting out the budget if Threads never returns a status field at all. That field is not guaranteed on every container type, and degrading to the old blind wait is better than refusing to publish something that would have been fine.

An image must be a public http(s) URL that Threads can fetch server-side. A local file path can never work, so it is rejected at validation rather than sixty seconds later.

What is NOT covered, and why that is stated rather than hidden

Meta publishes no machine-readable spec for the Threads API. Every other server in this family checks its catalogue against the provider's own document and fails the build when the provider adds an endpoint; that is not possible here.

So this server does not claim complete coverage. It wraps the operations that are verified working, and ships threads_call as a documented passthrough onto the rest of https://graph.threads.net/v1.0 — replies, conversations, publishing limits, mentions, reposts and anything Meta adds next. That is an honest position rather than a catalogue that quietly goes stale.

Tools

Tool

threads_get_profile

A profile. user_id: "me" finds your own id.

threads_create_post

Publish. Immediately public, no draft state.

threads_get_my_posts

Your recent posts with permalinks.

threads_get_post_insights

Views, likes, replies, reposts, quotes.

threads_delete_post

Delete your own post. Irreversible.

threads_call

Anything else on the Graph API.

Posting is a write rather than destructive — it can be deleted — but everyone who saw it still saw it, and the tool description says so. Deleting is destructive. threads_call reaches deletes, so it is destructive too.

After publishing, threads_get_my_posts is worth calling: it is how you confirm what actually went out, rather than assuming the container-then-publish sequence succeeded.

Read-only and no-destructive modes

MCP_READ_ONLY=1       refuse anything that changes state
MCP_NO_DESTRUCTIVE=1  allow posting, refuse deletes

Testing

npm test                                             # 11 tests
SMOKE_ENV='{"THREADS_ACCESS_TOKEN":"x"}' npm run smoke   # real MCP over stdio

The smoke test runs with no credentials and no private task board reachable, and every assertion is about the server's own behaviour — nothing in it touches Meta or needs an account.

Built on

@nasdigitaluk/mcp-server-core.

Licence

MIT.

Available Tools

6 tools
threads_callA

Call any Threads Graph API endpoint directly, for anything the tools above do not cover. Meta publishes no machine-readable spec for Threads, so this server does not claim a complete catalogue — this passthrough is how you reach the rest of the API without waiting for a tool to be written for it. Paths are relative to https://graph.threads.net/v1.0.

Inputs: path (required), query, method.

threads_create_postA

Publish to Threads. This is immediately public and there is no draft state — the only undo is threads_delete_post, and everyone who saw it still saw it.

An image is fetched by Threads from the URL you give, server-side, so it must be a publicly reachable http(s) URL. A local file path cannot work here.

Inputs: text (required), user_id, image_url, reply_to_id, +1 more.

threads_delete_postA

Delete one of your own posts. Irreversible.

Inputs: post_id (required).

threads_get_my_postsC

Your recent posts with their permalinks. Worth calling after publishing: it is how you confirm what actually went out rather than assuming the two-step container-and- publish sequence succeeded.

Inputs: limit, user_id.

threads_get_post_insightsC

Engagement on one of your posts: views, likes, replies, reposts, quotes.

Inputs: post_id (required).

threads_get_profileC

A Threads profile. Pass user_id='me' for the authenticated account, which is also how you find your own numeric id.

Inputs: fields, user_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct operation: profile retrieval, post creation, listing posts, insights, deletion, and a generic passthrough. The generic 'call' tool is clearly scoped as a fallback for endpoints not covered, so there is no meaningful overlap or confusion.

    Naming Consistency5/5

    All tool names follow a consistent 'threads_verb_noun' pattern, such as threads_get_profile, threads_create_post, and threads_delete_post. The naming is uniform, descriptive, and predictable across the set.

    Tool Count5/5

    With six tools, the server covers the core Threads operations without being bloated. This is a well-scoped number for the apparent domain and leaves room for the generic passthrough to handle edge cases.

    Completeness5/5

    The tool set covers the essential profile, post creation/deletion, listing, and insights workflows. The inclusion of a generic call tool ensures that any missing or future Threads API endpoints remain accessible, so there are no dead ends.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers