x-bookmarks-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
x-bookmarks-mcp
Read, search, organize, and export your own X (Twitter) bookmarks from an AI agent or the terminal, using the session you already have in your browser. No paid API, no browser automation.
MCP server with 17 tools, plus a full CLI
Local cache so search, folders, tags, export, and the viewer work offline
Captures what a bookmark points at: the full text of X articles, the author's thread, the author's answers in the replies (where the repo link usually is), and the posts a bookmarked reply answers
Nested local folders and cross-cutting tags, free and instant
Optional real X folder writes for Premium accounts, gated behind explicit confirmation
Media URLs and downloads through cobalt
Link cards with real OG images and titles, cached locally
Standalone HTML viewer with filters, a media lightbox, and link previews
Requirements
Node.js 20.12 or newer
An X account, logged in on
x.comin a browserX Premium only if you want folders that exist on x.com itself
Related MCP server: bookmark-lens
Setup
npm install
cp .env.example .env # Windows: Copy-Item .env.example .envOpen x.com while logged in, then DevTools > Application (Chrome/Edge) or Storage (Firefox) > Cookies > https://x.com:
Copy
auth_tokenintoX_AUTH_TOKENCopy
ct0intoX_CT0
Or put both in auth.json:
{ "auth_token": "...", "ct0": "..." }Both files are gitignored. Cookie values are never printed.
node src/cli.js doctordoctor checks cookies, account identity, one bookmark page, folder access, write settings, and cobalt, in that order. It is the fastest way to find what is broken.
Use from an agent (MCP)
Server entry point: src/mcp.js. Use an absolute path in client configs.
opencode (opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"x-bookmarks": {
"type": "local",
"command": ["node", "/absolute/path/to/x-bookmarks-mcp/src/mcp.js"],
"enabled": true
}
}
}Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"x-bookmarks": {
"command": "node",
"args": ["/absolute/path/to/x-bookmarks-mcp/src/mcp.js"]
}
}
}Windows paths need escaped backslashes, for example C:\\tools\\x-bookmarks-mcp\\src\\mcp.js.
Tool | Purpose |
| Read-only checks: cookies, identity, bookmarks, folders, writes, cobalt |
| Show the logged-in account |
| One fresh page of bookmarks, optionally from a folder |
| Fill the local cache, incremental by default; expands new posts |
| Fetch threads, author replies, top replies, and article text |
| Keyword, author, date, media, folder, and tag filters |
| One post in full, with its conversation and article |
| Folder tree with totals and tags |
| File into local folders, or an X folder with |
| Create a local or X folder |
| Delete a local folder subtree |
| Add or remove tags |
| Every tag with its count |
| Media URLs, optionally download |
| Markdown or JSON export |
| Ping the cobalt instance |
| Write gate, cooldown, remaining budget |
Full schemas: docs/TOOLS.md. Agent guidance: SKILL.md.
Typical agent flow: bookmarks_sync → bookmarks_search → bookmark_get (thread, author replies, article) → folder_assign and tags_assign on ids it actually read.
CLI
node src/cli.js doctor
node src/cli.js whoami
node src/cli.js sync # incremental, expands new posts
node src/cli.js sync --full --pages 20
node src/cli.js expand --limit 200 --wait # backfill threads, replies, articles
node src/cli.js get 1759123456789012345 # one post as Markdown, with its thread
node src/cli.js list --limit 20
node src/cli.js list --folder "Design/Frontend"
node src/cli.js search "rust async" --folder "Design/Frontend" --tag claude --type video
node src/cli.js folders
node src/cli.js tags
node src/cli.js assign "Reading" 1759123456789012345
node src/cli.js assign "Reading" 1759123456789012345 --remove
node src/cli.js folder-create "Design/Frontend/Glass"
node src/cli.js folder-delete "Papers"
node src/cli.js tag claude 1759123456789012345
node src/cli.js links # fetch OG images for link cards
node src/cli.js view
node src/cli.js media 1759123456789012345 --download
node src/cli.js export --format markdown
node src/cli.js safetyEvery command accepts --json. Full reference: docs/CLI.md.
Viewer
node src/cli.js view writes data/view.html and opens it. One file, no server, no cookies, read-only.
Three panes: folders and tags, the feed, and a reading pane for the selected post. Below 1200 px the reading pane slides over the feed; on phones the folders become a drawer
Feed rows show what each bookmark leads to: an article card, thread length, how often the author replied, and the repo or demo links found in the thread and replies
The reading pane shows the posts being replied to, the post, the full article, the author's thread, the author's answers in the replies, and top replies
Folder tree with totals that include subfolders; tag chips, combine any number
Search across text, author, tags, links, article text, threads, and media alt text
Sort by newest, oldest, or author, plus a media-only toggle
Click a photo or video to open it in place: transparent backdrop,
Escor click outside closesKeys:
/search,j/kor arrows to move through the feed,oopens the post on x.com,Esccloses the pane or clears searchFilters persist in the URL hash (
#folder=Design/Frontend&tags=gsap), so a link restores the same viewEvery post has a local URL:
file:///.../data/view.html#post=<id>opens the viewer scrolled to that post. The same URL is returned aslocalUrlbylist,search, andget
Regenerate after a sync or after changing folders and tags. The viewer is read-only and makes no requests of its own beyond image CDNs; link previews are fetched once by links and stored in the cache.
Threads, replies, and articles
A bookmark is often only the first post: the article body, the rest of the thread, or the link the author dropped in the replies lives elsewhere. expand fetches the conversation around each bookmark (one TweetDetail read per post) and stores:
Field | What it holds |
| Title, cover, and the full article as Markdown (headings, lists, images, code, embedded posts) |
| The posts a bookmarked reply answers, oldest first |
| The author's continuation of the post |
| The author's substantial answers to commenters (links, media, or real text) |
| Top replies from other people, by likes |
sync expands new bookmarks automatically (--no-expand skips it). For older ones run expand; it is resumable, skips posts already expanded, and skips posts with no replies and no article without a request. With --wait it waits out X's cooldowns and continues; without it, it stops and says when to resume. Search covers article text and the expanded posts.
Folders and tags
Two folder kinds, same commands:
Kind | Stored in | Cost | Visible on x.com |
|
| free, instant, no request | no |
| your X account | Premium, gated write | yes |
Local folders nest with slashes: "Design/Frontend/Glass". Listing or searching a parent includes every subfolder. A post can sit in several folders. Nothing is sent to X.
Tags are a second, cross-cutting axis. Use them for properties (tool, license, language) that should not decide placement. A post can carry many.
The folder is created on first assign if it does not exist. Only posts already in the cache can be filed or tagged, so run sync first.
X folders need Premium and go through the gated write path: scope: "x" (CLI --x), X_ALLOW_WRITES=true, and --yes. X allows one folder per bookmark, so an X assignment moves it. Without Premium X answers User is not authorized to use bookmark collections; local folders keep working.
Safety model
Automation on a private endpoint is what can get an account flagged, so reads and writes are handled differently.
Every request goes through one serialized queue. No parallel bursts, even with concurrent tool calls.
Reads are spaced about 900 ms apart plus jitter. Writes are spaced 6 to 9 seconds apart.
A
429sets a 15 minute cooldown (longer if X sendsRetry-After), persisted todata/rate.json, blocking every tool including reads.When X reports two or fewer requests left in an endpoint's window, the tool pauses until the window resets, before X has to answer
429.Reads retry on 5xx with exponential backoff, at most three attempts. Reads never auto-retry a
429.Writes are off unless
X_ALLOW_WRITES=true.Every write needs
confirm: true(CLI--yes); otherwise you get a preview and nothing changes.Batch writes cap at 25 per call with a pre-flight budget check.
A persisted budget of 30 writes per hour (
X_MAX_WRITES_PER_HOUR) applies across processes.Writes stop at the first auth, entitlement, rate-limit, or transaction error.
Sync is incremental by default, so routine runs cost one request.
Only bookmarks and folders are touched. No likes, follows, posts, or DMs.
Maximum safety: leave writes off and use local folders.
Media and cobalt
Videos and GIFs are resolved with cobalt. The public api.cobalt.tools instance has bot protection, so point it at an instance you control:
COBALT_API_URL=https://cobalt.your-host.tld
COBALT_API_KEY=optional-instance-keySelf-host with docker run -p 9000:9000 ghcr.io/imputnet/cobalt:10, then COBALT_API_URL=http://localhost:9000. Verify with node src/cli.js cobalt-check. Photos come straight from pbs.twimg.com.
How it works
Reads use the private
Bookmarks,BookmarkFoldersSlice, andBookmarkFolderTimelineGraphQL operations through your session. Conversations and article bodies come fromTweetDetailwithwithArticleRichContentState.Identity uses
Viewer. The legacy1.1/account/verify_credentialsendpoint returns404now and is no longer used.Writes use
bookmarkTweetToFolderandcreateBookmarkFolder, withx-client-transaction-idgenerated by x-client-transaction-id.Query ids rotate with X's web builds. Resolution order: env override, 24 hour disk cache, community registry, a scan of the bundles served at
x.com/i/jf/, then hardcoded fallbacks. A rejected or404id is refreshed and swapped automatically.Responses are normalized into a stable shape and cached in
data/bookmarks.json.
Details: docs/ARCHITECTURE.md.
Troubleshooting
Symptom | Fix |
| Cookies expired. Log in on x.com again and copy fresh values. |
| Account locked, stale session, or missing feature (folders without Premium). |
| Cooldown active. Wait for |
| Set |
| Hourly cap hit. Wait or raise |
| Rotated query id. One automatic rescan and retry happens. If it repeats, run |
| X folders need Premium. Local folders, reads, search, and export still work. |
| Connection, VPN, or proxy problem, not a cookie problem. |
| Pin |
| Instance needs a key or blocks you. Set |
Project layout
src/ runtime code (one concern per file)
scripts/ repository checks
docs/ architecture, tools, CLI, security, development
data/ local cache and exports, gitignoredDevelopment
See docs/DEVELOPMENT.md. Before any push or release:
npm run check:secretsIt scans the tree for your cookie values, cached account handle, hardcoded token patterns, and missing .gitignore entries. It never prints the values.
Security
Cookies are a full session. .env, auth.json, and data/ are gitignored, and the tool never logs secrets. Read the full model in docs/SECURITY.md.
License
MIT. See LICENSE.
The article-to-Markdown conversion and the thread approach are ported from x-md (MIT).
Disclaimer
Not affiliated with X. This uses private web endpoints with your own session, which is outside X's official API terms. Use it on your own account, keep cookies private, and expect breakage when X changes its web client.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Search and read your saved X (Twitter) bookmarks, likes, images, tags, and threads (read-only).
AI bookmark manager for X, Instagram and TikTok saves, searchable by your agent.
Search and chat with your X bookmarks, with citations back to the original posts.
All your bookmarks in one library. Share them with your AI agents. Read-only search over your saves.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to save and search bookmarks using OpenAI's RAG capabilities for intelligent bookmark management and retrieval.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to save, search, and manage bookmarks with semantic search, automatic metadata extraction, and optional LLM-powered enrichment, all running locally.86MIT

Krill.to MCP Serverofficial
AlicenseAqualityDmaintenanceEnables AI agents to search and manage Twitter/X bookmarks via krill.to.101MIT- FlicenseNot gradedqualityDmaintenanceEnables local AI agents to search, read, and manage a user's saved X likes and bookmarks, sync them from a local browser, and attach notes and tags.5 npm1-