This guide shows you how to connect ShortPixel Image Optimizer to Cursor using the Model Context Protocol (MCP).
Once connected, Cursor Agent can interact with ShortPixel directly from your conversations—for example, checking optimization statistics, viewing your available credits, optimizing images, monitoring queues, and working with AI Image SEO.
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:
- Cursor installed
- Node.js 22 or newer installed (
npxis required for the recommended STDIO method) - 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 Cursor will connect as
Important: Treat your WordPress Application Password like any other password. Do not share it publicly, commit it to a repository, or include it in screenshots.
Option A — Connect using STDIO (recommended) #
The recommended method uses Automattic’s WordPress MCP remote package to connect Cursor to your WordPress MCP endpoint.
Your WordPress credentials are passed to the MCP bridge through environment variables, so you do not need to manually create a Base64 authentication token.
Step 1 — Open the Cursor MCP configuration #
There are two ways to manage MCP servers in Cursor.
From Cursor #
- Open Cursor.
- Open Customize from the sidebar.
- Select MCPs.
- Add a new MCP server or open the MCP configuration.
By editing mcp.json #
You can also configure the MCP server directly in an mcp.json file.
For a server available only in the current project, use:
.cursor/mcp.json
For a server available across all your Cursor projects, use:
~/.cursor/mcp.json
Tip: If you use ShortPixel with several WordPress projects, the global configuration may be more convenient. If the credentials are specific to one project, a project-level configuration can make the setup easier to manage.
Step 2 — Add the ShortPixel WordPress server #
Add the following configuration:
{
"mcpServers": {
"shortpixel-wordpress": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "https://YOUR-SITE/wp-json/mcp/mcp-adapter-default-server",
"WP_API_USERNAME": "YOUR-WORDPRESS-USERNAME",
"WP_API_PASSWORD": "YOUR-APPLICATION-PASSWORD",
"OAUTH_ENABLED": "false"
}
}
}
}
Replace the following placeholders:
| Placeholder | Replace with |
|---|---|
YOUR-SITE | Your WordPress domain, including the subdirectory path if WordPress is not installed at the site root |
YOUR-WORDPRESS-USERNAME | Your WordPress username |
YOUR-APPLICATION-PASSWORD | The Application Password created in WordPress |
For example:
https://example.com/wp-json/mcp/mcp-adapter-default-server
If WordPress is installed in a subdirectory, include it in the URL. For example:
https://example.com/wordpress/wp-json/mcp/mcp-adapter-default-server
If you already have other MCP servers #
Do not replace your existing mcp.json file.
Add the shortpixel-wordpress entry alongside your other servers inside the existing mcpServers object.
For example:
{
"mcpServers": {
"another-server": {
"command": "some-command"
},
"shortpixel-wordpress": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "https://YOUR-SITE/wp-json/mcp/mcp-adapter-default-server",
"WP_API_USERNAME": "YOUR-WORDPRESS-USERNAME",
"WP_API_PASSWORD": "YOUR-APPLICATION-PASSWORD",
"OAUTH_ENABLED": "false"
}
}
}
}
Make sure the file remains valid JSON, including the required commas between server entries.
Security tip: If your project-level
.cursor/mcp.jsoncontains your Application Password, do not commit that file to a public repository.
Step 3 — Save and reload the MCP server #
After adding the configuration:
- Save
mcp.json. - Open Customize → MCPs in Cursor.
- Confirm that
shortpixel-wordpressappears in the list. - Check that the server is enabled and its tools are available.
If the server does not load immediately, restart Cursor or disable and re-enable the MCP server.
Screenshot suggestion: Show the shortpixel-wordpress server listed in Customize → MCPs with a successful connection status.
Step 4 — Verify the connection #
Start a new Agent conversation in Cursor and ask:
What ShortPixel abilities are available on my WordPress site?
If the connection is working, Cursor should discover ShortPixel tools such as:
shortpixel/get-statsshortpixel/get-quotashortpixel/run-queueshortpixel/optimize-mediashortpixel/generate-ai-seo
Then try a read-only request:
Show my ShortPixel optimization statistics and remaining credits.
Cursor should query your WordPress site and return the current ShortPixel information.
Screenshot suggestion: Show Cursor Agent listing ShortPixel abilities or displaying the optimization statistics and credit balance.
Option B — Connect directly over HTTP #
Cursor also supports remote MCP servers using an HTTP URL and request headers.
You can therefore connect directly to the WordPress MCP endpoint without running the local mcp-wordpress-remote bridge.
Add a configuration such as:
{
"mcpServers": {
"shortpixel-wordpress": {
"url": "https://YOUR-SITE/wp-json/mcp/mcp-adapter-default-server",
"headers": {
"Authorization": "Basic BASE64_OF_USERNAME_APPLICATION_PASSWORD"
}
}
}
}
The Authorization value must contain your WordPress username and Application Password encoded using HTTP Basic Authentication.
Create the string:
username:APPLICATION-PASSWORD
and Base64-encode the entire value.
macOS or Linux #
Run:
printf '%s' 'username:xxxx xxxx xxxx xxxx xxxx xxxx' | base64
Copy the resulting value and use it after Basic in the configuration:
"Authorization": "Basic YOUR-BASE64-VALUE"
Windows PowerShell #
Run:
[Convert]::ToBase64String(
[Text.Encoding]::UTF8.GetBytes(
'username:xxxx xxxx xxxx xxxx xxxx xxxx'
)
)
Then add the resulting value to:
"Authorization": "Basic YOUR-BASE64-VALUE"
Important: Base64 encoding is not encryption. Anyone who obtains this value can recover the username and Application Password. Always use HTTPS and treat the encoded value as a password.
Which option should I use? #
We recommend Option A — STDIO for most users.
It is easier to configure, does not require you to manually generate a Basic Authentication value, and uses Automattic’s WordPress MCP remote package to handle communication with your WordPress site.
Use the direct HTTP method if you specifically prefer a remote MCP configuration or do not want to run the local STDIO bridge.
Windows note #
The recommended STDIO method uses npx.
If Cursor reports that npx cannot be found:
- Install Node.js 22 or newer.
- Fully restart Cursor.
- Try connecting the MCP server again.
You can verify that Node.js and npx are available by opening PowerShell or Command Prompt and running:
node --version
and:
npx --version
If Node.js is installed but Cursor still cannot find npx, run:
where npx
to find its full path.
Troubleshooting #
The ShortPixel MCP server does not appear #
Check that:
- Your
mcp.jsonfile is in the correct location - The file contains valid JSON
- The
shortpixel-wordpressserver is enabled in Customize → MCPs - Node.js and
npxare available if you are using the STDIO method - You restarted Cursor after changing the configuration
npx cannot be found #
Run:
npx --version
If the command is not recognized, install or update Node.js and restart Cursor.
Authentication or permission error #
Check:
WP_API_URLWP_API_USERNAMEWP_API_PASSWORD- The WordPress user’s role and permissions
Make sure WP_API_PASSWORD contains a WordPress Application Password, not the user’s normal WordPress login password.
No ShortPixel tools are available #
Make sure:
- ShortPixel Image Optimizer is active
- The WP MCP Adapter is active
- Your WordPress version supports the ShortPixel MCP abilities
- The MCP endpoint is correct
You can also check Cursor’s MCP logs for additional information.
Next steps #
Your ShortPixel MCP connection is now ready.
You can use natural-language prompts in Cursor Agent to:
- Check image optimization statistics
- View your ShortPixel credit balance
- Check the status of individual images
- Optimize or restore images
- Start and monitor bulk optimization
- Monitor processing queues
- Generate or undo AI Image SEO metadata
- Read or update supported ShortPixel settings
For more examples, continue to the Get started — example prompts section of the main ShortPixel MCP guide.