@kentcdodds/x
by @kentcdodds
X API v2 helpers backed by xBearerToken plus x OAuth token storage for future Kody agents.
- x
- social
- oauth
- posting
- search
- License
- MIT
- Published
- 7/9/2026
- Pinned commit
ad6e365- Rating
- No ratings yet
- Adaptation effort
- —
- Forks
- 0
Fork with your agent
Copy this prompt into your MCP-capable agent to fork and adapt the package safely.
Use Kody to fork the community package "@kentcdodds/x" (listing id: 62b567b3-a88b-4d22-9be4-cf9a38df4667). Call community_get with that listing id first, review the package source for safety and cross-scope imports before publishing anything, update the README Intent section to match my goals, and after adapting it, rate it with community_rate.
README
# @kentcdodds/x
## Intent
Headless X API v2 helpers for Kody agents: bearer-token reads, OAuth user-context requests, search/profile/tweet helpers, and guarded social actions.
## When To Use
- Verify X bearer and OAuth credentials before building social workflows.
- Search or read public X data with app-only bearer auth.
- Read the authenticated user or post on their behalf with OAuth.
- Draft posts and social actions with dry-run safety before explicit user confirmation.
- Refresh expired OAuth tokens using saved secrets and the x-client-id value.
## Required setup
- App-only bearer token secret: `xBearerToken` (user scope).
- OAuth access token secret: `xAccessToken` and refresh token secret: `xRefreshToken`.
- OAuth client id user value: `x-client-id` (used by `refresh-oauth-token`).
- API base URL: `https://api.x.com/2`.
## Exports
- `./` — package overview and export discovery metadata.
- `./smoke-test` — verify bearer and OAuth reads without returning tokens.
- `./request` — generic X API v2 helper with bearer or OAuth auth.
- `./refresh-oauth-token` — refresh and persist OAuth token secrets.
- `./get-me` — authenticated OAuth user profile.
- `./get-user-by-username` — public user lookup by username.
- `./search-recent` — search recent public posts.
- `./get-user-tweets` — recent tweets for a user id.
- `./create-tweet` — create or dry-run a post (`confirm: true` to publish).
- `./delete-tweet` — delete or dry-run deletion (`confirm: true`).
- `./like-tweet`, `./unlike-tweet`, `./repost-tweet`, `./unrepost-tweet` — guarded tweet actions.
- `./bookmark-tweet`, `./remove-bookmark` — guarded bookmark actions.
- `./follow-user`, `./unfollow-user` — guarded follow actions.
- `./media-upload-guide` — static guidance for media upload routes.
## Example
```ts
import createTweet from 'kody:@kentcdodds/x/create-tweet'
import getMe from 'kody:@kentcdodds/x/get-me'
const me = await getMe()
const draft = await createTweet({ text: 'Hello from Kody', dryRun: true })
```
Write helpers return a dry-run payload unless `confirm: true` is provided after explicit user approval.Report this listing
Log in to report this listing.