Skip to Content
TrichiDataTrichiData

Install with your AI assistant

Let Cursor, Claude Code, Lovable or Bolt add TrichiData to your app in a few minutes.

Your coding agent can install and verify TrichiData for you. There are two paths:

  • With MCP (recommended, new) — the agent reads your project's install instructions and checks that events arrive.
  • Without MCP — paste one prompt into any AI tool.

Both paths use SDK 0.6.0 (new), which adds anonymous ids, sessions, an event queue with retry, automatic pageviews and UTM/click-id capture. See the Quickstart for the SDK basics.

Path A — MCP (new)

1. Create a token

  1. Open your project in app.trichidata.com
  2. Go to Project → Settings → AI assistant (MCP)
  3. Create a token and copy it (td_mcp_...). The token is shown only once.

Tokens belong to a single project and can be revoked at any time.

  • Access: Read only by default. Read & write is opt-in, and only project owners and admins can create it.
  • Expiry: 90 days by default. You can choose 30, 90, 180 or 365 days.

2. Connect your assistant

After you create a token, the AI assistant (MCP) panel shows a ready-to-paste config for Cursor, Claude Code, Claude Desktop and other clients, with your server URL already filled in. Copy it from there.

The examples below show the same configs. Replace <YOUR_MCP_URL> with the server URL from the panel (it ends with /mcp, transport: Streamable HTTP) and td_mcp_... with your token.

Cursor — add to .cursor/mcp.json:

{
  "mcpServers": {
    "trichidata": {
      "url": "<YOUR_MCP_URL>",
      "headers": { "Authorization": "Bearer td_mcp_..." }
    }
  }
}

Claude Code:

claude mcp add --transport http trichidata \
  <YOUR_MCP_URL> \
  --header "Authorization: Bearer td_mcp_..."

Claude Desktop — Claude Desktop starts local (stdio) servers from its config file, so it connects through the mcp-remote bridge (requires Node.js). Add to claude_desktop_config.json:

{
  "mcpServers": {
    "trichidata": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "<YOUR_MCP_URL>", "--header", "Authorization:${TRICHIDATA_MCP_AUTH}"],
      "env": { "TRICHIDATA_MCP_AUTH": "Bearer td_mcp_..." }
    }
  }
}

Other MCP clients — any client with remote (Streamable HTTP) server support needs the URL and one header:

URL     <YOUR_MCP_URL>
Header  Authorization: Bearer td_mcp_...

Do not commit the token. Keep it in your local MCP config only.

3. Ask the agent

Add TrichiData analytics to this app.

The agent uses these tools:

ToolWhat it does
get_install_instructionsInstall steps, provider code and rules for your framework (react, nextjs, vite, react-native, expo, node, html, other), already filled in with your project's API key
get_tracking_planRecommended events for your app, and what already arrives in the project
verify_eventsEvents received in the last N minutes (default 15 minutes, up to 24 hours), plus what is still missing

The MCP server also exposes analytics and project tools, so you can later ask "where do users drop off between sign-up and payment?".

AccessTools
Read onlyget_overview, run_funnel, run_retention, run_analytics_query, get_analytics_fields, get_current_project_events, get_current_project_info, get_current_project_event_tags, get_current_datetime, get_query_views, get_project_destinations, get_available_destination_types, get_destination_mappings, get_destination_filters
Read & write (additionally)save_query_view, update_query_view, manage_project_event_tags, update_destination_status

A Read & write token can save views, manage event tags and turn destinations on or off. No MCP tool can delete anything.

When the agent is done, click through your app and ask it to run verify_events.

Path B — No MCP

Paste this prompt into your AI tool. The agent needs your project API key (prj_ak_...). Copy it from the API key field on your project's Settings page and put it in an environment variable.

Add TrichiData analytics to this app. Use SDK version 0.6.0 or newer.

1. Detect the framework and install the matching package:
   React/Next.js/Vite -> @trichidata/react, plain browser/Vue/Svelte -> @trichidata/browser,
   React Native/Expo -> @trichidata/react-native plus the required peer
   @react-native-async-storage/async-storage (Expo: npx expo install @trichidata/react-native
   @react-native-async-storage/async-storage; bare: npm install @trichidata/react-native
   @react-native-async-storage/async-storage && npx pod-install), Node server -> @trichidata/node.
2. Initialize once at the app root with the project API key from an env variable
   (prj_ak_...). React: wrap the app in <TrichiDataProvider apiKey=...>. Browser: new
   TrichiDataClient({ apiKey }) then await client.init().
3. Keep autoPageviews on (default). If the app already calls client.page() on every route
   change, set autoPageviews={false} instead of sending page views twice.
   React Native: call client.trackScreen(name) or use getTrichiDataNavigationHandlers.
4. After login or sign-up call client.identify({ userId }) with the auth user id
   (for example Supabase auth.users.id). Call client.reset() on logout.
5. Track standard events where they happen:
   sign-up -> client.signedUp, login -> client.loggedIn, checkout start -> client.checkoutStarted,
   completed purchase -> client.orderCompleted. Use client.trackCustom(name, props) for
   anything else, with snake_case names.
6. If the app uses Stripe, put the same user id in metadata.user_id (and
   client_reference_id for Checkout Sessions).
7. Never send PII: no email, name, phone, address or free text typed by users in event
   properties or in userId.
8. Never hardcode the API key; read it from an environment variable.
9. Tell me which events you added and where.

Then add the agent rules so the agent keeps tracking correct as the app grows.

Check that it works

Open Live events in your project and click through the app. A page event should appear within a few seconds. With MCP, ask the agent to call verify_events.

See also

On this page