Claude / MCP

Connect your analytics to Claude and other AI assistants via the Model Context Protocol.

Moonship implements the Model Context Protocol (MCP), letting you connect your analytics data directly to Claude and other AI assistants. Once connected, you can ask questions like "What pages drove the most traffic last week?" or "Are there any unusual signals on my site right now?" — and get answers grounded in your real data.

Each site has its own connection URL, so Claude only ever sees the data for the site you connect — never your other projects.

Connect to Claude

Step 1 — Copy your MCP URL

In Moonship, go to IntegrationsClaude / MCP and copy the URL for the site you want to connect. It looks like this:

https://moonship.com/mcp?key=YOUR_TRACKING_KEY

The key in the URL is your site's tracking key — the same one used by the analytics snippet. Keep the URL private; anyone with it can read that site's analytics.

Step 2 (Claude.ai) — Add a custom connector

In Claude.ai, go to Settings → Connectors → Add custom connector, paste your MCP URL, and leave the OAuth fields blank. Save, and Moonship's tools become available in your chats.

Step 2 (Claude Code) — Add the server

Run this in your terminal, substituting your own URL:

claude mcp add moonship --transport http https://moonship.com/mcp?key=YOUR_TRACKING_KEY

Step 3 — Verify the connection

In Claude, ask: "List my Moonship sites." If the connection is working, Claude will call the list_sites tool and return your site name and ID. If you see an error, double-check that the URL is correct and includes your full tracking key.

MCP Tools

The following tools are available to any connected AI assistant. Claude calls them automatically when you ask relevant questions — you don't need to invoke them by name. The range parameter accepts "1d", "7d", "30d", or "90d" (default "30d") unless noted.

list_sites

Returns all sites you own or have team access to, with their IDs and names. Most other tools require a site_id — Claude calls this first to look it up. No parameters.

get_analytics

Overview of a site's performance: visitors, pageviews, sessions, bounce rate, and average session duration.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
get_traffic_over_time

A day-by-day time series of visitors, pageviews, and sessions.

Parameters:
  site_id  — UUID from list_sites
  range    — "7d" | "30d" | "90d"  (default: "30d")
get_top_pages

Top pages by pageview count, with visitor counts for each.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
  limit    — number of results, 1–50  (default: 10)
get_entry_exit_pages

Top entry pages (first page of a session) and exit pages (last page of a session).

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
  limit    — number of results, 1–50  (default: 10)
get_top_sources

Top traffic sources — direct, organic, referral domains, and UTM sources — ranked by unique visitors.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
  limit    — number of results, 1–50  (default: 10)
get_geo_breakdown

Top countries and cities by visitor count.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
  limit    — number of results, 1–50  (default: 10)
get_device_breakdown

Visitors broken down by device type, browser, and OS.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
get_new_vs_returning

The split between new and returning visitors, with percentages.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
get_goals

Configured goals for a site and their completion counts over the date range.

Parameters:
  site_id  — UUID from list_sites
  range    — "1d" | "7d" | "30d" | "90d"  (default: "30d")
get_signals

Current AI-detected signals — anomalies, spikes, drops, and trends. Each signal includes its type, title, summary, affected page, delta percentage, and confidence.

Parameters:
  site_id  — UUID from list_sites
get_ai_insights

The latest AI-generated insights for a site: weekly summaries, anomaly reports, and signal analyses.

Parameters:
  site_id  — UUID from list_sites
  type     — "summary" | "anomaly" | "signal_analysis" | "all"  (default: "all")
  limit    — number of results, 1–20  (default: 5)
get_recommendations

AI-generated recommendations and suggested actions, with reasoning, effort, expected impact, and confidence.

Parameters:
  site_id  — UUID from list_sites
  limit    — number of results, 1–20  (default: 10)
get_live_count

The number of unique visitors active on your site in the last 30 minutes.

Parameters:
  site_id  — UUID from list_sites

Example Prompts

Once connected, you can ask Claude natural-language questions about your analytics. Here are some useful starting points:

Traffic & performance

  • "How did my site perform last week compared to the week before?"
  • "What were my top 5 pages by visitors in the last 30 days?"
  • "Which traffic sources are sending the most visitors this month?"
  • "What's my split of new vs returning visitors?"

Behavior & conversion

  • "Which entry and exit pages should I look at?"
  • "How are my goals converting this week?"
  • "What devices and browsers are my visitors using?"

Signals, insights & recommendations

  • "Are there any unusual signals on my site right now?"
  • "Summarize the latest AI insights for my site."
  • "What do you recommend I work on next?"

Live & combined

  • "How many people are on my site right now?"
  • "Give me a summary of my site's health — traffic, bounce rate, and any signals."
  • "I just launched a product update. Has anything changed in traffic or signals since yesterday?"
On this page