Power your agent
คำสั่งของผู้เผยแพร่เอง ไม่ใช่เอนด์พอยต์ของ PlugMCP
Host a copy with our keys and logs.
npx -y [email protected]Claude Code ไม่มีลิงก์ติดตั้งสำหรับคำสั่งแบบโลคัล ให้คัดลอกคำสั่งด้านล่างแล้วรันในเทอร์มินัล
X_MCP_AUTH_MODE=<value> X_MCP_CLIENT_ID=<value> X_MCP_CLIENT_SECRET=<secret> X_MCP_BEARER_TOKEN=<secret> X_MCP_TOKEN_FILE=<value> X_MCP_TOKEN_KEYCHAIN=<value> X_MCP_POLICY=<value> X_MCP_POLICY_ALLOW=<value> X_MCP_POLICY_DENY=<value> X_MCP_HIDE_DENIED=<value> X_MCP_MEDIA_DIR=<value> X_MCP_AVAILABILITY=<value> X_MCP_PROFILES_FILE=<value> X_MCP_PROFILE=<value> X_MCP_TIMEOUT_MS=<value> X_MCP_LOG_LEVEL=<value> X_MCP_CREDIT_BUDGET=<value> X_MCP_BUDGET_MODE=<value> claude mcp add io.github.ivanbbaev-x-mcp-ai -- npx -y x-mcp-ai@0.8.0รันในเทอร์มินัล
{ "mcpServers": { "io.github.ivanbbaev-x-mcp-ai": { "command": "npx", "args": [ "-y", "[email protected]" ], "env": { "X_MCP_AUTH_MODE": "<value>", "X_MCP_CLIENT_ID": "<value>", "X_MCP_CLIENT_SECRET": "<secret>", "X_MCP_BEARER_TOKEN": "<secret>", "X_MCP_TOKEN_FILE": "<value>", "X_MCP_TOKEN_KEYCHAIN": "<value>", "X_MCP_POLICY": "<value>", "X_MCP_POLICY_ALLOW": "<value>", "X_MCP_POLICY_DENY": "<value>", "X_MCP_HIDE_DENIED": "<value>", "X_MCP_MEDIA_DIR": "<value>", "X_MCP_AVAILABILITY": "<value>", "X_MCP_PROFILES_FILE": "<value>", "X_MCP_PROFILE": "<value>", "X_MCP_TIMEOUT_MS": "<value>", "X_MCP_LOG_LEVEL": "<value>", "X_MCP_CREDIT_BUDGET": "<value>", "X_MCP_BUDGET_MODE": "<value>" } } }}claude_desktop_config.json
URL แบบรีโมตหรือคำสั่งบนเครื่องของคุณ? การติดตั้งสองแบบต่างกันอย่างไร
รันบน PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
เปิดจากผู้เผยแพร่
Safety-first X (Twitter) API v2 MCP server: 41 typed tools across 12 packages, policy-gated.
An MCP server that exposes the X (Twitter) API v2 to MCP clients — Claude Code, Claude Desktop, VS Code, Cursor, or any MCP-compatible agent — as a curated set of typed tools, gated by a two-axis policy model and aware of the 2026 pay-per-use pricing so an agent can never quietly overspend.
Status: pre-1.0, under active development, published on npm as
x-mcp-ai(currently0.8.0, published from CI with npm provenance). Pin an exact version while the project is on0.x(Setup). 41 tools across 12 packages are registered today; the full designed surface lives indocs/03-tool-catalog.mdand has landed in full. The public API is unstable until1.0.0.
Contents: Quick demo · Features · Requirements · Setup · Configure credentials · Cost · Run / debug · Develop · Tools · Resources · Prompts · Project structure · Security notes · Data handling · Documentation · Support · Trademark
Once the server is wired into your MCP client, you drive it in natural language and the model picks the tool. Three representative asks:
// 1. Read (default read-only preset — no writes possible)
// "What are people saying about the Model Context Protocol this week?"
{
"tool": "x_search_recent",
"arguments": { "query": "\"model context protocol\" -is:retweet lang:en", "max_results": 25 }
}
// 2. Engage (requires the `engage` preset or an explicit write:engagement allow)
// "Like that launch post for me."
{
"tool": "x_like_set",
"arguments": { "post_id": "1899…", "action": "like" }
}
// 3. Publish (requires the `publish` preset or write:content)
// "Post: 'Shipping x-mcp-ai today.' — mind the cost."
// Every result carries cost_usd + session_total_usd; a URL in the text raises the price 13×.
{
"tool": "x_post_create",
"arguments": { "text": "Shipping x-mcp-ai today." }
}
operation:domain) with five presets — read-only (default),
engage, publish, manage, full. Writes are opt-in; deny beats allow beats
preset, per cell. Direct-message cells are double-locked: read:dm/write:dm are in
no preset, not even full.cost_usd and the running session_total_usd; an operator-set
X_MCP_CREDIT_BUDGET with X_MCP_BUDGET_MODE=hard refuses calls that would exceed it,
and the model cannot raise the cap.Authorization header, redirects never followed
on token-bearing requests, 0600 token file written with O_NOFOLLOW/O_EXCL,
untrusted-content marking on returned text, and media upload default-deny outside a
realpath-contained X_MCP_MEDIA_DIR.retryable and
fix: "agent" | "operator", so the model retries what is retryable and escalates what is
not.outputSchema and returns
structuredContent alongside the text block.The recommended install is the published package, pinned to an exact version while the
project is on 0.x — nothing to clone or build:
npx -y [email protected] doctor # sanity check; makes no billable calls
Then point your MCP client at it:
// claude_desktop_config.json (Claude Desktop) / .mcp.json (Claude Code) / .cursor/mcp.json
{
"mcpServers": {
"x": {
"command": "npx",
"args": ["-y", "[email protected]"],
"env": {
"X_MCP_AUTH_MODE": "oauth2",
"X_MCP_CLIENT_ID": "your-oauth2-client-id",
"X_MCP_POLICY": "read-only",
"X_MCP_CREDIT_BUDGET": "5.00",
"X_MCP_BUDGET_MODE": "hard"
}
}
}
}
Running from a local checkout instead? Use "command": "node" with
"args": ["/abs/path/to/x-mcp/build/src/index.js"] and the same env map.
Claude Code from the CLI:
claude mcp add x --env X_MCP_POLICY=read-only -- npx -y [email protected]
Per-client instructions — Claude Desktop, Claude Code, VS Code (.vscode/mcp.json),
Cursor and MCP Inspector — are in
docs/10-operator-guide.md §4, together with the authorize
flow and ready-made env recipes.
Still fully supported — build the entry point and spawn it with node instead of npx:
git clone https://github.com/IvanBBaev/x-mcp.git
cd x-mcp
npm ci
npm run build # tsc → build/src/index.js
node build/src/index.js doctor # sanity check; makes no billable calls
The server never prompts interactively; all configuration comes from environment variables
(canonical table: docs/02-architecture.md §4; a starting point:
.env.example).
Auth modes (X_MCP_AUTH_MODE):
oauth2 (default) — OAuth 2.0 with PKCE. Run the one-time authorization flow with the
authorize subcommand; tokens land in X_MCP_TOKEN_FILE and are refreshed automatically.app-only — application-only bearer token (X_MCP_BEARER_TOKEN); read endpoints only, no
user context.X_MCP_AUTH_MODE=oauth2 X_MCP_CLIENT_ID=… node build/src/index.js authorize
Any other X_MCP_* variable is ignored with a startup warning — that is the typo detector.
Every fatal configuration error names the variable at fault.
Every tool maps to one policy cell — an operation:domain pair. Operations escalate
read → write → destructive; domains are content, user, account, engagement,
social-graph, moderation, dm. A preset unlocks a set of the 12 valid cells;
X_MCP_POLICY_ALLOW adds cells, X_MCP_POLICY_DENY removes them, and
deny > allow > preset.
DM cells are never in a preset — not even
full.read:dmandwrite:dmmust be granted explicitly viaX_MCP_POLICY_ALLOW(all 41 tools callable). Their unlock hint is deliberately withheld from policy errors, as it is for every other sensitive cell. Denied tools stay registered but annotated(disabled by policy <preset>)unlessX_MCP_HIDE_DENIED=1.
Note that manage grants destructive content operations only — follow/mute/block need
full or an explicit write:social-graph / destructive:social-graph allow.
Pay-per-use is the only pricing model. X retired the Free/Basic/Pro subscription tiers for new developers on 2026-02-06; every read and write draws down prepaid credits. Since 2026-04-16, a post whose text contains a URL costs $0.20 instead of $0.015 — 13×. Set
X_MCP_CREDIT_BUDGETbefore pointing an agent at a real account.
Indicative rates (verified 2026-07-22): post reads ~$0.005 each, user lookups and
follower/following reads ~$0.010, own-data reads ~$0.001, DM events ~$0.010, post create
$0.015 (or $0.20 with a URL), DM send $0.015, list create $0.010, engagement writes
currently $0. X also caps post reads at 2,000,000 per month. The authoritative table is
docs/01-api-landscape.md §3; the operator's view is
docs/10-operator-guide.md §5.
The budget is per process, advisory, resets on restart, and is model-immutable — there is no per-call override and no tool that raises it.
MCP clients spawn the server for you. To run it by hand:
X_MCP_POLICY=read-only node build/src/index.js serve
stdout carries JSON-RPC only; diagnostics, warnings and the single
x-mcp-ai: fatal: <reason> startup line go to stderr. Symptom-driven fixes are in
docs/11-troubleshooting.md.
git clone https://github.com/IvanBBaev/x-mcp.git
cd x-mcp
npm ci
npm run build # tsc → build/
npm run check # typecheck + lint + format:check + test
Other scripts: npm run typecheck, npm run lint, npm run format / format:check,
npm test, npm run coverage (c8), and npm run verify (clean build + coverage + lint +
format check). See CONTRIBUTING.md for conventions and the full quality
gate.
The 41 tools registered today. "Read-only" marks tools in a read:* policy cell — those
callable under the default preset (DM reads excepted: they need an explicit allow).
"User" marks user-only tools, which require OAuth 2.0 user context and are unreachable
with an app-only bearer token. The designed surface is
docs/03-tool-catalog.md; the full per-tool reference —
schemas, scopes, cost class, availability — is
docs/reference/tools.md.
The table below is generated from the tool registry by
npm run docs:gen. Do not edit it by hand:npm run checkregenerates and diffs it, so an edit fails CI rather than shipping. Same fordocs/reference/tools.md.
DM reads return ids, timestamps and participants only; message bodies require an explicit
include_text: true on the call.
MCP resources are planned — a read-only exposure of the resolved auth context and live rate-limit table as addressable resources. Not shipped.
MCP prompts are planned — guided templates for common workflows (e.g. cost-aware posting, audience research). Not shipped.
Ports & adapters; the module layout is fixed in
docs/02-architecture.md §3:
src/
├── index.ts # composition root + stdio wiring
├── core/ # config, policy, budget, errors, ports, tooldef,
│ # registry, render, resolve, paginate, sanitize
├── api/ # http, ratelimit, errors, oauth2/, endpoints/
├── tools/ # one module per package (posts, search, graph, …)
├── mcp/ # compose, server, schema, structured, gates, session
└── cli/ # dispatch, authorize, doctor
Dependency rule: tools → core + api/endpoints, api → core, mcp → tools + core,
cli → core + api. Nothing in core reaches outward or does I/O.
A summary; the full threat model and operator checklist live in
SECURITY.md and docs/04-security.md.
Authorization header is attached only for the configured API
origin; redirects are never followed on token-bearing requests (confused-deputy defense).
Proxy environment variables are ignored.0600 with O_NOFOLLOW/O_EXCL; refresh is
single-flight with reload-under-lock and fails closed rather than racing.*:dm, destructive:*,
*:social-graph) names the blocked cell but never the variable that would unlock it, so
the model cannot relay an escalation recipe to you.realpaths inside
X_MCP_MEDIA_DIR.npx -y x-mcp-ai executes the
newest publish on every client cold-start — in a process holding your tokens. Releases
are published from CI with npm provenance. The npm package name is x-mcp-ai; x-mcp
is only the repository name.Full statement: docs/12-privacy.md.
0600 file on your machine. No tool ever returns a
credential, and doctor masks them.If this project saves you time, support is welcome:
x-mcp-ai is an independent, unofficial project. It is not affiliated with, endorsed by, or sponsored by X Corp. It talks to the official, publicly documented X API v2 and does not use any private, undocumented or scraping-based access.
"X", "Twitter", and related names, logos and marks are trademarks of X Corp. They are used here nominatively, only to describe what this software interoperates with. This project is released under the MIT License; trademark rights are not licensed.
Safety-first X (Twitter) API v2 MCP server: 41 typed tools across 12 packages, policy-gated.
{ "mcpServers": { "io.github.ivanbbaev-x-mcp-ai": { "command": "npx", "args": [ "-y", "[email protected]" ], "env": { "X_MCP_AUTH_MODE": "<value>", "X_MCP_CLIENT_ID": "<value>", "X_MCP_CLIENT_SECRET": "<secret>", "X_MCP_BEARER_TOKEN": "<secret>", "X_MCP_TOKEN_FILE": "<value>", "X_MCP_TOKEN_KEYCHAIN": "<value>", "X_MCP_POLICY": "<value>", "X_MCP_POLICY_ALLOW": "<value>", "X_MCP_POLICY_DENY": "<value>", "X_MCP_HIDE_DENIED": "<value>", "X_MCP_MEDIA_DIR": "<value>", "X_MCP_AVAILABILITY": "<value>", "X_MCP_PROFILES_FILE": "<value>", "X_MCP_PROFILE": "<value>", "X_MCP_TIMEOUT_MS": "<value>", "X_MCP_LOG_LEVEL": "<value>", "X_MCP_CREDIT_BUDGET": "<value>", "X_MCP_BUDGET_MODE": "<value>" } } }}เครื่องมือ
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
FAQ
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
ผู้เผยแพร่ระบุตัวแปรสภาพแวดล้อมเหล่านี้: X_MCP_AUTH_MODE, X_MCP_CLIENT_ID, X_MCP_CLIENT_SECRET, X_MCP_BEARER_TOKEN, X_MCP_TOKEN_FILE, X_MCP_TOKEN_KEYCHAIN, X_MCP_POLICY, X_MCP_POLICY_ALLOW, X_MCP_POLICY_DENY, X_MCP_HIDE_DENIED, X_MCP_MEDIA_DIR, X_MCP_AVAILABILITY, X_MCP_PROFILES_FILE, X_MCP_PROFILE, X_MCP_TIMEOUT_MS, X_MCP_LOG_LEVEL, X_MCP_CREDIT_BUDGET, X_MCP_BUDGET_MODE
X MCP Ai ทำงานแบบโลคัลผ่าน stdio
ตรวจสอบล่าสุดเมื่อ 2026-11-09 Safety-first X (Twitter) API v2 MCP server: 41 typed tools across 12 packages, policy-gated.