X (Twitter) MCP server

Integrates with X using real browser APIs to bypass rate limits and enable extensive social media operations and data analysis.
Back to servers
Setup instructions
Provider
Josh Mayer
Release date
Jan 22, 2025
Language
Python
Stats
5 stars

This server implements the Model Context Protocol (MCP), allowing for standardized interaction with AI models. MCP-X provides a unified interface for sending prompts to models and receiving responses, making it easier to work with AI models regardless of their underlying implementation.

Installation

You can install the MCP server package using pip:

pip install mcp-x

Basic Usage

Starting the Server

After installation, you can start the MCP server using the following command:

mcp-x run

This will start the server with default settings, typically listening on localhost port 8000.

Configuration Options

You can customize the server configuration by specifying options:

mcp-x run --host 0.0.0.0 --port 8080

Connecting to Models

MCP-X allows you to connect to different AI models. Specify the model you want to use:

mcp-x run --model gpt-3.5-turbo

API Endpoints

Sending Prompts

To send a prompt to the model, make a POST request to the /prompt endpoint:

curl -X POST http://localhost:8000/prompt \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Explain quantum computing in simple terms", "max_tokens": 100}'

Model Information

To retrieve information about available models:

curl http://localhost:8000/models

Environment Variables

You can configure MCP-X using environment variables:

  • MCP_HOST: Specify the host address (default: localhost)
  • MCP_PORT: Specify the port number (default: 8000)
  • MCP_MODEL: Default model to use
  • MCP_API_KEY: Your API key for accessing models that require authentication

For example:

export MCP_PORT=9000
export MCP_MODEL=gpt-4
mcp-x run

Troubleshooting

Common Issues

  • Connection Refused: Make sure the specified port is available and not blocked by a firewall
  • Authentication Errors: Verify that you've provided the correct API key for models that require it
  • Resource Limitations: Some models have token limits or rate limiting that may affect performance

For any persistent issues, check the server logs for more detailed error information.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-x" '{"command":"python","args":["-m","mcp_x"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mcp-x": {
            "command": "python",
            "args": [
                "-m",
                "mcp_x"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mcp-x": {
            "command": "python",
            "args": [
                "-m",
                "mcp_x"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later