Amplitude Analytics MCP server

Track analytics events in Amplitude, supporting custom events, page views, user properties, and revenue tracking.
Back to servers
Setup instructions
Provider
Ciara Adkins
Release date
Apr 18, 2025
Language
TypeScript
Stats
6 stars

The Amplitude MCP server integrates Amplitude analytics into AI workflows, allowing AI assistants like Claude to track events, page views, user signups, and other analytics data in Amplitude. With this server, you can easily monitor user interactions and gather insights about how AI systems are being used.

Installation

Prerequisites

  • Node.js 16 or higher
  • An Amplitude API key (get one by signing up at Amplitude)

NPM Installation (Recommended)

# Install globally
npm install -g amplitude-mcp-server

# Or use directly with npx
npx amplitude-mcp-server --api-key YOUR_AMPLITUDE_API_KEY

Manual Installation

# Clone the repository
git clone https://github.com/ciaraadkins/amplitude-mcp-server.git
cd amplitude-mcp-server

# Install dependencies
npm install

# Run the server
node index.js --api-key YOUR_AMPLITUDE_API_KEY

Quick Start

To start using the Amplitude MCP server with Claude Desktop:

  1. Make sure Claude Desktop is installed on your machine (download from claude.ai/download)

  2. Create or edit the Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %AppData%\Claude\claude_desktop_config.json
  3. Add the Amplitude MCP server configuration:

{
  "mcpServers": {
    "amplitude-analytics": {
      "command": "npx",
      "args": [
        "-y",
        "amplitude-mcp-server",
        "--api-key",
        "YOUR_AMPLITUDE_API_KEY"
      ]
    }
  }
}
  1. Restart Claude Desktop and start tracking analytics!

Detailed Usage

With Claude Desktop

After setting up the configuration, you can use the Amplitude analytics capabilities directly in your conversations with Claude.

Examples of prompts you can use:

  • "Track a custom event in Amplitude named 'document_generated' for user 'user123'"
  • "Track a page view for the pricing page in Amplitude"
  • "Create a new user profile in Amplitude for John Doe with email [email protected]"
  • "Update user profile information in Amplitude for user 'user123'"
  • "Track a purchase of Product X for $49.99"

Claude will use the appropriate Amplitude MCP tool based on your request.

With Other MCP Clients

This server uses the standard Model Context Protocol and can be integrated with any MCP client:

  1. Start the server:

    npx amplitude-mcp-server --api-key YOUR_AMPLITUDE_API_KEY
    
  2. Connect your MCP client to the server using stdio transport

  3. The client can discover and use the available tools (track_event, track_pageview, track_signup, set_user_properties, track_revenue)

Tool Reference

amplitude_track_event

Tracks a custom event in Amplitude.

Parameters:

  • event_name (string, required): The name of the event to track
  • user_id (string, optional): User identifier
  • device_id (string, optional): Device identifier
  • properties (object, optional): Additional properties to track with the event
  • user_properties (object, optional): User properties to update with this event

Note: Either user_id or device_id must be provided.

Example:

{
  "event_name": "button_clicked",
  "user_id": "user123",
  "properties": {
    "button_id": "submit_form",
    "page": "checkout"
  },
  "user_properties": {
    "last_action": "form_submit"
  }
}

amplitude_track_pageview

Tracks a page view event in Amplitude.

Parameters:

  • page_name (string, required): The name of the page viewed
  • user_id (string, optional): User identifier
  • device_id (string, optional): Device identifier
  • properties (object, optional): Additional properties to track with the event

Note: Either user_id or device_id must be provided.

Example:

{
  "page_name": "homepage",
  "user_id": "user123",
  "properties": {
    "referrer": "google.com",
    "duration": 120
  }
}

amplitude_track_signup

Tracks a signup event and creates a user profile in Amplitude.

Parameters:

  • user_name (string, required): User's full name
  • email (string, required): User's email address
  • plan (string, optional): Signup plan. Defaults to 'free'

Example:

{
  "user_name": "John Doe",
  "email": "[email protected]",
  "plan": "premium"
}

amplitude_set_user_properties

Updates a user's profile properties in Amplitude.

Parameters:

  • user_id (string, required): User identifier
  • properties (object, required): Profile properties to set

Example:

{
  "user_id": "user123",
  "properties": {
    "name": "John Doe",
    "email": "[email protected]",
    "plan": "premium",
    "company": "Acme Inc"
  }
}

amplitude_track_revenue

Tracks a revenue event in Amplitude.

Parameters:

  • user_id (string, required): User identifier
  • product_id (string, required): Identifier for the product purchased
  • price (number, required): Price of the item purchased
  • quantity (number, optional): Quantity of items purchased. Defaults to 1
  • revenue_type (string, optional): Type of revenue (e.g., 'purchase', 'refund', 'subscription')

Example:

{
  "user_id": "user123",
  "product_id": "premium_plan",
  "price": 49.99,
  "quantity": 1,
  "revenue_type": "subscription"
}

Examples

Here are some practical examples of using the Amplitude MCP server with Claude:

Tracking a Button Click

You: Can you track an event in Amplitude when a user clicks the submit button?

Claude: I'll track that event for you. Let me use the Amplitude analytics tool.

[Claude uses the amplitude_track_event tool with appropriate parameters]

Claude: I've successfully tracked the 'button_clicked' event in Amplitude with the properties you specified.

Creating a User Profile

You: Create a new user profile in Amplitude for Sarah Johnson who signed up with [email protected] on the premium plan.

Claude: I'll create that user profile in Amplitude.

[Claude uses the amplitude_track_signup tool with appropriate parameters]

Claude: I've successfully tracked the signup for Sarah Johnson and created a profile in Amplitude with the premium plan.

Tracking Revenue

You: Track a purchase of our premium plan for $99.99 by user12345.

Claude: I'll track that revenue event in Amplitude.

[Claude uses the amplitude_track_revenue tool with appropriate parameters]

Claude: I've successfully tracked revenue of $99.99 for the premium plan purchase by user12345.

Troubleshooting

Common Issues

  1. Server not starting:

    • Ensure you've provided a valid Amplitude API key
    • Check that Node.js is installed and is version 16 or higher
  2. Claude Desktop not showing Amplitude tools:

    • Verify your claude_desktop_config.json file syntax
    • Make sure you've restarted Claude Desktop after editing the config
    • Check that the path to the server is correct
  3. Events not appearing in Amplitude:

    • Verify your Amplitude API key is correct
    • Check your Amplitude project settings to ensure data is being received
    • Events may take a few minutes to appear in the Amplitude interface

Debug Mode

To run the server in debug mode for more verbose logging:

npx amplitude-mcp-server --api-key YOUR_AMPLITUDE_API_KEY --debug

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "amplitude-analytics" '{"command":"npx","args":["-y","amplitude-mcp-server","--api-key","YOUR_AMPLITUDE_API_KEY"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "amplitude-analytics": {
            "command": "npx",
            "args": [
                "-y",
                "amplitude-mcp-server",
                "--api-key",
                "YOUR_AMPLITUDE_API_KEY"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "amplitude-analytics": {
            "command": "npx",
            "args": [
                "-y",
                "amplitude-mcp-server",
                "--api-key",
                "YOUR_AMPLITUDE_API_KEY"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later