这是一个模型上下文协议(MCP)服务器,可实现Claude、Cursor、Kiro(以及其他支持MCP的平台)与简化版API的无缝集成。该服务器使大语言模型(LLMs)能够通过标准化的MCP工具与简化版服务进行交互,从而实现跨多个平台的社交媒体账户管理和帖子创建。
本服务器可助力大语言模型借助标准化的MCP工具与简化版服务交互,实现多平台的社交媒体账户管理与帖子创建。你可以按照以下步骤进行安装和配置。
@modelcontextprotocol/sdk
构建。npm install -g simplified-mcp-server
git clone https://github.com/celeryhq/simplified-mcp-server.git
cd simplified-mcp-server
npm install
npm run build
npm install -g @anthropic-ai/dxt
npx @anthropic-ai/dxt pack
服务器通过环境变量进行配置。你可以在项目根目录创建一个.env
文件,或者在环境中设置这些变量:
变量 | 描述 | 示例 |
---|---|---|
SIMPLIFIED_API_TOKEN |
你的简化版API令牌 | sk_live_abc123... |
变量 | 描述 | 默认值 | 选项 |
---|---|---|---|
SIMPLIFIED_API_BASE_URL |
简化版API基础URL | https://api.simplified.com |
任何有效的URL |
LOG_LEVEL |
日志详细程度 | info |
debug , info , warn , error |
REQUEST_TIMEOUT |
API请求超时时间(毫秒) | 30000 |
任何正数 |
RETRY_ATTEMPTS |
重试次数 | 3 |
任何非负数 |
RETRY_DELAY |
重试间隔时间(毫秒) | 1000 |
任何正数 |
# 必需
SIMPLIFIED_API_TOKEN=sk_live_your_token_here
SIMPLIFIED_API_BASE_URL=https://api.simplified.com
LOG_LEVEL=info
# 可选
REQUEST_TIMEOUT=30000
RETRY_ATTEMPTS=3
RETRY_DELAY=1000
import { SimplifiedMCPServer } from 'simplified-mcp-server';
import { ConfigurationManager } from 'simplified-mcp-server/config';
async function startServer() {
const config = ConfigurationManager.loadConfig();
const server = new SimplifiedMCPServer(config);
await server.start();
}
startServer().catch(console.error);
将服务器添加到你的Claude MCP配置中:
{
"mcpServers": {
"simplified": {
"command": "node",
"args": [
"{PATH_TO_CLONED_REPOSITORY}/dist/cli.js",
"start"
],
"env": {
"SIMPLIFIED_API_TOKEN": "your_token_here",
"SIMPLIFIED_API_BASE_URL": "https://api.simplified.com",
"LOG_LEVEL": "info"
}
}
}
}
安装DXT扩展:
Extensions -> Advanced settings -> Install Extension...
选择simplified-mcp.dxt
文件,添加你的令牌。
将服务器添加到你的Kiro MCP配置中:
{
"mcpServers": {
"simplified": {
"command": "simplified-mcp-server",
"env": {
"SIMPLIFIED_API_TOKEN": "your_token_here"
}
}
}
}
服务器提供了全面的社交媒体管理工具,具备特定平台特性:
用于管理社交媒体账户和帖子的工具。
get_social_media_accounts
检索所有已连接的社交媒体账户。 参数:
network
(可选):按平台过滤(facebook、instagram、linkedin、tiktok、youtube、pinterest、threads、google、bluesky、tiktokBusiness)示例:
{
"name": "get_social_media_accounts",
"arguments": {
"network": "instagram"
}
}
create_social_media_post
使用特定平台设置为Google、TikTok、Threads、YouTube、Facebook、LinkedIn、Instagram和Pinterest创建新的社交媒体帖子。 参数:
message
(必需):帖子消息/内容(1 - 5000个字符)accountId
(必需):社交媒体账户IDaction
(必需):要执行的操作(schedule、add_to_queue、draft)date
(可选):帖子的预定日期(格式:YYYY-MM-DD HH:MM)media
(可选):要附加的媒体文件URL数组(最多10项)additional
(可选):特定平台的帖子设置和元数据基本示例:
{
"name": "create_social_media_post",
"arguments": {
"message": "Excited to announce our new product launch! 🚀",
"accountId": "acc_fb123",
"action": "schedule",
"date": "2024-01-22 12:00",
"media": [
"https://example.com/product-image.jpg",
"https://example.com/launch-video.mp4"
],
"additional": {}
}
}
media
参数接受一个指向媒体文件的URL字符串数组:
{
"media": [
"https://example.com/image1.jpg",
"https://example.com/video.mp4",
"https://example.com/image2.png"
]
}
媒体要求:
additional
参数支持特定平台的配置:
{
"additional": {
"google": {
"post": {
"title": "New Product Launch",
"topicType": "OFFER",
"couponCode": "LAUNCH20",
"callToActionUrl": "https://example.com/product",
"callToActionType": "SHOP",
"termsConditions": "Valid until end of month"
}
}
}
}
{
"additional": {
"tiktok": {
"post": {
"brandContent": true,
"privacyStatus": "PUBLIC_TO_EVERYONE",
"duetDisabled": false,
"commentDisabled": false
},
"channel": { "value": "direct" },
"postType": { "value": "video" }
}
}
}
{
"additional": {
"youtube": {
"post": {
"title": "Product Launch Video",
"license": "standard",
"privacyStatus": "public",
"selfDeclaredMadeForKids": "no"
},
"postType": { "value": "short" }
}
}
}
{
"additional": {
"instagram": {
"postReel": {
"audioName": "Trending Audio Track",
"shareToFeed": true
},
"postType": { "value": "reel" }
}
}
}
{
"additional": {
"pinterest": {
"post": {
"link": "https://example.com/product",
"title": "Amazing Product",
"imageAlt": "Product showcase image"
}
}
}
}
{
"additional": {
"linkedin": {
"audience": { "value": "PUBLIC" }
}
}
}
{
"additional": {
"facebook": {
"postType": { "value": "feed" }
}
}
}
{
"additional": {
"threads": {
"channel": { "value": "direct" }
}
}
}
平台 | 可用选项 | 描述 |
---|---|---|
Google Business Profile | title , topicType , couponCode , callToActionUrl , callToActionType , termsConditions |
带有CTA和优惠的商业帖子增强功能 |
TikTok/TikTok Business | brandContent , privacyStatus , duetDisabled , stitchDisabled , commentDisabled |
内容设置和互动控制 |
YouTube | title , license , privacyStatus , selfDeclaredMadeForKids |
视频元数据和合规设置 |
audioName , shareToFeed , postType |
卷轴特定设置和动态分享 | |
link , title , imageAlt |
图钉目标和可访问性 | |
audience |
专业受众定位 | |
postType |
内容类型指定 | |
Threads | channel |
发布方法 |
服务器提供全面的错误处理,带有详细的错误信息:
{
"success": false,
"error": "Error message",
"details": {
"type": "AUTHENTICATION_ERROR",
"code": 401,
"timestamp": "2024-01-01T00:00:00.000Z"
}
}
git clone https://github.com/celeryhq/simplified-mcp-server.git
cd simplified-mcp-server
npm install
npm run build
# 运行所有测试
npm test
# 运行带覆盖率的测试
npm run test:coverage
# 以监听模式运行测试
npm run test:watch
# 以自动重新加载的开发模式启动
npm run dev
# 以监听模式的开发模式启动
npm run dev:watch
simplified-mcp-server/
├── src/
│ ├── index.ts # 主入口点
│ ├── server.ts # MCP服务器实现
│ ├── cli.ts # 命令行界面
│ ├── config/
│ │ └── configuration.ts # 配置管理
│ ├── tools/
│ │ ├── registry.ts # 工具注册表
│ │ ├── definitions.ts # 工具定义实用程序
│ │ └── implementations/ # 工具实现
│ │ ├── social-media-tools.ts # 社交媒体管理工具
│ │ └── index.ts # 工具导出
│ ├── api/
│ │ └── client.ts # 简化版API客户端
│ ├── utils/
│ │ ├── errors.ts # 错误处理实用程序
│ │ └── logger.ts # 日志记录实用程序
│ └── types/
│ └── index.ts # TypeScript类型定义
├── tests/ # 测试文件
├── dist/ # 编译后的JavaScript
└── docs/ # 文档
问题:服务器因配置错误无法启动。 解决方案:
.env
文件包含SIMPLIFIED_API_TOKEN
# 检查Node.js版本
node --version
# 验证环境变量
echo $SIMPLIFIED_API_TOKEN
问题:API调用因认证错误失败。 解决方案:
问题:工具返回错误或意外结果。 解决方案:
# 启用调试日志
LOG_LEVEL=debug simplified-mcp-server
问题:无法连接到简化版API。 解决方案:
启用调试日志以进行详细的故障排除:
LOG_LEVEL=debug simplified-mcp-server
使用内置的健康检查工具验证服务器状态:
{
"name": "simplified-health-check",
"arguments": {
"includeDetails": true
}
}
服务器接受以下配置选项:
interface ServerConfig {
apiToken: string; // 必需:简化版API令牌
apiBaseUrl: string; // 可选:API基础URL
logLevel: 'debug' | 'info' | 'warn' | 'error'; // 可选:日志级别
timeout: number; // 可选:请求超时时间(毫秒)
retryAttempts: number; // 可选:重试次数
retryDelay: number; // 可选:重试间隔时间(毫秒)
}
所有工具返回的响应格式如下:
interface ToolResponse {
content: Array<{
type: 'text';
text: string; // 包含实际响应数据的JSON字符串
}>;
}
{
"success": true,
"data": { /* 响应数据 */ },
"message": "Operation completed successfully"
}
{
"success": false,
"error": "Error description",
"details": { /* 额外的错误信息 */ }
}
simplified-mcp-server/
├── src/
│ ├── index.ts # 主入口点
│ ├── server.ts # MCP服务器实现
│ ├── cli.ts # 命令行界面
│ ├── config/
│ │ └── configuration.ts # 配置管理
│ ├── tools/
│ │ ├── registry.ts # 工具注册表
│ │ ├── definitions.ts # 工具定义实用程序
│ │ └── implementations/ # 工具实现
│ │ ├── social-media-tools.ts # 社交媒体管理工具
│ │ └── index.ts # 工具导出
│ ├── api/
│ │ └── client.ts # 简化版API客户端
│ ├── utils/
│ │ ├── errors.ts # 错误处理实用程序
│ │ └── logger.ts # 日志记录实用程序
│ └── types/
│ └── index.ts # TypeScript类型定义
├── tests/ # 测试文件
├── dist/ # 编译后的JavaScript
└── docs/ # 文档
interface ServerConfig {
apiToken: string; // 必需:简化版API令牌
apiBaseUrl: string; // 可选:API基础URL
logLevel: 'debug' | 'info' | 'warn' | 'error'; // 可选:日志级别
timeout: number; // 可选:请求超时时间(毫秒)
retryAttempts: number; // 可选:重试次数
retryDelay: number; // 可选:重试间隔时间(毫秒)
}
interface ToolResponse {
content: Array<{
type: 'text';
text: string; // 包含实际响应数据的JSON字符串
}>;
}
本项目采用MIT许可证,请参阅LICENSE文件以获取详细信息。
我们欢迎贡献!请参阅我们的贡献指南以获取详细信息。
git clone https://github.com/your-username/simplified-mcp-server.git
npm install
git checkout -b feature/your-feature
npm test
npm run build
git commit -m "Add your feature"
git push origin feature/your-feature