Connect Gainsight PX to Claude: Analyze Adoption and Segment Trends
Learn how to connect Gainsight PX to Claude using a managed MCP server. Automate feature adoption analysis, engagement states, and user segment workflows.
If your team needs to connect Gainsight PX to Claude to analyze feature adoption, track user segments, or automate engagement states, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's tool calls and Gainsight PX's REST APIs. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses ChatGPT, check out our guide on connecting Gainsight PX to ChatGPT or explore our broader architectural overview on connecting Gainsight PX to AI Agents.
Giving a Large Language Model (LLM) read and write access to a sprawling product analytics ecosystem like Gainsight PX is a serious engineering challenge. You have to handle API token lifecycles, map massive JSON schemas to MCP tool definitions, and deal with Gainsight's specific data structures and strict API quotas. Every time Gainsight updates an endpoint or changes a query parameter, you have to update your server code, redeploy, and test the integration.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Gainsight PX, connect it natively to Claude Desktop, and execute complex product analytics workflows using natural language.
The Engineering Reality of the Gainsight PX API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against Gainsight PX's APIs is painful. You are not just integrating a simple database - you are integrating an advanced product experience platform with unique identity rules, complex state machines, and specialized pagination schemas.
If you decide to build a custom MCP server for Gainsight PX, you own the entire API lifecycle. Here are the specific challenges you will face:
Special Characters in Identity IDs Breaking REST Paths
In a standard REST architecture, you update a resource by passing its ID in the URL path (e.g., PUT /users/{id}). In Gainsight PX, the identifyId for a user or the accountId for an account is often an email address, a specialized UUID, or a string containing special characters like slashes, plus signs, or ampersands. Passing these directly into URL paths frequently results in HTTP 404 errors due to URL encoding conflicts at the routing layer. To solve this, Gainsight PX provides specialized _by_body endpoints (e.g., updating a user where the identifyId is passed in the JSON payload instead of the path). A custom MCP server must hardcode logic to route LLM requests to these specific endpoints based on the payload content. Truto's managed MCP server automatically exposes these _by_body methods as distinct, well-documented tools so Claude knows exactly how to handle complex IDs.
Engagement State Machine Quirks Changing the state of an engagement (e.g., starting or pausing an in-app guide) is not a simple CRUD operation. The Gainsight PX API enforces strict state machine rules. For example, if an agent tries to pause a never-launched draft engagement, the API will not return a clean 400 validation error - it will return an HTTP 500 internal server error. Furthermore, starting an engagement requires the underlying API key to possess specific "Production Launch" permissions. If you build your own MCP server, your LLM will likely get confused by HTTP 500 errors when it accidentally targets drafts. Truto mitigates this by enriching the tool definitions with explicit documentation, guiding the LLM on valid state transitions before it ever makes the API call.
Handling Rate Limits and IETF Normalization
Gainsight PX strictly enforces rate limits on its analytics and export endpoints. When building an MCP server, a common mistake is attempting to have the server automatically retry requests or absorb rate limits on behalf of the LLM. This causes timeouts at the MCP protocol layer and leads to model hallucinations. Truto takes a deterministic approach: it does not retry, throttle, or apply backoff on rate limit errors. When Gainsight PX returns an HTTP 429, Truto passes that error directly back to Claude. However, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller (the agent orchestrator or Claude) is responsible for interpreting these headers and executing its own retry or backoff logic.
Generating the MCP Server for Gainsight PX
Truto dynamically generates MCP servers based on the connected integration. Tools are not hand-coded; they are derived directly from the API schemas and documentation. This guarantees that the tools exposed to Claude always match the current state of the Gainsight PX API.
You can generate an MCP server for Gainsight PX using either the Truto UI or the Truto API.
Method 1: Via the Truto UI
For teams who prefer a visual setup, you can generate a server URL in seconds without writing code.
- Log in to your Truto dashboard.
- Navigate to the Integrated Accounts page and select your connected Gainsight PX account.
- Click on the MCP Servers tab.
- Click Create MCP Server.
- Configure your server settings. You can name the server (e.g., "Gainsight PX Analytics Bot"), apply method filters (e.g., restrict to
readoperations only), or set an expiration date for temporary access. - Click Save and copy the generated MCP server URL (it will look like
https://api.truto.one/mcp/abc123xyz...).
Method 2: Via the Truto API
For platform engineering teams automating infrastructure, you can provision MCP servers programmatically via the Truto REST API. This generates a cryptographic token backed by Truto's distributed architecture.
Endpoint: POST /integrated-account/:id/mcp
curl -X POST https://api.truto.one/integrated-account/<gainsight_px_account_id>/mcp \
-H "Authorization: Bearer YOUR_TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Gainsight PX Support Agent",
"config": {
"methods": ["read", "write"],
"tags": ["engagements", "users"]
},
"expires_at": "2026-12-31T23:59:59Z"
}'The response returns the fully qualified, authenticated MCP server URL:
{
"id": "mcp_srv_9x8y7z6",
"name": "Gainsight PX Support Agent",
"config": {
"methods": ["read", "write"],
"tags": ["engagements", "users"]
},
"expires_at": "2026-12-31T23:59:59Z",
"url": "https://api.truto.one/mcp/a1b2c3d4e5f6g7h8i9j0..."
}Connecting the MCP Server to Claude
Once you have your Truto MCP server URL, you must connect it to your AI framework. Because the URL contains a cryptographic token linking it to the specific Gainsight PX tenant, it is fully self-contained.
Method A: Via the Claude UI
If you are using the Claude Desktop application or a web-based Claude interface that supports custom connectors:
- Open Claude and navigate to Settings -> Integrations (or Connectors, depending on your tier).
- Click Add MCP Server or Add custom connector.
- Paste the Truto MCP Server URL (
https://api.truto.one/mcp/...). - Click Add.
Claude will immediately execute an MCP initialize handshake, discover the dynamically generated tools, and make them available in your chat sessions.
Method B: Via Manual Configuration File
For developers orchestrating Claude Desktop manually or building local agent environments, you can configure the MCP server via the claude_desktop_config.json file.
Because Truto exposes the server over HTTP, you will use the official @modelcontextprotocol/server-sse package to proxy the local Standard Input/Output (stdio) requests into Server-Sent Events (SSE) over HTTP.
Open your configuration file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) and add the following:
{
"mcpServers": {
"gainsight_px": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/a1b2c3d4e5f6g7h8i9j0..."
]
}
}
}Restart Claude Desktop. The integration will now be active.
Hero Tools for Claude
Truto exposes the entirety of the Gainsight PX API, but providing your LLM with specific, high-leverage prompts yields the best results. Here are the hero tools most commonly used by product and success teams.
1. list_all_gainsight_px_feature_adoption
Retrieves feature adoption numbers for a specific feature and date range. The Gainsight PX API restricts this query to a maximum date range of 7 days. If no end date is specified, it defaults to the current time.
"Claude, check the feature adoption statistics for the 'New Dashboard' feature over the last 5 days. Summarize the daily active usage trends."
2. gainsight_px_engagements_update_state
Pauses or starts an existing engagement. This is critical for managing in-app guides dynamically. Remember that only launched engagements can be updated; targeting a draft returns an error.
"Claude, find the engagement named 'Q3 Upsell Banner' and update its state to paused. Verify that the operation was successful."
3. list_all_gainsight_px_engagements
Retrieves a paginated list of all engagements in the tenant. This tool is frequently used as a discovery step before executing updates or checking engagement analytics.
"Claude, list all active engagements in Gainsight PX. Filter the results to only show engagements created in the last 30 days."
4. list_all_gainsight_px_segments
Retrieves segments defined in Gainsight PX. Pagination for this endpoint is zero-based (pageNumber), meaning the first page is 0, which Truto handles dynamically in the tool schema.
"Claude, fetch the first two pages of segments from Gainsight PX and list the names and IDs of any segments related to 'Enterprise Customers'."
5. gainsight_px_users_update_by_body
Updates a user record by passing the identifyId via the request body. This tool is mandatory when dealing with users whose IDs contain special characters (like email addresses) that would otherwise break standard REST path routing.
"Claude, update the user profile for 'admin@complex-domain.com'. Use the update-by-body tool to set their custom attribute 'Onboarding_Complete' to true."
6. list_all_gainsight_px_survey_responses
Retrieves survey responses from in-app surveys (like NPS or CES). This is paged automatically using limits and cursor strings.
"Claude, pull the latest survey responses for our recent NPS engagement. Calculate the average score and list the top 3 negative text feedback comments."
For a complete list of available tools, query parameters, and schema definitions, visit the Gainsight PX integration page.
Workflows in Action
When you connect Gainsight PX to Claude via MCP, the LLM gains the ability to chain multiple tools together to execute complex, multi-step business logic. Here are two real-world examples of workflows in action.
Scenario 1: Pausing an Underperforming Engagement
Persona: Product Manager
Product managers frequently need to monitor the performance of in-app guides and halt campaigns that are failing or annoying users. Doing this manually requires logging into Gainsight PX, finding the engagement, checking the stats, and navigating the UI to pause it.
"Claude, find the engagement named 'Q4 Feature Announcement'. Check if it is currently active. If it is active, update its state to paused."
Step-by-Step Execution:
- Claude calls
list_all_gainsight_px_engagementsand filters the response to locate the ID for "Q4 Feature Announcement". - Claude analyzes the returned JSON payload and confirms the
statusfield is currently active. - Claude calls
gainsight_px_engagements_update_state, passing the retrieved engagement ID and the state payload{"state": "PAUSED"}. - Claude returns a natural language summary to the user confirming the engagement has been successfully paused.
sequenceDiagram
participant User as Product Manager
participant Claude as Claude Desktop
participant MCP as Truto MCP Server
participant PX as Gainsight PX API
User->>Claude: "Find 'Q4 Feature Announcement' and pause it."
Claude->>MCP: Call list_all_gainsight_px_engagements
MCP->>PX: GET /v1/engagements
PX-->>MCP: Returns engagement list
MCP-->>Claude: JSON payload with engagement ID
Claude->>MCP: Call gainsight_px_engagements_update_state (ID, PAUSED)
MCP->>PX: POST /v1/engagements/{id}/state
PX-->>MCP: HTTP 200 OK
MCP-->>Claude: Success confirmation
Claude-->>User: "The engagement has been successfully paused."Scenario 2: Analyzing Feature Adoption and Updating User Attributes
Persona: Customer Success Manager
Customer Success teams need to track which users are adopting new features and flag users who require manual outreach or training.
"Claude, check the feature adoption statistics for the 'Advanced Reporting' feature over the last 7 days. Identify the user IDs with zero usage, and update those user profiles using the body update tool to set 'Needs_Training' to true."
Step-by-Step Execution:
- Claude calls
list_all_gainsight_px_feature_adoption, passing the feature ID for "Advanced Reporting" and a date range spanning the last 7 days. - Claude analyzes the time-series data to isolate the
identifyIds of users who have zero logged events for the feature. - Claude iterates through the inactive users and calls
gainsight_px_users_update_by_bodyfor each one, passing theidentifyIdand{"Needs_Training": true}in the JSON payload (bypassing any URL encoding issues with special characters in the IDs). - Claude generates a report for the CSM detailing exactly which users were flagged for training.
flowchart TD
A["Claude receives<br>user prompt"] --> B["Call list_all_gainsight_px_feature_adoption<br>for last 7 days"]
B --> C["Analyze payload<br>isolate zero-usage IDs"]
C --> D{"Are there inactive users?"}
D -->|Yes| E["Call gainsight_px_users_update_by_body<br>for each inactive user"]
E --> F["Return training list<br>to the CSM"]
D -->|No| G["Inform CSM all users<br>are active"]Security and Access Control
When connecting a powerful AI agent to a production product analytics database, security is non-negotiable. Truto provides fine-grained access control at the MCP server configuration layer:
- Method Filtering: By defining
config.methods: ["read"]during server creation, you can physically prevent the MCP server from generatingcreate,update, ordeletetools. This guarantees the LLM can only query data, not mutate it. - Tag Filtering: You can restrict the MCP server to specific resource domains by defining
config.tags: ["analytics"]. The agent will only see tools associated with that specific tag, reducing context window bloat and limiting blast radius. - Require API Token Auth: By setting
require_api_token_auth: true, possession of the MCP URL is no longer sufficient to execute tools. The connecting client (Claude) must also pass a valid Truto API token in theAuthorizationheader, adding a strict secondary authentication layer. - Expires At: For temporary agent tasks or contractor access, you can set an
expires_attimestamp. Truto enforces this TTL strictly via scheduled cleanup alarms, automatically destroying the server credentials when the time expires.
Next Steps for Gainsight PX AI Automation
Building an integration between Gainsight PX and Claude using a managed MCP server removes the burden of handling token refreshes, maintaining JSON schemas, and normalizing IETF rate limits. Instead of spending sprints writing boilerplate integration code, your engineering team can focus on orchestrating high-value product analytics and user segment workflows.
If you want to move beyond manual chat interfaces and integrate Gainsight PX directly into your autonomous AI products, read our guide on connecting Gainsight PX to AI Agents.
FAQ
- Does Truto automatically retry when Gainsight PX hits rate limits?
- No. Truto passes HTTP 429 rate limit errors directly back to the caller. It normalizes the rate limit information into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset), but the caller or AI orchestrator must handle retry and backoff logic.
- How do I handle Gainsight PX user IDs that contain special characters?
- Gainsight PX identifyIds often contain special characters like emails or plus signs that break REST URL paths. Truto's MCP server exposes specialized `_by_body` tools (like gainsight_px_users_update_by_body) that pass the ID securely in the JSON payload.
- Can I prevent Claude from deleting data in Gainsight PX?
- Yes. When generating the MCP server via the Truto UI or API, you can set method filters (e.g., config.methods: ["read"]). This ensures the MCP server only generates safe read-only tools, preventing the LLM from mutating data.
- Do I need to write code to connect Claude to Gainsight PX?
- No. Truto dynamically generates the MCP server tools directly from the Gainsight PX API documentation and schemas. You only need to copy the generated MCP URL and paste it into Claude's custom connector settings.