Connecting Codex to WordPress.com from Termux on Android, debugging MCP and OAuth errors, and keeping publishing under human control.
Can You Publish to WordPress from Android Termux Using Codex CLI?
Yes, you can publish from Termux using Codex CLI. However, misconfiguring OAuth authorization headers or REST endpoints causes silent 403 Forbidden errors and failed uploads. Follow our verified mobile endpoint configuration below →
You can run Codex from an Android terminal and connect it to WordPress.com through the Model Context Protocol (MCP). This guide documents not only the successful setup, but also the connection failures encountered along the way: an incorrect endpoint that returned HTTP 404, an OAuth callback that depended on Termux remaining open, credentials that did not persist into a fresh process, and WordPress sites whose plans or connection states limited the available tools.
The example device is a Samsung Galaxy S26 Ultra, although the workflow applies to other Android phones capable of running a maintained Termux build. The important parts are the Codex CLI, the exact MCP endpoint, a working OAuth credential store, and a deliberate draft-first publishing workflow.
Using Claude instead? See Publishing to WordPress with Claude and the WordPress MCP Connector for the corresponding browser-based Claude workflow, WordPress HTML constraints, and reusable-skill approach.
🔐 Keep Termux running during OAuth, and never paste an access token into a prompt.
Start authentication with codex mcp login wpcom-mcp. The browser redirects to a temporary callback on 127.0.0.1, so the Codex process in Termux must remain alive to receive it.
After approval, start a fresh Codex session and verify the server again. Treat ~/.codex as private configuration and never commit it to a public repository.
Once the connection works, keep the workflow conservative: let Codex research and draft first, create or update the WordPress draft second, review it in the editor, and publish only after the exact site and post have been confirmed.
AI Workflows · 2026
✦ This article was assembled with the assistance of OpenAI Codex and checked against current official Codex documentation ✦
Want a complete Codex project? Follow the hands-on Knight’s Tour project with Codex CLI, including scaffolding, tests and diff review.
Explore more terminal automation, AI pair programming, and mobile agent guides:
How do you authenticate Codex CLI with WordPress.com on Android?
Authenticate using an application password or OAuth bearer token passed via standard HTTP Authorization headers, configuring your local environment script in Termux to target the /wp/v2/posts endpoint.
Why do mobile REST requests fail with 403 Forbidden or CORS issues?
Mobile 403 errors typically result from missing user-agent headers, incorrect OAuth scopes, or attempting to use cookie authentication outside a logged-in browser session instead of Application Passwords.
Leave a Reply