Skip to main content
Glama

社交媒体 MCP 服务器

一个连接多个社交媒体平台的模型上下文协议(MCP)服务器,允许用户通过自然语言指令跨平台创建和发布内容。

特征

  • 自然语言界面:通过简单的指令为多个平台创建帖子

  • 研究能力:自动研究主题标签、趋势、事实和新闻

  • 多平台支持:以平台特定的格式发布到 Twitter/X、Mastodon 和 LinkedIn

  • 内容生成:使用多种人工智能模型生成引人入胜的内容

  • 速率限制管理:通过排队和回退优雅地处理 API 速率限制

  • 分析:跟踪帖子表现并优化内容策略

Related MCP server: Unipile MCP Server

入门

先决条件

  • Node.js(v18+)

  • npm 或 yarn

  • API 密钥用于:

    • Twitter/X

    • 乳齿象

    • LinkedIn

    • OpenAI 和/或 Anthropic(用于内容生成)

    • 勇敢搜索(用于研究)

安装

  1. 克隆存储库:

git clone https://github.com/yourusername/social-media-mcp.git
cd social-media-mcp
  1. 安装依赖项:

npm install
  1. 使用您的 API 密钥创建一个.env文件:

# Twitter API Credentials
TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET=your_api_secret
TWITTER_BEARER_TOKEN=your_bearer_token
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_SECRET=your_access_secret
TWITTER_OAUTH_CLIENT=your_oauth_client
TWITTER_CLIENT_SECRET=your_client_secret

# Mastodon API Credentials
MASTODON_CLIENT_SECRET=your_client_secret
MASTODON_CLIENT_KEY=your_client_key
MASTODON_ACCESS_TOKEN=your_access_token

# LinkedIn API Credentials
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret
LINKEDIN_ACCESS_TOKEN=your_access_token

# AI API Keys
ANTHROPIC_API_KEY=your_anthropic_key
OPENAI_API_KEY=your_openai_key
BRAVE_API_KEY=your_brave_key

# Application Settings
LOG_LEVEL=info
CACHE_ENABLED=true
RATE_LIMIT_ENABLED=true
  1. 构建项目:

npm run build
  1. 启动服务器:

npm start

MCP 集成

要将此 MCP 服务器与 Claude 或其他兼容 MCP 的助手一起使用,请将其添加到您的 MCP 设置中:

{
  "mcpServers": {
    "social-media-mcp": {
      "command": "node",
      "args": ["path/to/social-media-mcp/build/index.js"],
      "env": {
        "TWITTER_API_KEY": "your_api_key",
        "TWITTER_API_SECRET": "your_api_secret",
        "TWITTER_BEARER_TOKEN": "your_bearer_token",
        "TWITTER_ACCESS_TOKEN": "your_access_token",
        "TWITTER_ACCESS_SECRET": "your_access_secret",
        "TWITTER_OAUTH_CLIENT": "your_oauth_client",
        "TWITTER_CLIENT_SECRET": "your_client_secret",
        "MASTODON_CLIENT_SECRET": "your_client_secret",
        "MASTODON_CLIENT_KEY": "your_client_key",
        "MASTODON_ACCESS_TOKEN": "your_access_token",
        "LINKEDIN_CLIENT_ID": "your_client_id",
        "LINKEDIN_CLIENT_SECRET": "your_client_secret",
        "LINKEDIN_ACCESS_TOKEN": "your_access_token",
        "ANTHROPIC_API_KEY": "your_anthropic_key",
        "OPENAI_API_KEY": "your_openai_key",
        "BRAVE_API_KEY": "your_brave_key"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

可用工具

创建帖子

根据自然语言指令创建内容并将其发布到社交媒体平台。

{
  "instruction": "Post about the latest AI developments in healthcare",
  "platforms": ["twitter", "mastodon", "linkedin"],
  "postImmediately": false
}

获取热门话题

从社交媒体平台获取热门话题。

{
  "platform": "twitter",
  "category": "technology",
  "count": 5
}

研究主题

使用 Brave Search 和 Perplexity 研究一个主题。

{
  "topic": "artificial intelligence ethics",
  "includeHashtags": true,
  "includeFacts": true,
  "includeTrends": true,
  "includeNews": true
}

发展

项目结构

social-media-mcp/
├── src/
│   ├── index.ts                 # Entry point
│   ├── config/                  # Configuration
│   ├── types/                   # TypeScript type definitions
│   ├── core/                    # Core orchestration logic
│   ├── nlp/                     # Natural language processing
│   ├── research/                # Research engine
│   │   ├── brave/               # Brave Search integration
│   │   ├── perplexity/          # Perplexity integration
│   │   └── aggregator/          # Research result aggregation
│   ├── content/                 # Content generation
│   │   ├── strategies/          # AI model strategies
│   │   ├── formatter/           # Platform-specific formatting
│   │   └── templates/           # Content templates
│   ├── platforms/               # Social media platform integrations
│   │   ├── twitter/             # Twitter API integration
│   │   └── mastodon/            # Mastodon API integration
│   ├── analytics/               # Analytics engine
│   ├── rate-limit/              # Rate limit management
│   └── utils/                   # Utility functions
├── memory-bank/                 # Project documentation
├── build/                       # Compiled JavaScript
├── .env                         # Environment variables
├── package.json                 # Dependencies and scripts
└── tsconfig.json                # TypeScript configuration

脚本

  • npm run build :构建项目

  • npm run dev :以热重载方式在开发模式下运行

  • npm start :启动生产服务器

  • npm test :运行测试

  • npm run lint :运行 linting

  • npm run format :格式化代码

实用程序脚本

scripts目录包含社交媒体 MCP 服务器的实用程序脚本:

  • scripts/linkedin-oauth.js :处理 LinkedIn 的 OAuth 2.0 流程以获取访问令牌

    • 用法: cd scripts && npm install && npm run linkedin-oauth

    • 请参阅scripts/README.md了解更多详细信息

文档

documentation目录包含每个社交媒体平台集成的详细文档:

执照

该项目已获得 ISC 许可。

致谢

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tayler-id/social-media-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server