Skip to main content
Glama

xctx.

The context layer for X.

Bring X into your AI's context.

An open-source, zero-cost MCP server that brings X content and personal writing context into AI assistants.

Repository

github.com/ozgureyilmaz/xctx

Plugin

@xctx

MCP server

xctx-mcp

What it does

xctx makes content you provide from X available as structured, attributed context over MCP. It keeps your imported posts, archive, and writing preferences local by default. An AI client can retrieve that context and use it in the conversation.

xctx looks up your imports first. For a public link outside your library, ChatGPT can use its own web search to find and cite the exact post. Coverage depends on what the search can surface. ChatGPT integration

Related MCP server: pyX-MCP

Architecture

flowchart LR
    U[You] --> C[ChatGPT or another MCP client]
    C --> M[xctx-mcp]
    M --> P[Manual post library]
    M --> A[Imported X archive]
    M --> S[Style and preferences]
    P --> M
    A --> M
    S --> M
    M --> C
sequenceDiagram
    actor You
    participant Chat as ChatGPT
    participant MCP as xctx-mcp
    participant Data as Local context
    You->>Chat: X URL and a question
    Chat->>MCP: get_post(url)
    MCP->>Data: Look up imported post
    Data-->>MCP: Content with provenance, or not found
    MCP-->>Chat: Structured result
    opt No import and public URL
        Chat->>Web: Search for the exact post
        Web-->>Chat: Matching source, if available
    end
    Chat-->>You: Cited answer or request for the text

Web results stay in the chat. If the host cannot source the exact post, paste the text or attach a screenshot.

Requirements

  • Node.js 24 or later

  • npm

Install and run

git clone https://github.com/ozgureyilmaz/xctx.git
cd xctx
npm ci
npm run build
npm run mcp:stdio

Use npm run dev while developing. The package also provides typecheck, test, lint, test:integration, and smoke scripts. See local setup for HTTP mode, imports, and troubleshooting.

For local HTTP mode, xctx binds to loopback by default and uses port 8787. Override the port with XCTX_PORT. HTTP requests are checked against the host and origin and require the XCTX_HTTP_TOKEN token.

export XCTX_HTTP_TOKEN="$(openssl rand -hex 32)"
XCTX_PORT=8787 npm run mcp:http

Configure the trusted local MCP client with the same token using its private environment or secret settings. Keep the token private. Do not expose this listener to the network. See local setup.

Import your content

Import a post when you have its text:

npm run import:post -- \
  --url "https://x.com/example/status/123" \
  --text "The post text you supplied"

Or import a JSON record:

npm run import:post -- --file ./post.json

Import your own downloaded X archive:

npm run import:archive -- ./x-archive.zip

The data directory defaults to ./data and is ignored by Git. It contains manual post records under data/manual/, archive records in data/archive.json, and editable data/style.md and data/preferences.json files. Imports are local and are not live synchronization with X. For archive format and storage details, see local setup and privacy.

MCP tools

Tool

Purpose

get_post

Retrieve an imported post by X URL.

get_my_style

Return the configured writing style and preferences.

search_my_posts

Search the locally imported archive with deterministic text matching.

get_status

Report safe configuration and data availability.

All MCP tools are read-only. Imports are local owner operations, not MCP tools. There are no X account actions.

ChatGPT use

With the private ChatGPT plugin connected, try:

@xctx https://x.com/example/status/123 explain this in Turkish
@xctx https://x.com/example/status/123 write five quote tweets in my style
@xctx compare these two X posts

These prompts require a connected private Site plugin. The local MCP server can also be connected through a supported MCP client. ChatGPT integration

Cost and privacy

Running the local software has no service fee. The default provider makes no automated X requests, uses no paid X API, external LLM API, paid database, or paid hosting. ChatGPT use follows the limits of your existing account. ChatGPT Sites hosting is currently included with Plus and Pro, with shared usage and storage limits; check OpenAI's Sites documentation for current terms.

Imported content stays in the local data/ directory unless you choose to send it to an MCP client. Content returned to ChatGPT is processed under the account and workspace settings in effect there. See privacy and the threat model.

Current status

  • Manual post imports and local archive/style context are the supported data sources.

  • Automated X retrieval remains disabled. No real X provider calls are part of the supported flow.

  • The repository includes a Worker adapter and private Site deployment instructions. Sites deployment

  • Build, protocol, and hosted verification are recorded in the test report.

Documentation

License

MIT. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to access Twitter/X data including user profiles, tweets, search, and follower events via a set of MCP tools.
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to post, search, and manage tweets on X (Twitter) via the MCP protocol.
      10
      2
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Turns saved X posts and long-form articles into a private, searchable context base accessible via MCP. Lets coding agents import, search, read, and enrich the library using the user's existing browser session.
      MIT