Skip to content
Product Metrics MCP

Product Metrics in Claude Code

Add the Product Metrics MCP server, skills and productmetrics CLI to Claude Code, then set up tracking and analyse Google Ads from the terminal.

Claude Code 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: teach Claude the exact steps for tasks such as setting up tracking.
  • productmetrics CLI: the same API as commands with JSON output.

You sign in once in your browser. There is no API key.

Install

1. Add the MCP server

claude mcp add --transport http product-metrics \
  https://www.productmetrics.io/mcp

Add --scope user to use it in every project, or --scope project to share it with your team through .mcp.json. productmetrics mcp-config --client claude prints the same command.

2. Install the skills

From the project where you run Claude Code:

npx skills add https://www.productmetrics.io/docs \
  --skill '*' \
  --agent claude-code \
  -y

This 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 --version

To run it once without installing, use npx @productmetrics/cli in place of productmetrics. Claude Code runs productmetrics like any other command.

Authenticate

MCP server. Start Claude Code and run /mcp. Choose product-metrics and pick Authenticate.

Your browser opens the Product Metrics consent page. Check what Claude Code Can read and Can change. Signed out, click Continue with Google (it creates an account if you have none) or Sign in under the card: either brings you back to the same page. Then click Connect Claude Code.

productmetrics CLI. Run this in your own terminal, not through Claude:

# opens the browser and waits up to 5 minutes
productmetrics login
# which API, signed in or not, scopes, expiry
productmetrics status

productmetrics renews its token on its own for 30 days. In Claude Code’s shell productmetrics never prompts or opens a browser; to set that in every shell, see CLI for agents.

How it works

  • Browser steps come back as a link. Google consent, a store install or checkout needs you in a browser. Claude gives you the link, waits, then reads the setup status again.
  • Analysis tools only read. They never change Google Ads or your store. Setup runs through search and execute, and operations that delete something run only after you confirm.
  • Secrets stay out of the chat. Fields such as a store setup token never reach the assistant through MCP.

Every tool: MCP tools. Every skill: Skills.

What you can ask

Run /mcp to sign in, check the connection or reconnect. Type a skill’s name to run it, for example /set-up-tracking; Claude also loads a skill when your request matches it. Or just 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 Shopify store to Product Metrics.
→ execute (POST /companies/:companyId/stores), or productmetrics stores connect
  --company-id <company_id> --provider shopify --json
  then gives you the link to approve the install in Shopify 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 products lose money after ads this month?
→ list_properties, then get_poas_report (level: product,
  only_unprofitable: true)

> Why did my Google Ads ROAS drop last week?
→ list_properties, then explain_google_ads_change

Configuration

Project config

claude mcp add --scope project writes .mcp.json in the repository root. You can also create it by hand:

.mcp.json
{
  "mcpServers": {
    "product-metrics": {
      "type": "http",
      "url": "https://www.productmetrics.io/mcp"
    }
  }
}

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.

claude mcp add --transport http product-metrics \
  "https://www.productmetrics.io/mcp?selectedAccountPropertyId=<propertyId>"

productmetrics settings

PM_AGENT, PM_TOKEN for CI and PM_API_URL: CLI overview and Authentication.

Troubleshooting

ProblemFix
product-metrics shows as failed or needs authentication in /mcpPick Authenticate again and finish the sign-in in the browser.
“This connection expired or was removed; connect Product Metrics again.”Run /mcp and authenticate again. If that fails, claude mcp remove product-metrics 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 3Not signed in or missing a scope. Run productmetrics login in your own terminal; the hint names the scopes.
productmetrics exits 4A person must finish a step in a browser. Open next_action.url, then ask Claude to check the status again.
Claude doesn’t use a skillRun npx skills list and check it is installed for claude-code, then restart Claude Code.

Where next