How to integrate Gleap MCP with Claude Agent SDK

This guide walks you through connecting Gleap to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Gleap agent that can archive resolved support tickets from last week, send a chat message to follow up on feedback, list all articles in the onboarding collection through natural language commands. This guide will help you understand how to give your Claude Agent SDK agent real control over a Gleap account through Composio's Gleap MCP server. Before we dive in, let's take a quick look at the key ideas and tools involved.

Gleap logoGleap
Api Key

Gleap is an all-in-one customer feedback tool for apps and websites. It helps you understand user pain points and improve software through direct, actionable insights.

179 Tools

Introduction

This guide walks you through connecting Gleap to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Gleap agent that can archive resolved support tickets from last week, send a chat message to follow up on feedback, list all articles in the onboarding collection through natural language commands.

This guide will help you understand how to give your Claude Agent SDK agent real control over a Gleap account through Composio's Gleap MCP server.

Before we dive in, let's take a quick look at the key ideas and tools involved.

Also integrate Gleap with

TL;DR

Here's what you'll learn:
  • Get and set up your Claude/Anthropic and Composio API keys
  • Install the necessary dependencies
  • Initialize Composio and create a Tool Router session for Gleap
  • Configure an AI agent that can use Gleap as a tool
  • Run a live chat session where you can ask the agent to perform Gleap operations

What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.

Key features include:

  • Native MCP Support: Built-in support for Model Context Protocol servers
  • Permission Modes: Control tool execution permissions
  • Streaming Responses: Real-time response streaming for interactive applications
  • Context Manager: Clean async context management for sessions

What is the Gleap MCP server, and what's possible with it?

The Gleap MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Gleap account. It provides structured and secure access to your customer feedback data, so your agent can perform actions like managing support tickets, communicating with users, organizing help center content, and handling team workflows on your behalf.

  • Ticket creation and management: Instantly create new support tickets, archive resolved issues, or retrieve existing tickets to streamline customer support workflows.
  • Chat and user communication: Allow your agent to send new chat messages or fetch entire chat histories, making it easy to keep conversations going with users.
  • Help center organization: Create collections or retrieve articles in your help center, enabling your agent to help manage and organize your knowledge base content efficiently.
  • Team and user administration: Add new teams for ticket assignment or remove users from projects, so you can stay on top of team management tasks without lifting a finger.
  • Checklist and engagement tracking: Fetch detailed checklists to monitor user engagement or onboarding progress, giving your agent context to provide personalized support.

What is the Composio tool router, and how does it fit here?

What is Composio SDK?

Composio's Composio SDK helps agents find the right tools for a task at runtime. You can plug in multiple toolkits (like Gmail, HubSpot, and GitHub), and the agent will identify the relevant app and action to complete multi-step workflows. This can reduce token usage and improve the reliability of tool calls. Read more here: Getting started with Composio SDK

The tool router generates a secure MCP URL that your agents can access to perform actions.

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

  1. Discovery: Searches for tools matching your task and returns relevant toolkits with their details.
  2. Authentication: Checks for active connections. If missing, creates an auth config and returns a connection URL via Auth Link.
  3. Execution: Executes the action using the authenticated connection.

Step-by-step Guide

Step by step09 STEPS
1

Prerequisites

Before starting, make sure you have:
  • Composio API Key and Claude/Anthropic API Key
  • Primary know-how of Claude Agents SDK
  • A Gleap account
  • Some knowledge of Python
2

Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
  • Go to the Anthropic Console and create an API key. You'll need credits to use the models.
  • Keep the API key safe.
Composio API Key
  • Log in to the Composio dashboard.
  • Navigate to your API settings and generate a new API key.
  • Store this key securely as you'll need it for authentication.
3

Install dependencies

npm install @anthropic-ai/claude-agent-sdk @composio/core dotenv

Install the Composio SDK and the Claude Agents SDK.

What's happening:

  • @composio/core provides Composio integration for Anthropic
  • @anthropic-ai/claude-agent-sdk is the core agent framework
  • dotenv/config loads environment variables
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

Create a .env file in your project root.

What's happening:

  • COMPOSIO_API_KEY authenticates with Composio
  • USER_ID identifies the user for session management
  • ANTHROPIC_API_KEY authenticates with Anthropic/Claude
5

Import dependencies

import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
What's happening:
  • We're importing all necessary libraries including the Claude Agent SDK and Composio
  • The dotenv.config() function loads environment variables from your .env file
  • This setup prepares the foundation for connecting Claude with Gleap functionality
6

Create a Composio instance and Tool Router session

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for Gleap
  const session = await composio.create(USER_ID, {
    toolkits: ['gleap'],
  });
  const mcpUrl = session?.mcp.url;
What's happening:
  • The function checks for the required COMPOSIO_API_KEY environment variable
  • We're creating a Composio instance using our API key
  • The create method creates a Tool Router session for Gleap
  • The returned url is the MCP server URL that your agent will use
7

Configure Claude Agent with MCP

const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to Gleap tools via Composio.',
  maxTurns: 10,
};
What's happening:
  • We're configuring the Claude Agent options with the MCP server URL
  • permissionMode: 'bypassPermissions' allows the agent to execute operations without asking for permission each time
  • The system prompt instructs the agent that it has access to Gleap
  • maxTurns: 10 limits the conversation length to prevent excessive API usage
8

Create client and start chat loop

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
What's happening:
  • The readline interface is created to handle user input and output
  • The query function is used to send the user's input to the agent
  • The chat loop continues until the user types 'exit' or 'quit'
9

Run the application

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
What's happening:
  • The chat function is the entry point for the application
  • The try-catch block is used to handle any errors that occur

Complete Code

Here's the complete code to get you started with Gleap and Claude Agent SDK:

import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['gleap']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to Gleap tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}

Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Gleap through Composio's Tool Router.

Key features:

  • Native MCP support through Claude's agent framework
  • Streaming responses for real-time interaction
  • Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.
TOOLS

Supported Tools

Every Gleap action and event your agent gets out of the box.

Archive All Tickets

Tool to archive all tickets matching specific type and status criteria.

Archive a Ticket

Tool to archive a ticket.

Clone Engagement

Tool to clone an existing engagement.

Create a Collection

Tool to create a help center collection.

Create AI Content

Tool to create or update AI content in Gleap's knowledge base.

Create a new chat message

Creates a new chat message in a Gleap chat session.

Create a new session

Create a new user session in Gleap and associate it with a project.

Create a new team

Tool to create a new team.

Create a new ticket

Create a new support ticket in Gleap with detailed information including title, description, type, priority, status, tags, and attachments.

Create Engagement Banner

Tool to create a new engagement banner in Gleap.

Create Engagement Checklist

Tool to create a new engagement checklist.

Create Engagement Cobrowse

Tool to create a new cobrowse product tour.

Create Engagement Email

Tool to create a new engagement email in Gleap.

Create Engagement Modal

Tool to create a new engagement modal in Gleap.

Create Engagement Product Tour

Tool to create a new product tour in Gleap.

Create Engagement Push Notification

Tool to create a new push notification in Gleap.

Create Engagement Tooltip

Tool to create a new engagement tooltip in Gleap.

Create feedback item

Tool to manually create a feedback item (bug) in a Gleap project.

Create Help Center Redirect

Tool to create a new redirect for help center URLs.

Create Message Template

Tool to create a new message template in Gleap.

Create new conversation with session

Create a new conversation with a session in Gleap.

Create QA Snippet

Tool to create a QA snippet (question-answer pair) in Gleap.

Create Tracker Ticket

Tool to create a tracker ticket in Gleap.

Delete AI Content

Tool to delete AI content by content ID.

Delete AI Content Batch

Tool to delete all AI content by batchId.

Delete a User from a Project

Removes a user (team member) from a Gleap project, revoking their access.

Delete Bugs

Tool to delete a bug/ticket by ID.

Delete Engagement Banner

Tool to delete an engagement banner.

Delete Engagement Chat Message

Deletes an engagement chat message from Gleap by its ID.

Delete Engagement Checklist

Tool to delete an engagement checklist by its ID.

Delete Engagement Cobrowse

Tool to delete a cobrowse product tour by its ID.

Delete Engagement Email

Tool to delete an engagement email by its ID.

Delete Engagement Modal

Tool to delete an engagement modal from a Gleap project.

Delete Engagement News

Tool to delete an engagement news article.

Delete Engagement Product Tour

Tool to delete an engagement product tour by its ID.

Delete Engagement Push Notification

Tool to delete an engagement push notification by its ID.

Delete Engagement Surveys

Tool to delete an engagement survey.

Delete Engagement Tooltips

Tool to delete an engagement tooltip.

Delete Engagement WhatsApp Message

Tool to delete an engagement WhatsApp message by its ID.

Delete Help Center Collection

Tool to delete a help center collection by ID.

Delete Help Center Redirect

Tool to delete a help center redirect.

Delete Message

Tool to delete a message (comment) from a bug or ticket.

Delete Message Template

Tool to delete a message template.

Delete Old AI Content Batches

Delete all AI content batches except the current batch.

Delete QA Answer

Tool to delete a QA answer (snippet) from a Gleap project.

Delete project session

Tool to delete a session from a Gleap project.

Delete session

Tool to delete a session by ID.

Delete Team

Tool to delete a team by ID.

Delete Ticket

Tool to delete a ticket by ID.

Export sessions

Tool to export sessions for the authenticated project in CSV format.

Export Statistics Lists

Tool to export statistics list data as CSV from Gleap.

Generate ticket draft reply

Tool to generate an AI-powered draft reply for a ticket.

Generate tracker ticket data

Tool to generate AI-powered tracker ticket data from an existing ticket.

Get a Checklist

Tool to retrieve a specific engagement checklist by its ID.

Get a Collection

Tool to retrieve a help center collection by ID.

Get AI content

Tool to retrieve AI content by its content ID.

Get all articles

Tool to retrieve articles in a help center collection.

Get all chat messages

Retrieves all engagement chat messages from the current Gleap project.

Get All Collections

Retrieves all help center collections for the authenticated project.

Get All Invitations for a Project

Retrieves all pending invitations for a project.

Get all sessions

Retrieves all user sessions for the authenticated project.

Get All Teams

Tool to retrieve all teams.

Get All Tickets

Retrieve tickets from a Gleap project with optional filtering, sorting, and pagination.

Get All Users for a Project

Tool to retrieve all users for a project.

Get a ticket

Retrieves complete details for a specific ticket by its ID.

Get current user

Retrieves the authenticated user's profile including email, name, user type, availability status, notification preferences, and 2FA settings.

Get engagement activities count

Tool to retrieve the count of activities for a specific engagement.

Get engagement banner

Tool to retrieve an engagement banner by its ID.

Get Engagement Banners

Tool to retrieve all engagement banners from a Gleap project.

Get engagement chat message

Retrieves a specific engagement chat message by its ID.

Get Engagement Checklists

Tool to retrieve all engagement checklists for a project.

Get Engagement Cobrowse

Retrieves all cobrowse product tours for the authenticated project.

Get engagement cobrowse by ID

Tool to retrieve a specific cobrowse product tour by its ID.

Get engagement email

Retrieves a specific engagement email by its ID.

Get Engagement Emails

Tool to retrieve all engagement emails from a Gleap project.

Get engagement modal

Tool to retrieve an engagement modal by its ID.

Get Engagement Modals

Tool to retrieve all engagement modals from a Gleap project.

Get Engagement News

Tool to retrieve all engagement news articles from a Gleap project.

Get engagement news article

Retrieves a specific engagement news article by its ID.

Get a Product Tour

Tool to retrieve a specific engagement product tour by its ID.

Get Engagement Product Tours

Tool to retrieve all engagement product tours for a project.

Get engagement push notification

Retrieves a specific engagement push notification by its ID.

Get Engagement Push Notifications

Tool to retrieve all engagement push notifications from a Gleap project.

Get Engagements Activities

Tool to retrieve all activities for a specific engagement.

Get engagement recipients

Tool to find and retrieve recipients for a specific engagement.

Get engagement statistics

Tool to retrieve statistics for a specific engagement.

Get Engagement Survey

Tool to retrieve a survey by its ID.

Get Engagement Surveys

Tool to retrieve all engagement surveys from a Gleap project.

Get Survey Responses

Tool to retrieve all survey responses for a specific survey.

Get Engagement Survey Response Samples

Tool to retrieve survey response samples for a specific engagement survey.

Summarize Survey Responses

Tool to retrieve an AI-generated summary of survey responses.

Get Engagement Tooltip by ID

Tool to retrieve a specific engagement tooltip by its ID.

Get Engagement Tooltips

Tool to retrieve all engagement tooltips for the authenticated project.

Get engagement WhatsApp message

Retrieves a specific engagement WhatsApp message by its ID.

Get Help Center Sources

Retrieves all configured help center sources (knowledge base content sources) for the project.

Get Invitations

Retrieves all invitations for the authenticated user.

Get message template

Retrieves a specific message template by its ID from a Gleap project.

Get Message Templates

Retrieve all message templates for the authenticated project.

Get notification ticket

Retrieves detailed information about a Gleap ticket using its notification share token.

Get project

Retrieves complete details for a specific project by its ID.

Get Projects

Retrieves all projects accessible to the authenticated user.

Get archived bugs

Tool to retrieve archived bugs for a specific project.

Get Projects Help Center Collections

Tool to get all help center collections for a project.

Get project sessions

Tool to retrieve all sessions for a specific project.

Get Projects Tickets

Tool to retrieve all tickets from a specific Gleap project.

Get project users

Tool to get project users by project ID.

Get a session

Retrieves detailed information for a specific session by its ID.

Get session activities

Retrieves all activities for a specific session by session ID.

Get session Chargebee info

Tool to retrieve Chargebee billing information for a specific session.

Get Session Checklists

Retrieve all engagement checklists associated with a user session in Gleap.

Get session events by ID

Tool to retrieve all streamed events for a specific session by its ID.

Get session LemonSqueezy info

Tool to retrieve LemonSqueezy subscription and payment information for a specific session.

Get Session Shopify Info

Retrieve Shopify information associated with a user session in Gleap.

Get Shared Help Center Answer

Retrieves an answer to a question from the shared help center knowledge base.

Get email client bounce statistics

Tool to retrieve email client bounce statistics from Gleap.

Get Email Client Usage Statistics

Tool to retrieve email client usage statistics from Gleap.

Get email overview statistics

Tool to retrieve email overview statistics from Gleap.

Get statistics facts

Tool to retrieve fact data for various statistics from Gleap.

Get Statistics Heatmap

Retrieve heatmap data for activity patterns in Gleap.

Get Statistics Lists

Tool to retrieve statistics list data from Gleap.

Get Statistics Raw Data

Tool to retrieve raw statistics data from Gleap.

Get Tickets By Session Query

Find tickets by session query parameters such as email, userId, phone, or custom data.

Get Tickets Export

Export tickets from Gleap project with optional filtering and sorting.

Get Tickets Export Fields

Retrieve available fields for ticket export from Gleap.

Search Tickets by Term

Search for tickets using a text search term in Gleap.

Get Tickets Count

Tool to get the total count of tickets in a Gleap project.

Get current user's permissions

Tool to retrieve the current user's role permissions.

Get users unified inbox

Retrieves tickets from the unified inbox for the authenticated user.

Get users unified inbox ticket

Retrieves complete details for a specific ticket from the unified inbox by its ID.

Identify or update user

Identify or update a user's information in Gleap.

Import session

Import user sessions into Gleap for tracking and analytics.

Import sessions from Intercom

Import user sessions from Intercom into Gleap.

Indicate user typing

Tool to indicate that a user is typing in a ticket conversation.

Indicate user viewing

Tool to indicate that a user is viewing a ticket.

Link a Ticket

Tool to link a ticket.

Mark Survey Responses as Read

Tool to mark all survey responses as read for a given survey.

Merge tickets

Tool to merge multiple tickets into a single target ticket in Gleap.

Post a comment on a bug

Tool to post a comment/message on a bug or ticket in Gleap.

Create Engagement News Article

Tool to create a new engagement news article in Gleap.

Create Engagement Survey

Tool to create a new survey in Gleap.

Create WhatsApp Engagement Message

Tool to create a new WhatsApp message in Gleap for user engagement.

Reassign all tickets to user

Tool to reassign all tickets to the authenticated user.

Resubscribe a Session

Tool to resubscribe a session.

Search for sessions

Search for sessions in Gleap using various filter criteria.

Search messages

Search messages in Gleap by search term.

Search sessions by index

Search for sessions in a project using the session search index.

Send Engagement Email Preview

Tool to send a preview of an engagement email to specified email addresses.

Send ticket transcript

Tool to send ticket conversation transcript to multiple email addresses.

Snooze a Ticket

Tool to snooze a ticket for a specified duration.

Suggest FAQ from message

Tool to suggest a FAQ from a message.

Toggle Collection Publish Status

Tool to toggle the publish status of a help center collection.

Track events

Track custom user events in Gleap for analytics and user behavior monitoring.

Unarchive a Ticket

Tool to unarchive a ticket.

Unlink a Ticket

Tool to unlink a ticket.

Unsubscribe sessions

Tool to unsubscribe one or more user sessions from communications.

Update AI Content by Content ID

Tool to update AI content by content ID.

Update a team

Tool to update an existing team.

Update a ticket

Tool to update an existing ticket/bug in Gleap.

Update a User for a Project

Tool to update a user’s role in a project.

Update Chat Message

Updates an existing chat message in Gleap by its ID.

Update a Checklist

Tool to update an engagement checklist by its ID.

Update Engagement Banner

Tool to update an engagement banner.

Update Engagement Cobrowse

Tool to update an existing cobrowse product tour.

Update Engagement Email

Tool to update an existing engagement email.

Update Engagement Modal

Tool to update an existing engagement modal.

Update Engagement News

Tool to update an engagement news article.

Update Engagement Product Tour

Tool to update an existing product tour.

Update Engagement Push Notification

Tool to update an existing push notification.

Update Engagement Survey

Tool to update an existing engagement survey in Gleap.

Update Engagement Tooltips

Tool to update an engagement tooltip.

Update Engagement WhatsApp Message

Tool to update an existing engagement WhatsApp message.

Update Helpcenter Collection

Tool to update a help center collection.

Update help center redirect

Tool to update an existing help center redirect.

Update message template

Tool to update an existing message template in Gleap.

Update project

Tool to update a Gleap project's configuration including name, description, notification settings, and feedback tags.

Update QA Answer

Updates an existing QA answer/snippet in Gleap.

Update a session

Tool to update an existing session in Gleap.

Update user

Tool to update a user's profile information including name, availability, profile image, onboarding status, and notification settings.

Vote for ticket

Tool to vote for a ticket in Gleap.

FAQ

Frequently asked questions

With a standalone Gleap MCP server, the agents and LLMs can only access a fixed set of Gleap tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Gleap and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Claude Agent SDK fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Gleap tools.

Yes, absolutely. You can configure which Gleap scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Gleap data and credentials are handled as safely as possible.

Start with Gleap.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Gleap tool your agent needs.Free to start.

Start building