x-api
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@x-apipost a tweet saying 'Just shipped a new feature! π'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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).
X (Twitter) data for AI agents: tweets, profiles, followers, search, trends + social listening.
Twitter: Access real-time Twitter/X data as soon as it's posted! With the Twitter/X AIO API, you.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with X (formerly Twitter), allowing for posting tweets, searching content, managing accounts, and organizing lists.9 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,402 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.MIT