To connect ChatGPT or Cursor to your website analytics, you add your analytics tool's MCP server address to the AI tool and sign in. After that you can ask "which campaign sent the visitors who left at checkout?" and get the answer from your own data, in the chat or next to your code.
This guide covers the setup for ChatGPT, Cursor and Claude Code with GrainQL, then the prompts that give answers you can check. For Claude on the web and desktop, read our Claude guide.
What you need#
- A GrainQL workspace with the tag installed and some real visits.
- The MCP address:
https://www.grainql.com/api/mcp. Keep thewww. Without it, the redirect drops the sign-in. - For ChatGPT, a Pro, Team, Enterprise or Edu plan. Developer Mode is not on the Free and Plus plans.
There is no API key. Each AI tool registers itself the first time it connects, and you approve it in a browser window.
Connect ChatGPT#
- In ChatGPT, open Settings, then Apps & Connectors, then Advanced settings, and turn on Developer Mode.
- Go back to Apps & Connectors and choose Add new connector. Some plans call it Create.
- Name it
GrainQL, pastehttps://www.grainql.com/api/mcpas the MCP server URL, and choose OAuth. - Tick I trust this application and click Create. A GrainQL window opens.
- Pick all your workspaces or only some, check the three permissions, and click Allow access.
- In a new chat, open the tools menu, switch on GrainQL, and ask your question.
OpenAI still labels Developer Mode as beta and renames menus now and then. If a name differs, the ChatGPT setup page has the current path and a troubleshooting table.
Connect Cursor#
Cursor reads MCP servers from a JSON file. Use ~/.cursor/mcp.json for every project, or .cursor/mcp.json in a repository so your team gets it too.
{
"mcpServers": {
"grain": {
"url": "https://www.grainql.com/api/mcp"
}
}
}
Open Cursor Settings, then MCP (or Tools & MCP). The grain server shows an Authorize button. Click it, approve the workspaces in the browser, and come back. The server turns green with 12 tools.
In chat, start with @grain when the question is about analytics. Cursor knows which file you have open, so "what is the top traffic source for the page I am editing?" filters on the right page without more detail.
Connect Claude Code#
One command in your terminal:
claude mcp add --transport http grain https://www.grainql.com/api/mcp
Claude Code opens the sign-in the first time it calls a tool. After that it can check a number while it works on the change that should move it.
No GrainQL workspace yet?
Install one tag, connect ChatGPT or Cursor the same day, and ask about real visitors. 14 days free, no card.
Prompts that give reliable answers#
An AI tool with analytics is only as good as the question. These patterns work.
Start every new chat by asking what exists.
What events does my site track, and which ones look like conversion steps?
The AI tool learns your real event names. Without this, it can guess a signup event that does not exist.
Give a period and a comparison.
Compare purchases in the last 7 days with the 7 days before, by traffic source.
GrainQL's compare tool returns the changes that stand out with the numbers, so the AI tool reports what moved instead of describing every row.
Ask where, then ask why.
Which checkout step lost the most visitors this week compared with last week?
Then:
What is different about the sessions that left at that step?
The second question uses segment comparison and session clustering. The answer is usually a device, a browser, a campaign or a page.
Ask for a summary someone else will read.
Pull last week's digest and write four bullets for Slack. Bold anything surprising.
Tie it to your code (Cursor and Claude Code).
We shipped the new address form on Tuesday. Did the shipping step completion rate change after that, on mobile and desktop?
Mistakes to avoid#
- Not naming the event. If you have
signup_startedandsignup_completed, "signups" can mean either. Name it when it matters. - Trusting a percentage on small numbers. A drop from 4 to 2 is 50%. Ask for the counts.
- Not asking how it got the answer. End with "list the events and dates you used." You can only check what you can see.
- Using the wrong workspace. If the connection covers several sites, name the site in the question.
What the AI tool can and cannot do#
The GrainQL MCP has 12 tools in three groups: read (events, properties, tracking health), query (counts, breakdowns, comparisons, digests) and investigate (segments, session clusters, funnels, correlations). Read the GrainQL MCP page for the full picture.
It cannot change anything. There is no tool that edits an event, a goal or a setting, so you can give it every permission without risk to your data. Each connection is listed in Settings, MCP clients with its last use, and you can revoke it at any time.
For a number that needs eyes on it, open the sessions in GrainQL. The MCP finds the place, and the replays and heatmaps show what happened there.
If you are deciding between analytics tools partly on their AI access, read analytics MCP servers compared.