Gleam Bot
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gleam Botjoin the giveaway at https://gleam.io/abc123 and do all required X actions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Table of Contents
Related MCP server: X Twitter Scraper
Requirements
Python
3.10+Git
uv(recommended) orpipxvfb(only needed forgleam_loginon headless servers)
Install Python
Linux
sudo apt update && sudo apt install -y python3 python3-pip gitmacOS
brew install pythonWindows
Download the latest installer from https://www.python.org/downloads/windows. Check Add Python to PATH during installation.
Termux (Android)
pkg update && pkg install python gitInstallation
Clone the repository:
git clone https://github.com/Yuurisan-N1/Gleam-Bot.git
cd Gleam-BotInstall with uv (recommended):
# Linux / macOS
uv venv .venv
uv pip install --python .venv/bin/python -e .
cp .env.example .env
# Windows
uv venv .venv
uv pip install --python .venv\Scripts\python.exe -e .
copy .env.example .envInstall without uv:
python3 -m venv .venv
.venv/bin/pip install -e .
cp .env.example .envFor gleam_login on a headless server (required for X OAuth):
sudo apt-get install -y xvfb
uv pip install --python .venv/bin/python camoufox playwright
.venv/bin/python -m camoufox fetchConfiguration
All credentials and values used by campaigns are stored in a single .env file. The bot selects the correct key per entry method automatically. Available key categories:
Category | Keys |
Identity |
|
Wallets |
|
Exchange UIDs |
|
Social |
|
Content |
|
X Auto Action |
|
X Session backup |
|
Proxy |
|
Browser |
|
See .env.example for the full list with comments on every key.
Value resolution priority per entry method:
Per-campaign override:
CAMPAIGN_<SLUG>_<KEY>Indexed account:
<KEY>_<N>Main field:
<KEY>Fallback:
<KEY>_DEFAULTAlternate:
<KEY>_ALT_<N>
If a required key is not filled in, that entry is skipped and reported rather than failing the whole run.
Session Files
Place cookie files in the session/ folder. The bot auto-detects the format (name/value array, Playwright export, flat map, or raw Cookie header string):
session/
├── x.json # X (Twitter) session cookie
├── gleam_cookie.json # Created automatically by gleam_login
├── threads.json # Optional Threads session
└── custom.json # Any other serviceCopy the example and fill in your cookie:
cp session/x.json.example session/x.json
chmod 600 session/x.jsonRunning the Server
The server communicates over stdio and logs to stderr:
export GLEAM_ENV_FILE=$PWD/.env
export GLEAM_PROXY_FILE=$HOME/proxy.txt
.venv/bin/python -m gleam_mcpTest scripts:
.venv/bin/python scripts/mcp_smoke.py # smoke test
.venv/bin/python scripts/mcp_gleam_test.py # test gleam_state and gleam_enter
.venv/bin/python scripts/gleam_run.py # state and dry-run
DRY=0 .venv/bin/python scripts/gleam_run.py # submit for real
.venv/bin/python scripts/cookie_check.py # check cookie files
# gleam_login on a headless server
xvfb-run -a .venv/bin/python scripts/gleam_login_cli.py "https://gleam.io/<key>/<slug>"Register with Hermes
hermes mcp add gleam \
--command /absolute/path/to/.venv/bin/python \
--env GLEAM_ENV_FILE=/absolute/path/to/.env GLEAM_PROXY_FILE=/absolute/path/to/proxy.txt \
--args -m gleam_mcp--args must come last. Verify:
hermes mcp test gleamAll paths must be absolute when using Hermes since it runs in its own environment.
Usage
No interactive input is required. The campaign link is passed as a tool parameter. A full run looks like:
1. Check campaign status and which .env keys will be used:
gleam_state(campaign="https://gleam.io/oNewO/kucoin-x-tina-x-space")2. Connect X once per account (opens a browser for OAuth):
gleam_login(campaign="https://gleam.io/oNewO/kucoin-x-tina-x-space")3. Preview the plan without submitting anything:
gleam_enter(campaign="https://gleam.io/oNewO/kucoin-x-tina-x-space", dry_run=true)4. Submit entries for real:
gleam_enter(campaign="https://gleam.io/oNewO/kucoin-x-tina-x-space", dry_run=false)For a different campaign, change the campaign parameter. The X cookie and .env values stay the same across campaigns.
MCP Tools
Tool | Description |
| Connect X to a campaign via OAuth (opens browser once). Auto-skips if the session is already linked. Use |
| Campaign status and contestant state with the |
| Submit entries via pure HTTP. |
| Fetch and parse a campaign, return a summary and entry type aggregates |
| Map each entry method to its |
| Parse a campaign from a saved HTML file offline |
| Inventory the |
| Catalog of all 48 supported entry types, wallet chains, and intent rules |
| Check whether the X session cookie is still valid |
| Look up a public X profile using the session cookie |
| Status of all session cookie files: present, format, count, session cookie |
| Open a temporary browser with a cookie file and verify the session is alive |
| Follow an X account using the session cookie |
| Map each entry method to the X action required (follow, like, retweet, reply, post) |
| Execute the X actions only without touching gleam entries |
| Single X action: |
| Re-read X GraphQL operation IDs from the live web bundle |
| Show stored operation IDs and check for drift from the built-in map |
| Active browser engine, headless mode, and proxy |
Features
Pure HTTP Entry Submission
Entries are submitted without a browser in the critical path. The bot computes the request signature locally from campaign data, submits the entry to the queue endpoint, then polls the task URL until the server confirms completion. The signature algorithm is verified against live campaign data.
Mandatory Chain Handling
Many campaigns lock entry N until the previous entry is complete. The bot processes entries in order and stops if any mandatory step fails, preventing invalid submissions.
Automatic X Actions
For entry methods that require X activity, the bot executes all needed actions automatically: follows the required account, likes or retweets the target tweet, posts a new tweet, or replies with a comment. Tweet text is generated from the entry label and can be overridden with X_TWEET_TEXT and X_COMMENT_TEXT. Links to created tweets and replies are fetched and submitted to gleam automatically.
X Operation ID Auto-refresh
X changes GraphQL operation IDs when it releases a new bundle. The bot reads the live bundle and updates the stored IDs automatically so operations continue to work after X updates.
Idempotent Actions
Follow, like, and retweet status are checked before acting. If the action has already been done, it is skipped without repeating.
Entry Resolver
Every entry method is classified into one of five resolver statuses before submission: ready (data available), missing (key not in .env), visit-only (no data needed), auth-only (gleam verifies via linked X account), or no-data (unmapped entry type). Missing entries are skipped and reported, not failed.
Multi-Account Support
The .env supports indexed keys (EMAIL_1, WALLET_EVM_2) and per-campaign overrides (CAMPAIGN_<SLUG>_<KEY>) for running multiple accounts and campaign-specific values from a single config file.
Cloudflare Resistance
The HTTP client impersonates Chrome using curl_cffi JA3 fingerprinting. Requests that return 403, 429, or 5xx are retried automatically with proxy rotation from the configured proxy pool.
Temporary Browser Sessions
When a browser is needed (only for gleam_login OAuth and cookie verification), the bot opens a temporary browser instance, injects the session cookie, performs the action, and closes the browser immediately. No browser state is written back to disk and no persistent user data directory is used.
Cookie Format Auto-Detection
Session cookie files are accepted in any format: name/value array, Playwright export, flat map, or raw Cookie header string. The format is detected automatically on load.
File Structure
Gleam-Bot/
├── src/gleam_mcp/
│ ├── __init__.py
│ ├── __main__.py
│ ├── server.py # MCP tool registry and entry point
│ ├── entry.py # Pure HTTP entry engine: signature, queue, poll
│ ├── browser.py # Temporary browser sessions and X OAuth
│ ├── cookies.py # Cookie registry and multi-format loader
│ ├── resolver.py # Entry method to .env key mapper
│ ├── keyspec.py # Key specification: 48 entry types, wallet chains, intent rules
│ ├── parse.py # Campaign HTML parser (AngularJS legacy)
│ ├── envstore.py # .env reader with indexed and per-campaign override support
│ ├── transport.py # HTTP client: curl_cffi impersonation, proxy pool, retry
│ └── sources/
│ ├── gleam.py # Gleam.io HTTP operations
│ ├── x.py # X HTTP operations: follow, like, retweet, reply, post
│ └── xact.py # X GraphQL operation ID store and auto-refresh
├── scripts/
│ ├── gleam_run.py # CLI: state and entry run
│ ├── gleam_login_cli.py # CLI: connect X via OAuth
│ ├── mcp_smoke.py # MCP smoke test
│ ├── mcp_gleam_test.py # Test gleam_state and gleam_enter
│ ├── mcp_live.py # Test against a live campaign via MCP
│ ├── browser_e2e.py # Browser end-to-end test
│ ├── cookie_check.py # Cookie file status check
│ └── demo_resolve.py # Resolver demo
├── session/
│ ├── x.json.example # X cookie template
│ ├── threads.json.example # Threads cookie template
│ └── custom.json.example # Custom service cookie template
├── utils/
│ └── banner.py # Banner using yuurisan module
├── pyproject.toml # Project manifest and dependencies
├── requirements.txt # Pinned dependencies
├── .env.example # Full .env template with all 50 keys documented
└── LICENSE # License fileDisclaimer
This tool is built for educational and technical exploration purposes. Use it wisely and at your own responsibility.
This server cannot be deployed
Maintenance
Related MCP Connectors
Run transparent giveaways on Instagram, X, TikTok and YouTube posts. Draw in your browser.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseCqualityDmaintenanceA comprehensive MCP server for X/Twitter featuring over 70 tools for research, engagement, and publishing with granular permission-based access control. It includes specialized Playwright-powered tools for fetching X articles and supports extensive account management and thread operations.6319MIT
- AlicenseAqualityAmaintenanceReal-time X (Twitter) data platform with 2 MCP tools covering 120+ REST API endpoints. Search tweets, look up users, get timelines, extract followers/likes/retweets in bulk, monitor accounts, run giveaway draws, and perform write actions (tweet, like, retweet, follow, DM). OAuth 2.1 authentication with PKCE.2382 npm213MIT
- AlicenseNot gradedqualityDmaintenanceProvides programmatic X (Twitter) engagement via MCP, offering 24 tools for search, timelines, notifications, bookmarks, profiles, and tweet actions through a headless browser.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to automate Twitter/X tasks (scraping, posting, following, etc.) via 140+ MCP tools, no API key required.379 npm1Apache 2.0