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

ParametersJSON Schema
NameRequiredDescriptionDefault
instructionYesNatural language instruction for the post (e.g., "Post about the latest AI developments")
platformsNoSocial media platforms to post to
postImmediatelyNoWhether to post immediately or return a preview
conversationIdNoID of an existing conversation to continue
questionIdNoID of the question being answered
answerNoAnswer to the question
ignoreHistoryNoWhether to ignore similar posts in history
actionableInsightsNoWhether to include actionable insights in the post

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic function. It doesn't disclose critical behavioral traits like authentication requirements, rate limits, whether posts are permanent or draftable, error handling, or what happens when posting to multiple platforms. The mention of 'return a preview' via the postImmediately parameter is helpful but insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every element ('create and post', 'social media platforms', 'natural language instructions') contributes directly to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 8 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (e.g., post IDs, success status), error conditions, or how it handles the various parameters like conversationId or actionableInsights. The sibling tools suggest a broader context that isn't addressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds minimal value beyond the schema by implying natural language processing for the 'instruction' parameter, but doesn't explain parameter interactions or provide additional context for the 8 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create and post content') and target ('social media platforms'), with the specific method 'based on natural language instructions' distinguishing it from typical API-based posting tools. However, it doesn't differentiate from sibling tools like 'get_trending_topics' or 'research_topic', which serve completely different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives or prerequisites. The description mentions posting to social media but doesn't specify use cases, constraints, or how it relates to the sibling tools for research and trend analysis.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

research_topicC

Research a topic using Brave Search and Perplexity

ParametersJSON Schema
NameRequiredDescriptionDefault
topicYesTopic to research
includeHashtagsNoWhether to include relevant hashtags
includeFactsNoWhether to include facts about the topic
includeTrendsNoWhether to include trending information
includeNewsNoWhether to include news articles

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It mentions the search engines used but doesn't describe rate limits, authentication needs, response format, pagination, or what constitutes 'research' output. For a tool with 5 parameters and no annotations, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 6 words, with zero wasted language. It's front-loaded with the core action and immediately specifies the search engines used. Every word serves a purpose in this minimal but complete statement of function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a research tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the research output looks like, how results are structured, what sources are consulted beyond the named search engines, or limitations of the research process. The agent would have significant gaps in understanding how to effectively use this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete, but doesn't provide additional contextual meaning about how parameters interact.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('research') and resource ('topic') with specific methods ('using Brave Search and Perplexity'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_trending_topics' or 'create_post', which would require more specific scope definition.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_trending_topics' for trending information or 'create_post' for content creation. There's no mention of prerequisites, limitations, or appropriate contexts for choosing this research tool over other methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updates
    • First observedcreate_post
    • First observedget_trending_topics
    • First observedresearch_topic

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
    Enables AI assistants to schedule and publish social media posts to platforms like Instagram, TikTok, YouTube, LinkedIn, Facebook, X, Threads, and Pinterest using natural language.
    33
    99 npm
    3
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Lets any AI agent post to TikTok, Instagram, YouTube, X, LinkedIn, Bluesky, Telegram, Mastodon and Discord through a single post_to_social tool. Connect an account once, then publish everywhere.
    2
    127 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables posting to multiple social media platforms (X, LinkedIn, Facebook, Instagram, etc.) via a unified API, handling OAuth, media, and scheduling for each network.
    AGPL 3.0
  • 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
    59 npm
    MIT