loading…
Search for a command to run...
loading…
A stdio MCP server for the official Threads API, enabling publishing, reading, moderation, insights, discovery, locations, and setup diagnostics.
A stdio MCP server for the official Threads API, enabling publishing, reading, moderation, insights, discovery, locations, and setup diagnostics.
threads-mcp is a stdio MCP server for the official Threads API. It is designed to stay close to the published Meta Threads documentation while exposing a practical MCP tool surface for auth, publishing, reading, moderation, insights, discovery, locations, and setup diagnostics.
The current build is intentionally limited to officially documented Threads capabilities and the official Postman collection. It does not rely on undocumented fallback endpoints or convenience wrappers that would be difficult to maintain in a public package.
npm install
npm run build
Create your local environment file and set at least THREADS_ACCESS_TOKEN.
If you still need a token, run the local OAuth helper:
npm run auth:token
node dist/index.js
validate_setup before using publish or moderation flows against a real account.exchange_code_for_tokenget_long_lived_access_tokenrefresh_access_tokenget_app_access_tokenget_meget_profileget_profile_threadsget_publishing_limitcreate_thread_containerpublish_threadcreate_and_publish_threadrepost_threaddelete_threadget_threadsget_threadget_repliesget_thread_conversationget_pending_repliesmanage_replymanage_pending_replyget_user_insightsget_thread_insightssearch_threadsget_mentionsget_oembedsearch_locationsget_locationvalidate_setupThe server is split into a few clear layers:
src/index.ts bootstraps the MCP stdio transport.src/threads/client.ts owns authenticated HTTP calls, retries, pagination, polling, and normalized Meta API errors.src/tools/ contains one module per tool family plus shared schemas.The publish input model is exposed as a single public discriminated union covering text, image, video, carousel, and reply.
You need all of the following before the server can make live API calls:
Required for most user-token tools:
THREADS_ACCESS_TOKENOptional:
THREADS_APP_IDTHREADS_APP_SECRETTHREADS_REDIRECT_URITHREADS_API_BASE_URLTHREADS_USER_IDTHREADS_MAX_RETRIESTHREADS_RETRY_BASE_DELAY_MSTHREADS_TIMEOUT_MSTHREADS_PUBLISH_STATUS_TIMEOUT_MSTHREADS_PUBLISH_STATUS_POLL_INTERVAL_MSCopy .env.example and set at least the access token. THREADS_APP_ID and THREADS_APP_SECRET are also needed for the auth helper tools and for get_oembed when you do not pass an explicit app access token.
THREADS_APP_IDUse Cases -> Threads -> Customize -> SettingsTHREADS_APP_IDImportant:
Use Cases -> Threads -> Customize -> SettingsTHREADS_APP_SECRET comes from the same Threads use-case settings page. Keep it private.
The repository includes a local OAuth helper that follows the Meta Threads access-token flow:
.env as THREADS_ACCESS_TOKENSetup:
.envTHREADS_REDIRECT_URIRun:
npm run auth:token
Optional flags:
--redirect-uri http://127.0.0.1:8788/callback--env-file .env.local--no-openthreads_basic
Used by get_me, get_profile, get_threads, get_thread, and baseline setup validation.threads_content_publish
Used by get_publishing_limit, create_thread_container, publish_thread, and create_and_publish_thread.threads_read_replies
Used by get_replies and safe reply-read probes in validate_setup.threads_manage_replies
Used by manage_reply.threads_manage_insights
Used by get_user_insights and get_thread_insights.threads_keyword_search
Used by search_threads.threads_profile_discovery
Used by get_profile and get_profile_threads for public account discovery scenarios.threads_location_tagging
Used by search_locations, get_location, and publish flows that set locationId.threads_delete
Used by delete_thread.validate_setup performs safe probes to infer access for threads_basic, threads_content_publish, threads_read_replies, threads_manage_insights, threads_keyword_search, threads_profile_discovery, and threads_location_tagging. It deliberately does not perform destructive probes for threads_manage_replies or threads_delete, so those scopes are not actively validated by setup.
The server models official container options in camelCase and serializes them internally to the snake_case parameters expected by the Threads API.
Supported inputs include:
text, replyControl, replyToId, quotePostId, topicTag, locationId, textEntities, allowlistedCountryCodeslinkAttachment, pollAttachment, textAttachment, gifAttachment, enableReplyApprovals, autoPublishText, isGhostPostimageUrl, videoUrl, altText, isSpoilerMediaCarousel publishing follows the official multi-step flow:
is_carousel_item=truechildren=[...]The repository currently covers these official Threads API families:
Example Claude Desktop style config:
{
"mcpServers": {
"threads": {
"command": "node",
"args": ["/absolute/path/to/threads-mcp/dist/index.js"],
"env": {
"THREADS_ACCESS_TOKEN": "thdt_your_user_access_token",
"THREADS_APP_ID": "optional_app_id",
"THREADS_APP_SECRET": "optional_app_secret"
}
}
}
}
If you later publish this package as a CLI, the command can become threads-mcp.
The package metadata is already configured for npm publication as a public package:
threads-mcp0.0.0threads-mcppublicBefore publishing, run:
npm run build
npm test
npm publish --access public
prepublishOnly is configured to run the build and test steps automatically during npm publish.
Install dependencies once Node.js is available:
npm install
npm run build
npm test
Suggested manual checks:
npm run build to verify TypeScript compilation.npm test to execute the schema, client, and tool registration tests.node dist/index.js.validate_setup first with a real token.create_thread_container and publish_thread against a test Threads account.validate_setup cannot safely verify threads_manage_replies without performing a state-changing moderation callvalidate_setup also does not perform a state-changing delete probecreate_and_publish_thread intentionally rejects autoPublishText=true because that flag conflicts with the tool's explicit two-step contractreply variant backed by the official reply_to_id parameter and currently targets text replies in the public schemaДобавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"threads-mcp-server": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
автор: GitHubDatabase, auth and storage
автор: SupabaseReference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development