Using Sonar

Connecting AI assistants (MCP)

Ask Claude, Cursor and other AI assistants about your Sonar data with the Sonar MCP server and an API key.

Sonar has an MCP server, so AI assistants that support the Model Context Protocol can read your analytics. Ask your assistant "How did the site do this week compared with last?" or "Which landing pages brought enquiries this month?" and it looks up the answer in Sonar.

API keys are part of the Pro and Agency plans.

Creating an API key

  1. Open the avatar menu, then Settings → API keys.
  2. Enter a name for the key, such as Claude Desktop, and click Create key.
  3. Copy the key straight away. It starts with sonar_, and Sonar only shows it once.

A key can read every site you can see in Sonar, and nothing else. It can't change anything. Keep it private, like a password. If a key is shared by mistake, click Revoke: it stops working straight away. Last used shows when each key was last used.

Connecting your assistant

The server address is:

https://sonar-app.co.uk/api/mcp

Send your key as a header: Authorization: Bearer sonar_…. In the examples below, replace sonar_YOUR_KEY with your key.

Claude Code

claude mcp add --transport http sonar https://sonar-app.co.uk/api/mcp --header "Authorization: Bearer sonar_YOUR_KEY"

Cursor: add this to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "sonar": {
      "url": "https://sonar-app.co.uk/api/mcp",
      "headers": { "Authorization": "Bearer sonar_YOUR_KEY" }
    }
  }
}

VS Code: add this to .vscode/mcp.json:

{
  "servers": {
    "sonar": {
      "type": "http",
      "url": "https://sonar-app.co.uk/api/mcp",
      "headers": { "Authorization": "Bearer sonar_YOUR_KEY" }
    }
  }
}

Claude (claude.ai, Cowork and Claude Desktop): add Sonar once as a custom connector and it works in all three.

  1. Go to Customize → Connectors, click + Add and choose a custom connector.
  2. Name it Sonar and enter the server address above.
  3. Choose No sign in.
  4. Under Request headers, add Authorization with the value Bearer sonar_YOUR_KEY, then click Add.

On Team and Enterprise plans, an Owner adds connectors in Organization settings → Connectors. Everyone who uses it then shares that key, so use a key from an account that can see only the sites they should.

What your assistant can do

Tool What it returns
list_sites Your sites and their IDs
get_overview Visitors, page views, conversions and average visit length for a period, compared with the period before, plus top pages, sources and campaigns
top_pages The pages with the most visitors
traffic_sources Where visitors came from
campaigns UTM campaigns, sources or mediums, with page views and visitors
list_sessions Recent visits, filtered by outcome, source, device or landing page
get_session One visit in full: pages, conversions, interactions and any chat
interactions Form enquiries, orders and video responses, and which sources and landing pages brought them
ask_sonar Any other question in plain English, answered the way Ask Sonar does

Periods are the last 24 hours, 7, 30 or 90 days, or all time. Bots are left out, as they are in the app.

Visitors' IP addresses are removed from what's sent to your assistant, and visit IDs are encrypted so they can't be decoded. Other details, such as chat transcripts and the names you've given visitors, are, so check your AI provider's terms on how it handles data before connecting.