Metryx← Back to home

Metryx for AI agents

Connect Claude Code, Codex, Cursor or another MCP client to your Metryx workspace with a personal access token.

Read at your own pace · Updated

How to connect

Metryx has a hosted Model Context Protocol (MCP) server for your workspace at https://heymetryx.com/api/mcp. Keys are read-only unless you choose to let one edit product costs. Any MCP client that can send a bearer token over HTTP can use it, including Claude Code, Codex and Cursor.

  1. Open your dashboard menu and choose Connect your AI, or go to /connect-ai. Sign in with the same Google account you use for Metryx.
  2. Pick your assistant (Claude Code, Codex, Cursor or Other). Leave "Allow it to edit product costs" unticked for a read-only key, then click Create key.
  3. Claude Code or Codex: copy the command the page shows, paste it into your terminal, then restart the assistant.
  4. Cursor: click Add Metryx to Cursor and confirm the install.
  5. Any other assistant: add an HTTP MCP server with the URL and header the page shows.

The command already contains your private access key, so there is nothing else to set up. It is shown once; if you lose it, connect again and revoke the old connection. Running the command again replaces the earlier Metryx entry.

If you prefer to keep the key in an environment variable, these manual configurations work too.

Claude Code example (.mcp.json):

{
  "mcpServers": {
    "metryx": {
      "type": "http",
      "url": "https://heymetryx.com/api/mcp",
      "headers": { "Authorization": "Bearer ${METRYX_MCP_TOKEN}" }
    }
  }
}

Codex example (config.toml):

[mcp_servers.metryx]
url = "https://heymetryx.com/api/mcp"
bearer_token_env_var = "METRYX_MCP_TOKEN"

Then ask, for example: "Read my last completed week's profit report. Show the dates, source freshness, and what is actual, estimated or missing."

Tokens and limits

A token reads one workspace, the one you created it in, and nothing else. The connections list shows which keys can edit product costs; a key's permission is fixed when it is created, so create a new key to change it. You can hold up to ten active tokens. Each token allows 60 requests per minute, and the workspace allows 120 per minute across all its tokens. Revoke a token on the same page and the next request with it is refused. Tokens stop working when they expire or when your plan is no longer active.

Sign-in connections for ChatGPT and Claude on the web are not available yet; they need a sign-in flow that is still to come. Use a client that accepts a bearer token.

What read-only means

The four read tools read reports, product economics, saved cost assumptions and source health. With a read-only key, which is the default, that is all an assistant can do: it cannot edit costs, change a Shopify store, change ads, manage billing or send messages. The tools expose the same contribution calculations and missing-input context used by the dashboard, subject to the output exclusions in the MCP tool reference.

Letting an assistant edit product costs

When you create a key you can tick "Allow it to edit product costs". That key also gets one more tool, update_sku_costs, which sets the unit cost of products already in your workspace, as actual or estimated, from an effective date. Nothing else becomes editable: it still cannot change orders, ads, your Shopify store, billing, or your shipping and payment assumptions.

Every call is saved as one new cost revision named after the connection, for example "AI connection: Claude Code", so the earlier cost stays on record and you can set it back in Metryx. Unknown products are refused rather than created, a missing cost is never saved as zero, and repeating the same request saves nothing. To stop an assistant editing, revoke its key.

What data an agent receives

The dashboard's reporting definition describes the data boundary this way:

Agents receive aggregated product and daily data without customer names, emails or addresses.

The report includes business identity, reporting dates, aggregate revenue and costs, daily totals, product rows and source coverage. Raw orders, customer records, provider credentials, free-form cost notes and raw provider payloads do not cross the MCP boundary.

Unknown financial values remain null, never a substituted 0. Actual, estimated, historical and missing cost information must retain its meaning. Contribution is before overhead, not accounting net profit; a remainder before missing costs is not profit.

Getting help

Use the setup-help email link in this documentation's navigation if a client will not connect. Say which client you use and what it shows, and never send the token itself.

Need a hand? Email setup support.

Read as Markdown