Agents and MCP

GA4 in Cursor, so fixes start from real traffic.

When a page leaks visitors, the fix is in your code. Add LopeBase to Cursor and connect GA4, and the agent can see which landing pages bounce, which devices convert worse, and which events stopped firing, then open the file and fix it.

One url in mcp.json, a one time sign in, and read only access to GA4.

What it looks like in Cursor

One question, one tool call, and an answer built on your own GA4 numbers.

Cursor · Agent · lopebase

Do mobile visitors convert worse? If so, find out why in the signup form.

read_sourcega4-acmedevicesgoal: sign_up

devicevisitorssignupsrate
desktop6,8801982.9%
mobile8,410710.8%
tablet41292.2%

Mobile converts at under a third of desktop. In components/SignupForm.tsx the submit button sits below a fixed footer on small screens. I moved it up and made the email field use the email keyboard.

From metric to file

The agent reads the breakdown, finds the component behind the page, and proposes the change in a diff.

Catch broken tracking

If a goal event drops by half, the agent can look for the tag or call that stopped firing in your code.

Every product you build

Each GA4 property is its own connection, reachable from any repo you open.

Add LopeBase to Cursor

Three steps. The first is the same for every app; the rest is specific to Cursor.

  1. 01

    Connect GA4 to LopeBase. Start free, add your site, press Connect with Google, and pick the GA4 property. You need no Google Cloud project and no API key. Google is only asked for read access.

  2. 02

    Add LopeBase to your Cursor MCP settings. Put the server below in ~/.cursor/mcp.json so every project can use it. Keep it out of the project's own .cursor/mcp.json if that file is committed.

  3. 03

    Sign in and open a new chat. Cursor opens a LopeBase page the first time; approve it for your workspace. Cursor only gives a chat the tools that existed when it started, so ask in a new Agent chat.

{
  "mcpServers": {
    "lopebase": { "url": "https://app.lopebase.com/api/mcp" }
  }
}

Prefer the terminal? Run npx lopebase in the project folder. It signs this computer in and starts Cursor Agent with the LopeBase tools ready.

GA4 prompts that work well in Cursor

These prompts end in code changes, which is what Cursor is for.

Fix the leaky landing page

Find the landing page with the highest bounce and over 500 visitors, and fix what is wrong.

The agent reads the page's code and looks for the cause.

landing_pages

Find a broken goal

Did any goal event drop by more than half? Check our code for where it fires.

A drop with steady traffic usually means a tracking bug.

goal_events

Mobile first fixes

Compare conversion by device and fix the biggest mobile problem you can find.

Device gaps often point to layout or input bugs.

devices

Check before you remove a page

How many visitors did /old-pricing get in the last 7 days?

Know what a page still earns before you delete it.

top_paths

What Cursor can read from GA4

Seven datasets per GA4 property. Breakdowns cover the last 28 days and the trend up to 90. Pass any event as a goal to count conversions.

  • web_analyticsPageviews for 7 and 28 days, plus weekly and monthly users.pageviews_7d · pageviews_28d · wau · mau
  • daily_pageviewsPageviews and visitors per day.day · pageviews · visitors
  • top_pathsThe most viewed pages over the last 7 days.url · views · visitors
  • goal_eventsEvents that may count as a conversion, now and before.event · people_28d · people_prev_28d · people_7d
  • traffic_sourcesVisitors and sessions per channel. Add a goal for conversions.source · visitors · sessions · converters
  • landing_pagesVisitors and bounce rate per landing page.path · visitors · converters · bounce_rate
  • devicesVisitors per device. Add a goal for conversions.device · visitors · converters

More on each dataset: Google Analytics MCP. Connecting in the console: the GA4 connector.

Other ways to get GA4 into Cursor

LopeBase is not the only route. Here is how it compares with the usual one.

TopicGoogle's Analytics MCP serverLopeBase
SetupPython and pipx, a Google Cloud project, two APIs turned on, and local credentials in mcp.json's env.One url entry in mcp.json and a sign in.
SecretsA credentials path and project ID in your MCP settings.Nothing secret in mcp.json.
FlexibilityAny GA4 report you describe.Seven shaped datasets, with goals built in.
Other dataGA4 only.Search Console, Bing, PostHog, Stripe, and uptime too.
Best whenYou need custom GA4 reports and run Google Cloud already.You want traffic data next to your code, with no setup.

Google's server is described from its own README, checked October 2026. It is labeled experimental there.

GA4 and Cursor questions

Something else? Contact us.

Where do I add LopeBase in Cursor?

In ~/.cursor/mcp.json, with the entry shown above. It holds only a url, so nothing secret lands in a repo.

Why doesn't the agent see LopeBase yet?

Cursor gives each chat the tools that existed when it started. Start a new Agent chat after signing in.

Can the agent change my GA4 setup?

No. LopeBase only reads GA4. The agent can change your code, which still goes through your normal review.

Does it need my measurement ID?

No. You pick the GA4 property when you connect with Google. The agent asks LopeBase by property name.

Does it work with Cursor Agent in the terminal?

Yes. Run npx lopebase in the project folder and it starts Cursor Agent with LopeBase ready.

Put GA4 next to your code.

Free for one product. No card. Agent access is on every plan.