adtivity-mcp
v1.1.0
Published
Adtivity MCP server — install Adtivity analytics, session replay, error tracking and churn prediction into any codebase via Claude Code or Cursor in under 10 minutes
Downloads
336
Maintainers
Readme
Adtivity MCP Server
Install Adtivity product analytics into any codebase in under 10 minutes — directly from Claude Code or Cursor.
The MCP server detects your framework, installs the SDK, writes initialization code, wraps key buttons, and confirms data is flowing. No manual SDK wrestling required.
What it does
- Detect framework — reads
package.jsonto identify Next.js (App/Pages Router), React, Vue, Express, or React Native, and finds the right entry file - Install SDK — runs
npm/yarn/pnpm/bun install @adtivity/adtivity-sdk - Write init code — creates
AdtivityProvider.tsx(Next.js App Router) or patches your entry file withinit(),initPageTracking(),initClickTracking(), andinitLocationTracking() - Wrap events — returns copy-paste snippets for
trackEvent()on signup, upgrade, checkout, and any custom action - Verify — checks SDK is installed, init code is present, and API key is configured
Install
Claude Code
claude mcp add adtivity -- npx adtivity-mcpThat's it. Claude Code will pick it up on the next session.
To make it available across all your projects, add it to your global config instead:
claude mcp add --scope user adtivity -- npx adtivity-mcpCursor
Add to your Cursor MCP config (~/.cursor/mcp.json or the project-level .cursor/mcp.json):
{
"mcpServers": {
"adtivity": {
"command": "npx",
"args": ["adtivity-mcp"]
}
}
}Any other MCP-compatible client
Use npx adtivity-mcp as the command. The server communicates over stdio and requires Node 18+.
Usage
Once the MCP server is running, tell your AI assistant:
"Install Adtivity into this project"
The assistant will call the tools in order. You can also call them individually:
Step-by-step
1. adtivity_detect_framework — detect framework + entry file
2. adtivity_install_sdk — install @adtivity/adtivity-sdk
3. adtivity_write_init_code — write provider / patch entry file
4. adtivity_add_monitoring — switch on session replay / error tracking / support widget
5. adtivity_add_identify — wire identify() so users are people, not device ids
6. adtivity_wrap_event — get trackEvent() snippet for a button
7. adtivity_verify_integration — confirm everything is wired upPrompts that work well in Claude Code / Cursor
Install Adtivity into this project and wrap the signup and upgrade buttons.Run adtivity_detect_framework on /path/to/my/projectAdd Adtivity event tracking to my checkout buttonTools reference
| Tool | What it does |
|------|-------------|
| adtivity_detect_framework | Reads package.json, returns { framework, packageManager, entryFile, projectName } |
| adtivity_install_sdk | Installs @adtivity/adtivity-sdk with the detected package manager |
| adtivity_write_init_code | Writes init code for the given framework (see details below). Pass features: ["replay","errors","widget"] to include monitoring from the start |
| adtivity_add_monitoring | Adds session replay, error tracking or the support widget to a project that is already set up |
| adtivity_add_identify | Returns the identify() / resetIdentity() code for the sign-in flow. Without this, every error, recording and churn prediction shows a device id instead of a person you can email |
| adtivity_wrap_event | Returns a trackEvent() snippet for a named event |
| adtivity_verify_integration | Returns a checklist: SDK installed / init code present / API key set / identify() wired / replay + error tracking enabled |
adtivity_write_init_code — what it writes per framework
Next.js App Router
- Creates
src/components/AdtivityProvider.tsx(client component withinit,initPageTracking,initClickTracking,initLocationTracking) - Patches
src/app/layout.tsxto wrap<body>children with<AdtivityProvider>
Next.js Pages Router
- Patches
pages/_app.tsx— addsuseEffectwithinit,initPageTracking,initClickTracking
React (Vite/CRA)
- Prepends init calls to
src/main.tsx/src/index.tsx
Vue
- Prepends init calls to
src/main.ts/src/main.js
Express
- Prepends
init()to your server entry file
API key
After the MCP writes the init code, add your Adtivity API key to your env file:
# Next.js
NEXT_PUBLIC_ADTIVITY_API_KEY=your_key_here
# React / Vue (Vite)
VITE_ADTIVITY_API_KEY=your_key_here
# Express / Node
ADTIVITY_API_KEY=your_key_hereGet your key at adtivity.xyz/dashboard.
Development
git clone https://github.com/adtivity/mcp
cd mcp-server
npm install
npm run dev # run with tsx (no build step)
npm run build # compile to dist/To test the server locally with Claude Code before publishing:
claude mcp add adtivity -- npx adtivity-mcpSupported frameworks
| Framework | Detected via | Init target |
|-----------|-------------|-------------|
| Next.js App Router | next dep + src/app/ dir | AdtivityProvider.tsx + layout.tsx |
| Next.js Pages Router | next dep + pages/ dir | pages/_app.tsx |
| React (Vite/CRA) | react dep | src/main.tsx |
| Vue | vue dep | src/main.ts |
| Express | express dep | app.ts / index.ts |
| React Native / Expo | react-native or expo dep | App.tsx |
