mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-22 17:44:53 +02:00
New `backend/apps/twitter` SubApp wraps twikit behind /api/twitter
routes: account pool with cookie persistence, rate-limit gate with
TTL cache, and 429 → {retry_after_s} responses the shim relays as
structured MCP errors. `backend/apps/twitter_mcp_shim` is a stdlib-
only stdio MCP server that forwards each tool call to the local
backend over HTTP using the per-install auth token (re-read on 401
so token rotation can't strand the subprocess).
- tools_lib: wire OPENSWARM_BASE_URL / AUTH_TOKEN(_FILE) / PYTHONPATH
for the twitter shim (mirrors the Discord shim setup)
- paths: add TWITTER_DIR under DATA_ROOT for cookie + state storage
- main: register the twitter SubApp
- requirements: pin twikit==2.3.3 (X rotates query IDs frequently),
add curl-cffi + httpx-curl-cffi for Chrome TLS-fingerprint bypass
(stock httpx JA3 → 403 on x.com since late 2025); see twikit#396
- tests: persistence, pool, ratelimit, routes, shim, twikit patches