Product Metrics in Cursor
Add the Product Metrics MCP server, skills and productmetrics CLI to Cursor, then set up tracking and analyse Google Ads from a chat.
Cursor’s agent works with Product Metrics in three ways:
- MCP server (
https://www.productmetrics.io/mcp): reads your stores, products and Google Ads account, and runs setup through the API. - Skills: give the agent the exact steps for tasks such as setting up tracking.
productmetricsCLI: the agent runs it in the terminal with JSON output.
You sign in in your browser. There is no API key.
Install
1. Add the MCP server
Add the server to ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project):
{
"mcpServers": {
"product-metrics": {
"url": "https://www.productmetrics.io/mcp"
}
}
}productmetrics mcp-config --client cursor prints this snippet.
2. Install the skills
From the project you open in Cursor:
npx skills add https://www.productmetrics.io/docs \
--skill '*' \
--agent cursor \
-yThis installs set-up-tracking, connect-google-ads, check-tracking, bid-on-profit and analyse-google-ads. Add --global to install them for every project. Needs Node.js 22.20 or later. See Install skills.
3. Install the productmetrics CLI (optional)
Install it from npm (Node.js 22 or later), then check it:
npm install -g @productmetrics/cli
productmetrics --versionTo run it once without installing, use npx @productmetrics/cli in place of productmetrics. Cursor’s agent runs productmetrics like any other command.
Authenticate
MCP server. Cursor asks you to sign in to Product Metrics the first time it connects. Open Cursor’s MCP settings and click the sign-in prompt next to product-metrics.
Your browser opens the Product Metrics consent page: sign in (or choose Continue with Google to create an account), check what Cursor Can read and Can change, and click Connect Cursor.
productmetrics CLI. Run this in your own terminal:
# opens the browser and waits up to 5 minutes
productmetrics login
# which API, signed in or not, scopes, expiry
productmetrics statusSo that productmetrics never prompts or opens a browser when the agent runs it, set PM_AGENT=1:
echo 'export PM_AGENT=1' >> ~/.zshrc
source ~/.zshrcecho 'export PM_AGENT=1' >> ~/.bashrc
source ~/.bashrc[System.Environment]::SetEnvironmentVariable("PM_AGENT", "1", "User")Restart Cursor after running this.
How it works
- Analysis tools read live.
list_propertiespicks the store, then tools such asexplain_google_ads_change,get_google_ads_reportandget_poas_reportread your Google Ads account and your store’s margins and stock. They never change Google Ads or your store. - Setup runs through Code Mode.
searchfinds an API operation;executeruns code that calls it: setup status, connecting stores and Google Ads, creating conversion actions. Operations that delete something run only after you confirm. - Browser steps come back as a link. Google consent, a store install or checkout needs you in a browser. The agent gives you the link, waits, then reads the setup status again. With the CLI,
productmetricsexits4and puts the URL innext_action.url. - Skills load on demand. The agent reads a skill when your request matches its description.
- The CLI speaks JSON. The agent runs
productmetrics help agentsfirst, then passes--jsonto every command and reads exactly one JSON document from stdout. - Secrets stay out of the chat. Fields such as a store setup token never reach the assistant through MCP.
productmetricshides them unless you pass--show-secrets.
Skills and tools
Skills
| Skill | What it does |
|---|---|
set-up-tracking | Server-side conversion tracking end to end: workspace, store, Google Ads, conversion actions |
connect-google-ads | Connect a Google Ads account and its Merchant Center, or fix a connection |
check-tracking | Check the store, the conversion actions, Enhanced Conversions and the latest purchase |
bid-on-profit | Set up and check POAS or ROAS bidding in Google Ads and Meta |
analyse-google-ads | Explain changes, wasted spend and POAS, read-only |
MCP tools
| Tool | Description |
|---|---|
list_properties | The stores (properties) you can open; call first |
get_store_overview | The store’s own sales, orders and profit next to the ads |
explain_google_ads_change | Why a Google Ads metric changed, in one call |
get_google_ads_report | Live Google Ads performance at any level |
get_poas_report | Profit on ad spend per product, campaign or account, with stock |
get_google_ads_changes | Who changed what in the account, last 30 days |
list_products_to_investigate | Products that need attention first |
propose_change | File a proposal that a person approves in Priorities |
search / execute | The whole Product Metrics API in Code Mode |
All 24 analysis tools and their arguments: MCP tools.
What you can ask
> Where is my Product Metrics setup, and what is the next step?
→ execute (GET /setup/status), or productmetrics setup get-status --json
> Connect my WooCommerce store to Product Metrics.
→ execute (POST /companies/:companyId/stores), or productmetrics stores connect
--company-id <company_id> --provider woocommerce --store-url
https://shop.example --json
then tells you to paste the setup token into the Product Metrics
plugin in your store admin
> Create the Product Metrics conversion actions in Google Ads.
→ execute (POST /properties/:propertyId/google-ads/conversion-actions),
or productmetrics google-ads create-conversion-actions --property-id <property_id>
--company-id <company_id> --json
> Which campaigns have the lowest POAS over the last 30 days?
→ list_properties, then get_poas_report (level: campaign, sort_by: poas,
order: asc)
> Why did my Google Ads conversion value drop since Monday?
→ list_properties, then explain_google_ads_changeConfiguration
Pin one store
For a project that should only see one store, add the property to the URL. The analysis tools then read that store without asking; search and execute still work on your whole account.
{
"mcpServers": {
"product-metrics": {
"url": "https://www.productmetrics.io/mcp?selectedAccountPropertyId=<propertyId>"
}
}
}Environment variables (productmetrics)
# never prompt, never open a browser, no colours
PM_AGENT=1
# an access token, for CI instead of productmetrics login
PM_TOKEN=...
# another API origin (default https://prod-backend.productmetrics.io)
PM_API_URL=...The CLI stores its sign-in in ${XDG_CONFIG_HOME:-~/.config}/product-metrics/credentials.json.
Troubleshooting
| Problem | Fix |
|---|---|
| product-metrics doesn’t appear in Cursor’s MCP settings | Check that mcp.json is valid JSON, then restart Cursor or run Developer: Reload Window. |
| “This connection expired or was removed; connect Product Metrics again.” | Sign in again from Cursor’s MCP settings. If that fails, remove the entry from mcp.json and add it again. |
| “This connection only has MCP access, so it cannot call the Product Metrics API.” | Remove the server, add it again and allow everything the consent page shows. |
| “The MCP server is not enabled for this account yet.” | Ask Product Metrics support to turn it on for your account. |
| “This property needs a Product Metrics Pro subscription for the MCP server.” | Upgrade that store to Pro, or ask about another store. |
productmetrics exits 3 | Not signed in or missing a scope. Run productmetrics login in your own terminal; the hint names the scopes. |
productmetrics exits 4 | A person must finish a step in a browser. Open next_action.url, then ask the agent to check the status again. |
| The agent doesn’t use a skill | Run npx skills list and check it is installed for cursor, then reload the window. |
Where next
- Setup and usage: how sign-in works, every client
- MCP tools: every tool and argument
- Skills: what each skill does
- CLI for agents:
--json, exit codes and safe retries - Claude Code · Codex