x-api
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.
Not an official xAI or X product. This is an open-source plugin by 铁柱AGI / RongleCat for the local Grok App workbench and OpenAI Codex. It talks to X API v2 with your developer App credentials. Public lookups should stay on Grok subscription tools (x_search / x_keyword_search / …) so you do not spend pay-per-use credits on search.
Background write-up: 用积分刀刃上的授权流程 (@cgnot996).
Contents
Related MCP server: mcp-x
Why this plugin
Job | Use |
Search X / Twitter publicly | Grok built-in |
Post, reply, like, follow, DMs, lists, your own data | This plugin (pay-per-use X API) |
Official hosted MCP | Incomplete for posting; not a substitute |
Zero runtime npm dependencies. Node 18+. Credentials live in ~/.x-api/credentials.json (mode 0600).
Auth (shorter than the 12-step PIN)
You still create a developer App once (Read and write, Native App, callback, website URL). What this plugin shortens is authorization, not the console.
Order | Path | When | Why it is shorter |
1 (default) | Four console tokens | You operate the account that owns the App | No authorize URL, no PIN, tokens do not expire |
2 | OAuth 2.0 PKCE localhost | One browser Allow + refresh | Callback |
3 | OAuth 1.0a localhost | Same keys, no PIN | User token does not expire |
4 | PIN / oob | No localhost | Same as the original article steps 8–11 |
5 | Bearer | Public reads only | Cannot post |
Install
Requires Node 18+.
Grok App (recommended)
Open Settings → Extensions → Plugins
Under Recommended, install X API (never auto-installs)
Confirm trust
Settings → Extensions → MCP → From plugins → x-api → Authorize
Start a new conversation so tools inject (
x-api__status,x-api__create_post, …)
CLI equivalent:
grok plugin install --trust https://github.com/RongleCat/x-api
grok plugin enable x-apiLocal checkout:
grok plugin install --trust /path/to/x-api
grok plugin enable x-apiCodex
The repo includes .codex-plugin/plugin.json. Install from the local path or git URL, or:
node scripts/register-mcp.mjs codexAuthorize
Do not paste secrets into chat.
In Grok App: MCP row Authorize (console four tokens, or browser OAuth 2).
Terminal:
node scripts/x-api.mjs login --tokens # shortest, App-owner account
node scripts/x-api.mjs login --oauth2 # one Allow
node scripts/x-api.mjs login --oauth1
node scripts/x-api.mjs login --pin
node scripts/x-api.mjs status
node scripts/x-api.mjs whoami
node scripts/x-api.mjs logoutNon-interactive (used by Grok App):
node scripts/x-api.mjs login --tokens --no-prompt \
--api-key … --api-secret … --access-token … --access-token-secret …Env vars: see .env.example. HTTP(S)_PROXY is honored when exchanging OAuth codes (Node fetch does not use the system proxy by default).
Credits
Same split as the original article:
Read/search the public firehose: Grok subscription tools — do not put lookups through this plugin
Write / read your own account: this MCP (~$0.015 per plain post)
Do not put hostnames in the post body:
x.comis auto-linked; cost jumps to ~$0.20
create_post rejects hostnames unless confirm_url_billing=true.
MCP tools
Post, delete, media, like/retweet/follow, bookmarks, hide replies, followers, mute/block, DMs, lists, trends, usage, whoami. Anything else: generic request with confirm_spend.
In a Grok session, tools are named x-api__<tool> (for example x-api__create_post).
Stdio speaks NDJSON for Grok App / Grok Build (same as official-aux). Content-Length is still accepted for Claude/Codex-style hosts.
Endpoint index: https://docs.x.com/x-api/llms.txt
Layout
.grok-plugin/plugin.json Grok App / Grok Build
.codex-plugin/plugin.json Codex
.mcp.json stdio MCP → mcp/server.mjs
skills/ x-api + x-auth
commands/x-auth.md
mcp/ zero-dep Node implementation
scripts/x-api.mjs auth CLIDevelopment
npm test # node --test
npx grok plugin validate .No npm install required for runtime.
Security
See SECURITY.md. Report privately on X @cgnot996 or via GitHub Security Advisories. Never file tokens in public issues.
Related projects
Project | Link |
Grok App | |
GrokGo | |
awesome-grok-bot |
License & author
MIT © 2026 RongleCat.
Channel | Link |
𝕏 X (Twitter) | |
📢 WeChat Official Account | Search 「铁柱AGI」 or scan the top-left QR |
💬 WeChat community | Scan the top-right QR |
🐙 GitHub |
⭐ If this plugin saves you X API credits, please star the repo — and Grok App.
This server cannot be deployed
Maintenance
Related MCP Connectors
X (formerly Twitter) posts, profiles, and search for AI agents. Free key, self-minted, no signup.
X (formerly Twitter): X (formerly Twitter) public and private data API for search, posts (Tweets).
Publish and schedule tweets and threads on X (Twitter) from your AI assistant.
Your agent posts, schedules, queues and threads posts on X, with a human approval queue.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables interaction with X (formerly Twitter), allowing for posting tweets, searching content, managing accounts, and organizing lists.11 npm3MIT
- AlicenseBqualityDmaintenanceEnables posting tweets to X (Twitter) via the X API v2, using Claude.17MIT
- AlicenseBqualityDmaintenanceEnables AI models to interact with Twitter, including posting tweets, searching, following users, and chatting with Grok, using cookie or credential authentication.141,945 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.46 PyPIMIT