Skip to main content
Cursor supports remote MCP servers. After you add GrainQL, the Cursor agent and Composer can list events, run queries, and analyze funnels inside the editor. This puts the data next to the code when you fix a conversion drop. Cursor reads MCP servers from a JSON file. There are two locations:

1. Create the configuration file

2. Add the GrainQL server

Paste this into mcp.json:
This is the whole configuration. GrainQL does client registration and PKCE itself. You do not add a client_id, a secret, or an Authorization header.

3. Reload and authorize

Open Cursor Settings → MCP (or Settings → Tools & MCP, depending on the version). The list shows grain with an Authorize button. Click it. Cursor opens the GrainQL consent screen in your browser. Choose All workspaces in my account, or Select workspaces and tick the ones that Cursor will see. Read the scopes, and click Allow access. A workspace on the consent screen is a tenant. Back in Cursor, the grain server shows a green “Connected” state and a tool count. The count is 12 tools when you grant all scopes.

4. Ask the agent a question

Open the Cursor chat or Composer and ask, for example, “@grain What is my top traffic source for the landing page I am editing?”. Cursor calls grain_query. Because Cursor knows the file you are in, it can filter by the correct page property. The @grain prefix tells Cursor that you want the GrainQL tools. Cursor picks the tool on its own in most cases. The prefix reduces round trips on an ambiguous question. The Cursor documentation on MCP is at cursor.com/docs/context/mcp.

Project rule

A short project rule routes analytics questions to GrainQL without the tool names in every prompt. The rule is optional. Create .cursor/rules.md:

What the assistant can do

Read Tools for every tool.

Troubleshooting