Threads API MCP Server
Provides tools for interacting with a user's Threads account via the Meta Threads Graph API, including fetching profile info, recent posts, post details, engagement analytics, and replies.
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 API MCP Servershow me my recent Threads posts with their engagement metrics"
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 API MCP Server
A lightweight, production-ready FastMCP server in Python that interfaces with the Meta Threads Graph API (https://graph.threads.net/v1.0).
This server exposes specialized MCP tools for AI agents (such as Hermes Agent, Claude Desktop, Cursor, or Antigravity) to fetch profile details, inspect recent posts, retrieve post engagement analytics (views, likes, replies, reposts, quotes), and traverse conversation reply trees.
Features & MCP Tools
Tool Name | Parameters | Description |
| None | Retrieves authenticated user ID, username, bio, avatar URL, and web profile URL. |
|
| Fetches recent user posts with full text, media type, timestamps, permalinks, and pagination cursor. |
|
| Retrieves detailed metadata for a single Threads post. |
|
| Returns breakdown of views, likes, replies, reposts, and quotes for a given post. |
|
| Fetches aggregated account-level metrics over a timeframe. |
|
| Retrieves top-level and nested replies for a post. |
|
| Exports posts as a flat, clean JSON list ready for archiving or vector embedding indexing. |
Related MCP server: Thread Analyzer MCP Server
Tech Stack & Architecture
Python 3.11+ managed with
uvMCP SDK:
mcp(FastMCP interface)HTTP Client:
httpx(async client with exponential backoff & rate limit handling)Validation & Schemas:
pydanticv2Configuration:
pydantic-settings/.env
Quickstart & Setup
1. Prerequisites
Ensure you have Python 3.11+ and uv installed:
# Verify uv installation
uv --version2. Environment Configuration
Copy the sample .env.example file and provide your Meta Threads Graph API credentials:
cp .env.example .envEdit .env:
# Meta Threads User Access Token (Required)
THREADS_ACCESS_TOKEN=your_long_lived_threads_token_here
# User ID (Optional, default: "me")
THREADS_USER_ID=me
# API Base URL (Optional)
THREADS_API_BASE_URL=https://graph.threads.net/v1.0To obtain a long-lived Threads Access Token, create an application in theMeta for Developers Portal, add the Threads API use case, and grant the following permissions:
threads_basicthreads_content_publishthreads_read_repliesthreads_manage_repliesthreads_manage_insights
Running the Server
Stdio Transport (Standard MCP)
uv run python -m threads_mcp.serverOr using the CLI entrypoint:
uv run threads-mcpAgent Configurations
1. Hermes Agent (~/.hermes/config.yaml)
mcp_servers:
threads:
command: "uv"
args:
- "--directory"
- "/absolute/path/to/threads-mcp"
- "run"
- "python"
- "-m"
- "threads_mcp.server"
env:
THREADS_ACCESS_TOKEN: "your_long_lived_threads_token_here"2. Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"threads": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\Влад\\Desktop\\treads-mcp",
"run",
"python",
"-m",
"threads_mcp.server"
],
"env": {
"THREADS_ACCESS_TOKEN": "your_long_lived_threads_token_here"
}
}
}
}Running Tests
Run the test suite with uv run pytest:
uv run pytest tests/ -vError Handling
OAuth & Auth Expiration (401 / code 190): Caught and returned as readable instructions to refresh tokens.
Rate Limiting (429 / codes 4, 17, 32, 613): Automatic exponential backoff retries.
Unsupported Insights: Gracefully handles media types that do not support specific insight metrics without crashing.
Available Tools
7 toolsexport_postsA
Export recent posts formatted as a clean flat JSON list for archiving, analysis, or vector embeddings.
Args: limit: Number of posts to export (default 50, max 100).
Returns: JSON string containing flat simplified post items with ID, text, timestamp, and URL.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral disclosure burden. It usefully states the return type and included fields (ID, text, timestamp, URL), but it does not disclose that the operation is read-only, nor does it clarify what 'recent' means or mention potential rate limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well organized, leading with the purpose, then providing the argument contract, then the return summary. Every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with an output schema, the description covers purpose, parameter semantics, and return content. The only notable gaps are the ambiguity of 'recent' and the lack of stated read-only behavior, but these are minor given the tool's simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema only provides a default value, while the description explains the parameter's meaning, default, and maximum. This fully compensates for the 0% schema description coverage and gives an agent everything it needs to set the limit correctly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (export), the resource (recent posts), and the output format (flat JSON list), with explicit use cases like archiving, analysis, and vector embeddings. It does not explicitly differentiate itself from the sibling list_recent_posts, which likely has a similar scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear use-case context ('for archiving, analysis, or vector embeddings'), which implies when the tool is appropriate. However, it does not mention when not to use it or explicitly identify alternatives like list_recent_posts or get_post_details.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
fetch_post_repliesA
Fetch replies and comments attached to a specific Threads post.
Args: media_id: Unique Threads post/media ID. reverse_sort: If True, returns newest replies first. If False, returns chronological order. limit: Max replies to fetch (default 50). after: Pagination cursor for next page of replies.
Returns: JSON string containing list of replies (id, text, timestamp, username, permalink) and cursors.
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | ||
| limit | No | ||
| media_id | Yes | ||
| reverse_sort | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral burden, and it does so well. It discloses the read-only nature ('Fetch'), sorting behavior, pagination cursor semantics, default limit, and the exact shape of the response. It does not cover rate limits or error conditions, but those are not essential for a straightforward fetch tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The summary sentence is front-loaded and the Args/Returns sections are compact and relevant. Every line contributes useful information without fluff or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a four-parameter read operation with no annotations, the description is complete enough to call the tool correctly. It covers all required inputs, optional behaviors, and the returned data structure. The existence of an output schema further reduces the burden on the description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must fully compensate. It defines every parameter: media_id is the unique post ID, reverse_sort controls ordering, limit caps replies, and after is the pagination cursor. This adds meaningful semantics beyond property names and defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Fetch replies and comments attached to a specific Threads post.' This clearly distinguishes the tool from siblings like get_post_details, list_recent_posts, and get_post_analytics, which target different data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied through the description: an agent can infer this tool is for retrieving replies to a specific post. However, there is no explicit guidance on when to prefer it over alternatives, no exclusions, and no mention of related sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_account_analyticsA
Fetch aggregated engagement metrics for the account over a specified time window.
Args: metric_types: List of metrics (e.g. ["views", "likes", "reposts", "quotes", "followers_count"]). days_back: Number of past days to query (default: 7).
Returns: JSON string containing aggregated metric totals.
| Name | Required | Description | Default |
|---|---|---|---|
| days_back | No | ||
| metric_types | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of disclosing behavior. It states that the result is a JSON string of aggregated metric totals and describes both parameters, which is useful. However, it does not clarify the meaning of the null default for metric_types, whether days_back is inclusive, or what happens on empty results.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and organized into Args and Returns sections. Every sentence contributes value, with the main purpose stated first and no filler or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-optional-parameter analytics fetch, the description covers the key invocation details, and an output schema exists to cover return structure. The main gaps are edge-case semantics like null metric_types and time-window boundaries, but these are minor for typical agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must add meaning. It does this well by explaining metric_types with concrete examples and days_back with its meaning and default value. It falls short only by not stating behavior when metric_types is null or whether the list is exhaustive.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Fetch') and clearly identifies the resource ('aggregated engagement metrics for the account') with a time-window scope. This distinguishes it from siblings like get_post_analytics, which operate at the post level. The purpose is immediately understandable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly establishes the tool's context: account-level analytics over a specified time window, which guides an agent toward this tool when account-wide metrics are needed. It does not explicitly name alternatives or exclusions, but the account-versus-post distinction is evident from the phrasing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_post_analyticsA
Fetch engagement analytics (views, likes, replies, reposts, quotes) for a specific post.
Args: media_id: Unique Threads post/media ID.
Returns: JSON string containing numeric metrics (views, likes, replies, reposts, quotes) and raw data.
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It discloses the return shape (JSON string), the metrics included, and mentions raw data. It does not cover error behavior, rate limits, or auth requirements, but for a simple read/fetch operation this is reasonably transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded, with clear Args and Returns sections. It slightly repeats the metric list in both the summary and the return description, but overall it is well-structured and economical.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter read tool with return information included, this description is largely complete. It explains what the tool does, what parameter is required, and what the caller should expect back. It lacks explicit alternative routing, but that is not essential to invoking it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does define media_id as a 'Unique Threads post/media ID', which adds domain meaning beyond the bare schema, but it offers no example or format guidance.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Fetch') and resource ('engagement analytics for a specific post'), and lists the exact metrics returned. This clearly distinguishes it from account-level analytics and post-details tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'for a specific post' gives clear context for when to use this tool, implicitly separating it from get_account_analytics. However, it does not explicitly name alternatives or state when not to use them.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_post_detailsA
Fetch detailed metadata for a single Threads post.
Args: media_id: Unique Threads post/media ID.
Returns: JSON string with post content, author username, timestamp, permalink, and media info.
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral disclosure burden. 'Fetch' conveys a read-only operation and the return format is specified, but there is no mention of auth requirements, errors, rate limits, or other behavioral caveats. For a simple get-by-id tool, this is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well-organized: a one-sentence purpose, an Args block, and a Returns block. Every sentence earns its place, and the core purpose appears first.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a straightforward single-ID fetch with one required parameter and an output schema present, the description covers what the agent needs to invoke it correctly. Missing sibling differentiation and behavioral caveats are minor given the tool's low complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must define the parameter. It does so with 'media_id: Unique Threads post/media ID,' adding a domain meaning that the schema alone lacks. A concrete example or format hint would make it stronger, but the single parameter is well explained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb and resource: 'Fetch detailed metadata for a single Threads post.' It also lists the returned fields, which clarifies scope. It does not explicitly differentiate from siblings, but 'single post' implicitly distinguishes it from list and analytics tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied: call this when you need detailed metadata for one post identified by media_id. However, no explicit guidance is given about when not to use it or when to prefer a sibling tool like get_post_analytics or fetch_post_replies.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_profile_infoA
Fetch the authenticated Threads user's profile information.
Returns: JSON string containing user id, username, bio, avatar URL, and profile link.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the return value is a JSON string with specific fields (id, username, bio, avatar URL, profile link), which is useful. It does not mention authentication prerequisites, potential errors, or read-only safety, but for a zero-parameter profile fetch this is moderately transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two compact sections: an action statement and a return-value list. Every sentence carries information, the core purpose is front-loaded, and there is no filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple, parameterless read-only profile tool with an output schema present, the description covers the essential target and return structure. It omits details like error behavior or authentication specifics, but those are minor given the low complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters, so the baseline is 4. The schema already fully documents the absence of parameters; the description adds no per-parameter detail, but none is needed here.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the verb 'Fetch' and specifies the resource 'authenticated Threads user's profile information,' making the operation clear and specific. It also names the returned fields, and this distinguishes it from sibling tools that focus on posts and analytics.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit when-to-use or when-not-to-use guidance. However, the tool's purpose is self-evident: it is for retrieving the authenticated user's profile, and none of the sibling tools overlap directly with that intent. The use case is implied rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_recent_postsA
Fetch recent posts from the authenticated user's Threads account.
Args: limit: Number of posts to retrieve (1 to 100, default 25). after: Pagination cursor for fetching subsequent posts page. before: Pagination cursor for fetching previous posts page.
Returns: JSON string with list of posts (id, text, media_type, timestamp, permalink) and pagination cursors.
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | ||
| limit | No | ||
| before | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must disclose behavior itself. It states the return format (JSON string with post fields and pagination cursors) and explains pagination semantics for after/before and the limit range. It does not explicitly state that this is a read-only operation with no side effects, but the wording strongly implies it.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well-organized, leading with the one-line purpose, then clearly labeled Args and Returns sections. Every sentence carries useful information with no redundancy or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a list operation with 3 optional parameters, the description covers the purpose, parameter semantics, and return payload. It could be more complete by noting any constraints on combining after/before or by explicitly mentioning authentication expectations, but nothing critical is missing for invoking the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description is the only source of parameter meaning. It fully explains limit's range and default, and clearly defines after and before as pagination cursors for subsequent and previous pages. This adds substantial meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description begins with a specific verb and resource: 'Fetch recent posts from the authenticated user's Threads account.' This clearly identifies the operation and distinguishes it from sibling tools that cover profile info, post details, analytics, replies, or exporting.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance about when to choose this tool over siblings such as fetch_post_replies or export_posts. There is no 'use this when...' or 'instead of...' context, leaving the agent to infer usage solely from the name and purpose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
7 tool updates
v0.1.0- First observed
export_posts - First observed
fetch_post_replies - First observed
get_account_analytics - First observed
get_post_analytics - First observed
get_post_details - First observed
get_profile_info - First observed
list_recent_posts
TDQS
Scored across 7 tools
Most tools map to a distinct resource and action, such as profile, post list, post details, post analytics, account analytics, replies, and export. The only real overlap risk is between list_recent_posts and export_posts, but their output purpose and shape are different enough to avoid serious misselection.
Tool names generally follow a clear verb_noun pattern, e.g. get_profile_info, list_recent_posts, get_post_details. The main inconsistency is using get, list, fetch, and export as interchangeable retrieval verbs, but no convention mixing like camelCase or inconsistent singular/plural occurs.
Seven tools is well-scoped for a Threads read-and-analytics server. Each tool covers a coherent slice of functionality without unnecessary bloat or padding.
The tool set covers profile retrieval, recent posts, post details, replies, per-post analytics, account analytics, and data export, so common read-only workflows are complete. Write/publish and search operations are absent, but they appear outside this server's apparent scope.
Maintenance
Related MCP Connectors
Threads tools for AI — generate viral posts, download videos, export profiles
X (Twitter) data for AI agents: tweets, profiles, followers, search, trends + social listening.
Social media analytics, post insights, and competitor benchmarking for AI agents.
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to manage Instagram and Threads accounts — publish content, handle comments, view insights, search hashtags, and manage DMs through the Meta Graph API.5919 npm12MIT
- AlicenseAqualityDmaintenanceScrape and analyze replies from any public Threads post right from your AI coding agent.4MIT
- AlicenseCqualityDmaintenanceEnables professional Threads management with advanced analytics, AI-powered content optimization, and automation features.4532 npmMIT
- AlicenseBqualityCmaintenanceEnables posting and managing Threads content via Meta Threads API, including text, image, video, carousel, and replies.932 npmMIT