This guide shows you how to connect ShortPixel Image Optimizer to Codex using the Model Context Protocol (MCP). Once connected, Codex can check your ShortPixel optimization status, manage image optimization, work with AI Image SEO, and access other ShortPixel abilities directly from your WordPress site.
Before continuing, complete the Prepare WordPress section of the main ShortPixel MCP guide.
You should have the following information ready:
- Your WordPress site URL
- Your WordPress username
- Your WordPress Application Password
- Your MCP endpoint:
https://YOUR-SITE/wp-json/mcp/mcp-adapter-default-server
Prerequisites #
Before you begin, make sure you have:
- The ChatGPT desktop app with Codex installed
- An OpenAI account with access to Codex
- Node.js installed (
npxis required to run the STDIO MCP server) - ShortPixel Image Optimizer verson 6.6.0 or newer, active on your WordPress site
- The WP MCP Adapter active on your WordPress site
- A WordPress Application Password for the user Codex will connect as
Important: Treat your WordPress Application Password like any other password. Do not share it publicly or include it in screenshots.
Step 1 — Add a new MCP server #
- Open the ChatGPT desktop app and switch to Codex.
- Open Settings → MCP servers.
- Click Add server.
- Choose STDIO as the server type.
Screenshot suggestion: Show the MCP servers screen with Add server and STDIO highlighted.
Step 2 — Configure the WordPress MCP bridge #
Enter the following values:
| Field | Value |
|---|---|
| Name | shortpixel-wordpress or your site domain |
| Command | npx |
Arguments #
Add the following arguments separately, one per line if the interface supports it:
-y
@automattic/mcp-wordpress-remote@latest
Environment variables #
Add these environment variables:
| Variable | Value |
WP_API_URL | https://YOUR-SITE/wp-json/mcp/mcp-adapter-default-server |
WP_API_USERNAME | Your WordPress username |
WP_API_PASSWORD | Your WordPress Application Password |
OAUTH_ENABLED | false |
Replace YOUR-SITE with your actual domain.
For example:
https://example.com/wp-json/mcp/mcp-adapter-default-server
If WordPress is installed in a subdirectory, make sure that path is included in the URL.
Screenshot suggestion: Show a completed Add server form. Blur or hide the value of WP_API_PASSWORD, and make sure OAUTH_ENABLED=false is visible.
Step 3 — Save the MCP server #
Review the configuration and click Save.
If you already use other MCP servers, you do not need to replace or modify them. Add the ShortPixel WordPress server alongside your existing servers.
Step 4 — Restart the MCP server #
After saving:
- Return to the MCP servers list.
- Confirm that
shortpixel-wordpress— or the name you chose — appears in the list. - Click Restart to reload the MCP configuration.
Screenshot suggestion: Show the ShortPixel/WordPress MCP server in the server list after it has been restarted successfully.
Step 5 — Verify the connection #
Once the MCP server is running, close Settings and start a new Codex chat.
Ask:
What ShortPixel abilities are available on my WordPress site?
If the connection is working, Codex should discover ShortPixel tools such as:
shortpixel/get-statsshortpixel/get-quotashortpixel/optimize-mediashortpixel/generate-ai-seo
You can then try a real ShortPixel request, for example:
Show my ShortPixel quota and tell me how many images are still unoptimized.
Codex should query your WordPress site and return the current information.
You can also type:
/mcp
to view the MCP servers currently connected to Codex.
Screenshot suggestion: Show a Codex response listing the available ShortPixel abilities or displaying a successful ShortPixel quota summary.
Windows note #
If Codex reports that npx cannot be found, install the latest Node.js LTS version and then restart the ChatGPT desktop app.
After installing Node.js, try the MCP connection again.
You can verify that Node.js and npx are available by running:
node --version
and:
npx --version
in Command Prompt or PowerShell.
Next steps #
Your ShortPixel MCP connection is now ready.
You can use natural-language prompts to:
- Check image optimization statistics
- View your ShortPixel credit balance
- Optimize or restore individual images
- Start bulk optimization jobs
- Monitor processing queues
- Generate AI Image SEO metadata
- Review or update supported ShortPixel settings
For examples of what you can ask Codex to do, continue to the Get started — example prompts section of the main ShortPixel MCP guide.