Skip to main content
Glama

Social Media MCP Server

A Model Context Protocol (MCP) server that connects to multiple social media platforms, allowing users to create and publish content across platforms through natural language instructions.

Features

  • Natural Language Interface: Create posts for multiple platforms with simple instructions

  • Research Capabilities: Automatically research hashtags, trends, facts, and news

  • Multi-platform Support: Post to Twitter/X, Mastodon, and LinkedIn with platform-specific formatting

  • Content Generation: Generate engaging content using multiple AI models

  • Rate Limit Management: Handle API rate limits gracefully with queuing and fallbacks

  • Analytics: Track post performance and optimize content strategy

Related MCP server: PostWire

Getting Started

Prerequisites

  • Node.js (v18+)

  • npm or yarn

  • API keys for:

    • Twitter/X

    • Mastodon

    • LinkedIn

    • OpenAI and/or Anthropic (for content generation)

    • Brave Search (for research)

Installation

  1. Clone the repository:

git clone https://github.com/yourusername/social-media-mcp.git
cd social-media-mcp
  1. Install dependencies:

npm install
  1. Create a .env file with your API keys:

# 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. Build the project:

npm run build
  1. Start the server:

npm start

MCP Integration

To use this MCP server with Claude or another MCP-compatible assistant, add it to your MCP settings:

{
  "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": []
    }
  }
}

Available Tools

create_post

Create and post content to social media platforms based on natural language instructions.

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

Get trending topics from social media platforms.

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

research_topic

Research a topic using Brave Search and Perplexity.

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

Development

Project Structure

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

Scripts

  • npm run build: Build the project

  • npm run dev: Run in development mode with hot reloading

  • npm start: Start the production server

  • npm test: Run tests

  • npm run lint: Run linting

  • npm run format: Format code

Utility Scripts

The scripts directory contains utility scripts for the Social Media MCP Server:

  • scripts/linkedin-oauth.js: Handles the OAuth 2.0 flow for LinkedIn to obtain an access token

    • Usage: cd scripts && npm install && npm run linkedin-oauth

    • See scripts/README.md for more details

Documentation

The documentation directory contains detailed documentation for each social media platform integration:

License

This project is licensed under the ISC License.

Acknowledgements

Available Tools

3 tools
create_postC

Create and post content to social media platforms based on natural language instructions

Inputs: instruction (required), platforms, postImmediately, conversationId, +4 more.

research_topicC

Research a topic using Brave Search and Perplexity

Inputs: topic (required), includeHashtags, includeFacts, includeTrends, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: create_post handles content creation, get_trending_topics retrieves trending information, and research_topic performs topic research using external search tools. There is no overlap in functionality, making tool selection straightforward for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (create_post, get_trending_topics, research_topic), using snake_case throughout. This predictability enhances readability and usability for agents.

    Tool Count2/5

    With only 3 tools, the server feels under-scoped for a social media domain. Key operations like reading posts, updating/deleting content, or interacting with comments are missing, limiting the server's utility for comprehensive social media tasks.

    Completeness2/5

    The toolset is severely incomplete for social media operations. It lacks basic CRUD functionality (e.g., no read, update, or delete for posts), interaction tools (e.g., like, comment, share), and platform-specific features, leaving significant gaps that will hinder agent workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Official MCP server for PostEverywhere (posteverywhere.ai/social-media-scheduler). Let Claude, ChatGPT, Cursor or any MCP client schedule and publish posts to 13 platforms: Instagram, TikTok, YouTube, LinkedIn, Facebook, X, Threads, Pinterest, Bluesky, Telegram, Discord, WordPress and Google Business Profile. 40 tools: best-time scheduling, threads, cross-posting, campaigns, analytics.
      33
      289 npm
      7
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      One prompt, a native post per network, published or scheduled by your agent: TikTok, Instagram, Facebook, YouTube, LinkedIn, Bluesky, Mastodon, Telegram, Discord, Slack, Nostr, X, WordPress, Dev.to, Hashnode. 22 tools incl. plan_week, bulk_schedule, analytics and TikTok video quality check. Priced per brand, not per channel; API + MCP on the free plan. Hosted: postwire.io/api/mcp
      22
      87 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to manage social media publishing across platforms like LinkedIn, Twitter, Facebook, Instagram, Threads, and Bluesky.
      7
      54 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to write social posts in a brand's voice for up to four platforms, schedule or cancel them, list brands and channels, and read results, all with human approval before anything is published. Connects via OAuth or API key so posts can be planned and managed from Claude, ChatGPT, Cursor, and other MCP clients.
      MIT