xctx-mcp
by ozgureyilmaz
README.md
# 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](https://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](docs/chatgpt-integration.md)
## Architecture
```mermaid
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
```
```mermaid
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
```sh
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](docs/setup.md) 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.
```sh
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](docs/setup.md).
## Import your content
Import a post when you have its text:
```sh
npm run import:post -- \
--url "https://x.com/example/status/123" \
--text "The post text you supplied"
```
Or import a JSON record:
```sh
npm run import:post -- --file ./post.json
```
Import your own downloaded X archive:
```sh
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](docs/setup.md) and [privacy](docs/privacy.md).
## 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:
```text
@xctx https://x.com/example/status/123 explain this in Turkish
```
```text
@xctx https://x.com/example/status/123 write five quote tweets in my style
```
```text
@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](docs/chatgpt-integration.md)
## 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](https://help.openai.com/en/articles/20001339-creating-and-using-chatgpt-sites) 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](docs/privacy.md) and the [threat model](docs/threat-model.md).
## 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](deployment/sites/README.md)
- Build, protocol, and hosted verification are recorded in [the test report](docs/test-report.md).
## Documentation
- [Architecture](docs/architecture.md)
- [Local setup](docs/setup.md)
- [ChatGPT integration](docs/chatgpt-integration.md)
- [Provider policy and source review](docs/provider-policy.md)
- [Privacy](docs/privacy.md)
- [Threat model](docs/threat-model.md)
- [Limitations and roadmap](docs/limitations.md)
- [Test report](docs/test-report.md)
## License
MIT. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues