Skip to main content
Glama
Steph-ux

x-mcp-playwright

by Steph-ux

x-mcp-playwright

Un servidor MCP de Twitter/X impulsado por patchright (fork sigiloso de Playwright) y un perfil de usuario de Chrome persistente.

9 herramientas agrupadas — 33 acciones conservadas, cero funcionalidad perdida.


1. Instalación

git clone <this-repo> x-mcp-playwright
cd x-mcp-playwright

python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

pip install -e .
patchright install chromium

Inicio de sesión por única vez

x-mcp-login
# or: python login.py

Abre una ventana de navegador real. Inicia sesión en X con normalidad y luego cierra la ventana. La sesión se guarda en ~/.x-mcp-playwright/profile/.


Related MCP server: X MCP Server

2. Registro en tu cliente MCP

Claude Code

claude mcp add --scope user x-twitter x-mcp-server

Claude Desktop

{
  "mcpServers": {
    "x-twitter": {
      "command": "x-mcp-server",
      "env": { "X_MCP_HEADLESS": "1" }
    }
  }
}

Si x-mcp-server no está en el PATH, usa:

{
  "mcpServers": {
    "x-twitter": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["-m", "x_mcp_server"]
    }
  }
}

Docker (VPS sin interfaz gráfica)

docker build -t x-mcp-playwright .
docker run -i --rm \
  -v ~/.x-mcp-playwright/profile:/root/.x-mcp-playwright/profile \
  x-mcp-playwright

3. Catálogo de herramientas (9 herramientas, 33 acciones)

x_post — Publicar tweets (6 acciones)

acción

Argumentos obligatorios

Descripción

post

text

Publicar un solo tweet

thread

tweets (separados por saltos de línea)

Publicar un hilo

post_media

text, media_paths (separados por comas)

Hasta 4 imágenes o 1 vídeo

reply

tweet_url, reply_text

Responder a un tweet

quote

tweet_url, comment

Citar un tweet con comentario

delete

tweet_url

Eliminar tu tweet

x_engage — Interactuar con tweets (4 acciones)

acción

Argumentos obligatorios

Parámetro on

like

tweet_url

on=True para dar like, False para quitarlo

retweet

tweet_url

on=True para RT, False para deshacer

bookmark

tweet_url

on=True para guardar, False para eliminar

pin

tweet_url

on=True para fijar, False para desfijar

x_user — Operaciones de usuario (6 acciones)

acción

Argumentos obligatorios

Opcional

profile

handle

—

timeline

handle

tab="tweets"|"likes"|"media", limit

connections

handle

kind="followers"|"following", limit

follow

handle

on=True para seguir, False para dejar de seguir

block

handle

—

mute

handle

—

argumento

Por defecto

Descripción

query

—

Palabras clave de búsqueda

filter

"top"

"latest", "people", "media"

from_user

—

Filtrar por autor

to_user

—

Filtrar por destinatario

since / until

—

Rango de fechas (YYYY-MM-DD)

min_likes

0

Mínimo de likes

min_retweets

0

Mínimo de retweets

lang

—

Código de idioma

limit

10

Máximo de resultados

x_feed — Explorar feeds (4 acciones)

acción

Descripción

home

Tu cronología de inicio. Opcional: tab="for_you"|"following"

bookmarks

Tus marcadores guardados

notifications

Menciones, likes, seguidores

trending

Lo que está pasando

x_tweet — Detalles del tweet (4 acciones)

acción

Argumentos obligatorios

Descripción

details

tweet_url

Tweet completo con métricas

replies

tweet_url

Respuestas en un tweet

analytics

tweet_url

Impresiones/interacciones (tweets propios)

engagers

tweet_url

Quiénes dieron like/retweetearon (kind="likes"|"retweets")

x_list — Listas

Escenario

Argumentos

Tus listas

Sin argumentos

Listas de un usuario

handle

Tweets de una lista

list_id

x_dm — Mensajes directos (3 acciones)

acción

Argumentos obligatorios

Descripción

send

handle, message

Enviar un DM

conversations

—

Listar hilos de DM recientes

messages

handle

Leer mensajes con un usuario

x_session — Gestión de sesión (2 acciones)

acción

Descripción

check

Devuelve {logged_in, current_url, user_handle}

screenshot

Captura cualquier página de X. Opcional: url, full_page


4. Variables de entorno

Variable

Por defecto

Descripción

X_MCP_HEADLESS

1

0 para ver la ventana del navegador

X_MCP_TIMEOUT_MS

20000

Tiempo de espera predeterminado de Playwright (ms)

X_MCP_SCREENSHOT_DIR

~/.x-mcp-playwright/screenshots

Capturas de pantalla de depuración

X_MCP_USE_SYSTEM_CHROME

0

1 para usar el Chrome del sistema


5. Seguridad

  • Limitador de frecuencia: Las acciones de escritura (post, delete, DM, reply) están limitadas a 1/min. Las acciones de interacción (like, RT, follow) están limitadas a 2/min. Las acciones de lectura son ilimitadas.

  • Keepalive de sesión: Una tarea en segundo plano hace ping a X cada 30 min. Registra una advertencia si la sesión expira.

  • Vinculado a tu cuenta real. Cualquier cosa que haga el LLM, la hiciste tú.


6. Recursos MCP

  • x://session/status — Estado de inicio de sesión

  • x://version — Versión del servidor

  • x://tools/list — Todas las herramientas

  • x://tools/categories — Taxonomía agrupada

7. Prompts de MCP

  • analyze_tweet(tweet_url) — Obtener y analizar un tweet (sentimiento, interacción, tono de respuesta)

  • draft_reply(tweet_url, intent) — Redactar 3 variantes de respuesta de menos de 280 caracteres


7. Desarrollo

make install     # deps + chromium
make login       # interactive X login
make test        # unit tests (no browser)
make smoke       # live search test
make server      # run MCP server
make lint        # compile-check
make clean       # remove pycache, screenshots

8. Seguridad

  • Vinculado a tu cuenta real. Cualquier cosa que haga el LLM, la hiciste tú.

  • Límite: <= 1-2 acciones de publicación/respuesta por minuto.

  • Restringe las herramientas destructivas (delete, block, send_dm) a la aprobación humana en el VPS.


Licencia

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    A local MCP server that exposes the X API (formerly Twitter API) as tools, enabling operations like posting, searching, user management, and more via natural language commands.
    865
    -
  • A
    license
    B
    quality
    D
    maintenance
    MCP server for interacting with the X platform (Twitter) via MCP clients like Claude, Cursor AI, and Windsurf AI.
    20
    5 npm
    6
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides programmatic X (Twitter) engagement via MCP, offering 24 tools for search, timelines, notifications, bookmarks, profiles, and tweet actions through a headless browser.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for the Twitter/X API, enabling search, user profiles, tweets, followers, and more via natural language.
    94
    375 npm
    MIT