article
README
🚀 threads - mcp
这是一个基于 TypeScript 的 Node MCP(模型上下文协议)服务器项目,其主要价值在于能让你在 Threads(由 Meta 开发的社交媒体平台)上创建帖子,并且还能在帖子中添加来自 Unsplash 的免费图片。
🚀 快速开始
先决条件
- 获取 Unsplash 的 API Key。
- 在 Meta 开发者平台 https://developers.facebook.com/apps 注册一个应用。
- 选择 访问 Threads API 作为使用场景。
- 在主控制面板中,点击 访问 Threads API > 设置 > 输入 回调 URL。
- 获得这些密钥:Threads 应用 ID、Threads 应用密码、回调 URL,并将它们保存在环境变量部分的 threads - dev 配置文件中:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
操作步骤
- 克隆仓库:
git clone https://github.com/tttn13/threads-mcp
cd threads-mcp
- 安装依赖:
npm install
- 构建项目:
npm run build
- 运行项目:
npm start
- 创建一个 Meta 开发者账户并获取你的密钥。
- 将以下配置添加到你的 Claude Desktop 配置文件中:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"threads-dev": {
"command": "node",
"args": [
"/Users/path/to/project/build/index.js"
],
"env": {
"HOST": "https://graph.threads.net",
"APP_ID": "threads_app_id",
"APP_SECRET": "threads_app_secret",
"REDIRECT_URI": "public_url",
"INITIAL_USER_ID": "threads_user_id"
}
}
}
✨ 主要特性
- 基于 TypeScript 构建,提供类型安全的开发体验。
- 可在 Threads 平台上创建帖子。
- 支持在帖子中添加来自 Unsplash 的免费图片。
📦 安装指南
克隆仓库
git clone https://github.com/tttn13/threads-mcp
cd threads-mcp
安装依赖
npm install
构建项目
npm run build
🏗️ 项目结构
threads-mcp
├── src
│ ├── index.ts # 入口点
│ ├── stock-photos.ts # Unsplash HTTP 客户端
│ ├── threads-api.ts # Threads API HTTP 客户端
│ ├── threads-server.ts # Threads MCP 服务器
│ └── types.ts # 类型定义
├── package.json # NPM 包配置
├── tsconfig.json # TypeScript 配置
└── README.md # 项目文档
Scan to contact