使用说明
元线程mcp
Meta线程API的非官方MCP服务器。使Claude等LLM能够通过模型上下文协议发布帖子、管理回复和跟踪见解。
特性
安装
pip install meta-threads-mcp
或者使用紫外线:
uv add meta-threads-mcp
在FastMCP云上运行
运行此MCP服务器的最简单方法是将其部署在 FastMCP云:
- 首选 fastmcp.cloud 并登录
- 连接您的GitHub存储库
- FastMCP Cloud将自动检测
fastmcp.json配置和部署服务器
配置
克劳德桌面版
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"threads": {
"command": "meta-threads-mcp"
}
}
}
认证
服务器需要以下格式的承载令牌:
<access_token>:<user_id>
客户端在调用工具时通过请求上下文传递此令牌。
可用工具
帖子
| 工具 | 说明 | 参数 |
|---|---|---|
threads_create_post |
创建并发布文本帖子 | text (必填), reply_control (可选) |
threads_create_image_post |
用图片创建帖子 | image_url (必填), text (可选) |
threads_create_video_post |
用视频创建帖子 | video_url (必填), text (可选) |
threads_get_post |
通过ID获取帖子 | post_id (必填) |
threads_get_user_posts |
获取用户的最新帖子 | limit (可选,默认值10) |
threads_delete_post |
删除帖子 | post_id (必填) |
threads_get_publishing_limit |
检查剩余配额 | 无 |
回复
| 工具 | 说明 | 参数 |
|---|---|---|
threads_reply_to_post |
回复帖子 | post_id (必填), text (必填) |
threads_get_replies |
获取帖子的回复 | post_id (必填) |
threads_get_conversation |
获取完整的对话线索 | post_id (必填) |
threads_hide_reply |
隐藏回复 | reply_id (必填) |
threads_unhide_reply |
取消隐藏回复 | reply_id (必填) |
洞察
| 工具 | 说明 | 参数 |
|---|---|---|
threads_get_media_insights |
获取帖子的指标 | media_id (必填) |
threads_get_user_insights |
获取用户级别指标 | 无 |
用户
| 工具 | 说明 | 参数 |
|---|---|---|
threads_get_profile |
获取当前用户的个人资料 | 无 |
回复控制选项
创建帖子时,您可以控制谁可以回复:
EVERYONE(默认)-任何人都可以回复ACCOUNTS_YOU_FOLLOW-只有您关注的帐户可以回复MENTIONED_ONLY-只有提到的帐户可以回复
速率限制
- 每24小时250个帖子
- 每24小时1000次回复
使用 threads_get_publishing_limit 查看您当前的配额。
发展
设置
git clone https://github.com/MetaThreads/meta-threads-mcp.git
cd meta-threads-mcp
uv sync --dev
运行测试
uv run pytest
过梁和类型检查
uv run ruff check src tests
uv run ruff format src tests
uv run mypy src
使用FastMCP CLI进行测试
fastmcp dev src/meta_threads_mcp/server.py
许可证
MIT许可证-请参阅 许可证 了解详情。
