How to integrate Gleap MCP with Vercel AI SDK v6

Trusted by
AWS
Glean
Zoom
Airtable

30 min · no commitment · see it on your stack

Gleap logo
Vercel AI SDK logo
divider

Introduction

This guide walks you through connecting Gleap to Vercel AI SDK v6 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 Vercel AI 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:
  • How to set up and configure a Vercel AI SDK agent with Gleap integration
  • Using Composio's Tool Router to dynamically load and access Gleap tools
  • Creating an MCP client connection using HTTP transport
  • Building an interactive CLI chat interface with conversation history management
  • Handling tool calls and results within the Vercel AI SDK framework

What is Vercel AI SDK?

The Vercel AI SDK is a TypeScript library for building AI-powered applications. It provides tools for creating agents that can use external services and maintain conversation state.

Key features include:

  • streamText: Core function for streaming responses with real-time tool support
  • MCP Client: Built-in support for Model Context Protocol via @ai-sdk/mcp
  • Step Counting: Control multi-step tool execution with stopWhen: stepCountIs()
  • OpenAI Provider: Native integration with OpenAI models

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.

Supported Tools & Triggers

Tools
Archive All TicketsTool to archive all tickets matching specific type and status criteria.
Archive a TicketTool to archive a ticket.
Clone EngagementTool to clone an existing engagement.
Create a CollectionTool to create a help center collection.
Create AI ContentTool to create or update AI content in Gleap's knowledge base.
Create a new chat messageCreates a new chat message in a Gleap chat session.
Create a new sessionCreate a new user session in Gleap and associate it with a project.
Create a new teamTool to create a new team.
Create a new ticketCreate a new support ticket in Gleap with detailed information including title, description, type, priority, status, tags, and attachments.
Create Engagement BannerTool to create a new engagement banner in Gleap.
Create Engagement ChecklistTool to create a new engagement checklist.
Create Engagement CobrowseTool to create a new cobrowse product tour.
Create Engagement EmailTool to create a new engagement email in Gleap.
Create Engagement ModalTool to create a new engagement modal in Gleap.
Create Engagement Product TourTool to create a new product tour in Gleap.
Create Engagement Push NotificationTool to create a new push notification in Gleap.
Create Engagement TooltipTool to create a new engagement tooltip in Gleap.
Create feedback itemTool to manually create a feedback item (bug) in a Gleap project.
Create Help Center RedirectTool to create a new redirect for help center URLs.
Create Message TemplateTool to create a new message template in Gleap.
Create new conversation with sessionCreate a new conversation with a session in Gleap.
Create QA SnippetTool to create a QA snippet (question-answer pair) in Gleap.
Create Tracker TicketTool to create a tracker ticket in Gleap.
Delete AI ContentTool to delete AI content by content ID.
Delete AI Content BatchTool to delete all AI content by batchId.
Delete a User from a ProjectRemoves a user (team member) from a Gleap project, revoking their access.
Delete BugsTool to delete a bug/ticket by ID.
Delete Engagement BannerTool to delete an engagement banner.
Delete Engagement Chat MessageDeletes an engagement chat message from Gleap by its ID.
Delete Engagement ChecklistTool to delete an engagement checklist by its ID.
Delete Engagement CobrowseTool to delete a cobrowse product tour by its ID.
Delete Engagement EmailTool to delete an engagement email by its ID.
Delete Engagement ModalTool to delete an engagement modal from a Gleap project.
Delete Engagement NewsTool to delete an engagement news article.
Delete Engagement Product TourTool to delete an engagement product tour by its ID.
Delete Engagement Push NotificationTool to delete an engagement push notification by its ID.
Delete Engagement SurveysTool to delete an engagement survey.
Delete Engagement TooltipsTool to delete an engagement tooltip.
Delete Engagement WhatsApp MessageTool to delete an engagement WhatsApp message by its ID.
Delete Help Center CollectionTool to delete a help center collection by ID.
Delete Help Center RedirectTool to delete a help center redirect.
Delete MessageTool to delete a message (comment) from a bug or ticket.
Delete Message TemplateTool to delete a message template.
Delete Old AI Content BatchesDelete all AI content batches except the current batch.
Delete QA AnswerTool to delete a QA answer (snippet) from a Gleap project.
Delete project sessionTool to delete a session from a Gleap project.
Delete sessionTool to delete a session by ID.
Delete TeamTool to delete a team by ID.
Delete TicketTool to delete a ticket by ID.
Export sessionsTool to export sessions for the authenticated project in CSV format.
Export Statistics ListsTool to export statistics list data as CSV from Gleap.
Generate ticket draft replyTool to generate an AI-powered draft reply for a ticket.
Generate tracker ticket dataTool to generate AI-powered tracker ticket data from an existing ticket.
Get a ChecklistTool to retrieve a specific engagement checklist by its ID.
Get a CollectionTool to retrieve a help center collection by ID.
Get AI contentTool to retrieve AI content by its content ID.
Get all articlesTool to retrieve articles in a help center collection.
Get all chat messagesRetrieves all engagement chat messages from the current Gleap project.
Get All CollectionsRetrieves all help center collections for the authenticated project.
Get All Invitations for a ProjectRetrieves all pending invitations for a project.
Get all sessionsRetrieves all user sessions for the authenticated project.
Get All TeamsTool to retrieve all teams.
Get All TicketsRetrieve tickets from a Gleap project with optional filtering, sorting, and pagination.
Get All Users for a ProjectTool to retrieve all users for a project.
Get a ticketRetrieves complete details for a specific ticket by its ID.
Get current userRetrieves the authenticated user's profile including email, name, user type, availability status, notification preferences, and 2FA settings.
Get engagement activities countTool to retrieve the count of activities for a specific engagement.
Get engagement bannerTool to retrieve an engagement banner by its ID.
Get Engagement BannersTool to retrieve all engagement banners from a Gleap project.
Get engagement chat messageRetrieves a specific engagement chat message by its ID.
Get Engagement ChecklistsTool to retrieve all engagement checklists for a project.
Get Engagement CobrowseRetrieves all cobrowse product tours for the authenticated project.
Get engagement cobrowse by IDTool to retrieve a specific cobrowse product tour by its ID.
Get engagement emailRetrieves a specific engagement email by its ID.
Get Engagement EmailsTool to retrieve all engagement emails from a Gleap project.
Get engagement modalTool to retrieve an engagement modal by its ID.
Get Engagement ModalsTool to retrieve all engagement modals from a Gleap project.
Get Engagement NewsTool to retrieve all engagement news articles from a Gleap project.
Get engagement news articleRetrieves a specific engagement news article by its ID.
Get a Product TourTool to retrieve a specific engagement product tour by its ID.
Get Engagement Product ToursTool to retrieve all engagement product tours for a project.
Get engagement push notificationRetrieves a specific engagement push notification by its ID.
Get Engagement Push NotificationsTool to retrieve all engagement push notifications from a Gleap project.
Get Engagements ActivitiesTool to retrieve all activities for a specific engagement.
Get engagement recipientsTool to find and retrieve recipients for a specific engagement.
Get engagement statisticsTool to retrieve statistics for a specific engagement.
Get Engagement SurveyTool to retrieve a survey by its ID.
Get Engagement SurveysTool to retrieve all engagement surveys from a Gleap project.
Get Survey ResponsesTool to retrieve all survey responses for a specific survey.
Get Engagement Survey Response SamplesTool to retrieve survey response samples for a specific engagement survey.
Summarize Survey ResponsesTool to retrieve an AI-generated summary of survey responses.
Get Engagement Tooltip by IDTool to retrieve a specific engagement tooltip by its ID.
Get Engagement TooltipsTool to retrieve all engagement tooltips for the authenticated project.
Get engagement WhatsApp messageRetrieves a specific engagement WhatsApp message by its ID.
Get Help Center SourcesRetrieves all configured help center sources (knowledge base content sources) for the project.
Get InvitationsRetrieves all invitations for the authenticated user.
Get message templateRetrieves a specific message template by its ID from a Gleap project.
Get Message TemplatesRetrieve all message templates for the authenticated project.
Get notification ticketRetrieves detailed information about a Gleap ticket using its notification share token.
Get projectRetrieves complete details for a specific project by its ID.
Get ProjectsRetrieves all projects accessible to the authenticated user.
Get archived bugsTool to retrieve archived bugs for a specific project.
Get Projects Help Center CollectionsTool to get all help center collections for a project.
Get project sessionsTool to retrieve all sessions for a specific project.
Get Projects TicketsTool to retrieve all tickets from a specific Gleap project.
Get project usersTool to get project users by project ID.
Get a sessionRetrieves detailed information for a specific session by its ID.
Get session activitiesRetrieves all activities for a specific session by session ID.
Get session Chargebee infoTool to retrieve Chargebee billing information for a specific session.
Get Session ChecklistsRetrieve all engagement checklists associated with a user session in Gleap.
Get session events by IDTool to retrieve all streamed events for a specific session by its ID.
Get session LemonSqueezy infoTool to retrieve LemonSqueezy subscription and payment information for a specific session.
Get Session Shopify InfoRetrieve Shopify information associated with a user session in Gleap.
Get Shared Help Center AnswerRetrieves an answer to a question from the shared help center knowledge base.
Get email client bounce statisticsTool to retrieve email client bounce statistics from Gleap.
Get Email Client Usage StatisticsTool to retrieve email client usage statistics from Gleap.
Get email overview statisticsTool to retrieve email overview statistics from Gleap.
Get statistics factsTool to retrieve fact data for various statistics from Gleap.
Get Statistics HeatmapRetrieve heatmap data for activity patterns in Gleap.
Get Statistics ListsTool to retrieve statistics list data from Gleap.
Get Statistics Raw DataTool to retrieve raw statistics data from Gleap.
Get Tickets By Session QueryFind tickets by session query parameters such as email, userId, phone, or custom data.
Get Tickets ExportExport tickets from Gleap project with optional filtering and sorting.
Get Tickets Export FieldsRetrieve available fields for ticket export from Gleap.
Search Tickets by TermSearch for tickets using a text search term in Gleap.
Get Tickets CountTool to get the total count of tickets in a Gleap project.
Get current user's permissionsTool to retrieve the current user's role permissions.
Get users unified inboxRetrieves tickets from the unified inbox for the authenticated user.
Get users unified inbox ticketRetrieves complete details for a specific ticket from the unified inbox by its ID.
Identify or update userIdentify or update a user's information in Gleap.
Import sessionImport user sessions into Gleap for tracking and analytics.
Import sessions from IntercomImport user sessions from Intercom into Gleap.
Indicate user typingTool to indicate that a user is typing in a ticket conversation.
Indicate user viewingTool to indicate that a user is viewing a ticket.
Link a TicketTool to link a ticket.
Mark Survey Responses as ReadTool to mark all survey responses as read for a given survey.
Merge ticketsTool to merge multiple tickets into a single target ticket in Gleap.
Post a comment on a bugTool to post a comment/message on a bug or ticket in Gleap.
Create Engagement News ArticleTool to create a new engagement news article in Gleap.
Create Engagement SurveyTool to create a new survey in Gleap.
Create WhatsApp Engagement MessageTool to create a new WhatsApp message in Gleap for user engagement.
Reassign all tickets to userTool to reassign all tickets to the authenticated user.
Resubscribe a SessionTool to resubscribe a session.
Search for sessionsSearch for sessions in Gleap using various filter criteria.
Search messagesSearch messages in Gleap by search term.
Search sessions by indexSearch for sessions in a project using the session search index.
Send Engagement Email PreviewTool to send a preview of an engagement email to specified email addresses.
Send ticket transcriptTool to send ticket conversation transcript to multiple email addresses.
Snooze a TicketTool to snooze a ticket for a specified duration.
Suggest FAQ from messageTool to suggest a FAQ from a message.
Toggle Collection Publish StatusTool to toggle the publish status of a help center collection.
Track eventsTrack custom user events in Gleap for analytics and user behavior monitoring.
Unarchive a TicketTool to unarchive a ticket.
Unlink a TicketTool to unlink a ticket.
Unsubscribe sessionsTool to unsubscribe one or more user sessions from communications.
Update AI Content by Content IDTool to update AI content by content ID.
Update a teamTool to update an existing team.
Update a ticketTool to update an existing ticket/bug in Gleap.
Update a User for a ProjectTool to update a user’s role in a project.
Update Chat MessageUpdates an existing chat message in Gleap by its ID.
Update a ChecklistTool to update an engagement checklist by its ID.
Update Engagement BannerTool to update an engagement banner.
Update Engagement CobrowseTool to update an existing cobrowse product tour.
Update Engagement EmailTool to update an existing engagement email.
Update Engagement ModalTool to update an existing engagement modal.
Update Engagement NewsTool to update an engagement news article.
Update Engagement Product TourTool to update an existing product tour.
Update Engagement Push NotificationTool to update an existing push notification.
Update Engagement SurveyTool to update an existing engagement survey in Gleap.
Update Engagement TooltipsTool to update an engagement tooltip.
Update Engagement WhatsApp MessageTool to update an existing engagement WhatsApp message.
Update Helpcenter CollectionTool to update a help center collection.
Update help center redirectTool to update an existing help center redirect.
Update message templateTool to update an existing message template in Gleap.
Update projectTool to update a Gleap project's configuration including name, description, notification settings, and feedback tags.
Update QA AnswerUpdates an existing QA answer/snippet in Gleap.
Update a sessionTool to update an existing session in Gleap.
Update userTool to update a user's profile information including name, availability, profile image, onboarding status, and notification settings.
Vote for ticketTool to vote for a ticket in Gleap.

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

Prerequisites

Before you begin, make sure you have:
  • Node.js and npm installed
  • A Composio account with API key
  • An OpenAI API key

Getting API Keys for OpenAI and Composio

OpenAI API Key
  • Go to the OpenAI dashboard and create an API key. You'll need credits to use the models, or you can connect to another model provider.
  • 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.

Install required dependencies

bash
npm install @ai-sdk/openai @ai-sdk/mcp @composio/core ai dotenv

First, install the necessary packages for your project.

What you're installing:

  • @ai-sdk/openai: Vercel AI SDK's OpenAI provider
  • @ai-sdk/mcp: MCP client for Vercel AI SDK
  • @composio/core: Composio SDK for tool integration
  • ai: Core Vercel AI SDK
  • dotenv: Environment variable management

Set up environment variables

bash
OPENAI_API_KEY=your_openai_api_key_here
COMPOSIO_API_KEY=your_composio_api_key_here
COMPOSIO_USER_ID=your_user_id_here

Create a .env file in your project root.

What's needed:

  • OPENAI_API_KEY: Your OpenAI API key for GPT model access
  • COMPOSIO_API_KEY: Your Composio API key for tool access
  • COMPOSIO_USER_ID: A unique identifier for the user session

Import required modules and validate environment

typescript
import "dotenv/config";
import { openai } from "@ai-sdk/openai";
import { Composio } from "@composio/core";
import * as readline from "readline";
import { streamText, type ModelMessage, stepCountIs } from "ai";
import { createMCPClient } from "@ai-sdk/mcp";

const composioAPIKey = process.env.COMPOSIO_API_KEY;
const composioUserID = process.env.COMPOSIO_USER_ID;

if (!process.env.OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!composioAPIKey) throw new Error("COMPOSIO_API_KEY is not set");
if (!composioUserID) throw new Error("COMPOSIO_USER_ID is not set");

const composio = new Composio({
  apiKey: composioAPIKey,
});
What's happening:
  • We're importing all necessary libraries including Vercel AI SDK's OpenAI provider and Composio
  • The dotenv/config import automatically loads environment variables
  • The MCP client import enables connection to Composio's tool server

Create Tool Router session and initialize MCP client

typescript
async function main() {
  // Create a tool router session for the user
  const session = await composio.create(composioUserID!, {
    toolkits: ["gleap"],
  });

  const mcpUrl = session.mcp.url;
What's happening:
  • We're creating a Tool Router session that gives your agent access to Gleap tools
  • The create method takes the user ID and specifies which toolkits should be available
  • The returned mcp object contains the URL and authentication headers needed to connect to the MCP server
  • This session provides access to all Gleap-related tools through the MCP protocol

Connect to MCP server and retrieve tools

typescript
const mcpClient = await createMCPClient({
  transport: {
    type: "http",
    url: mcpUrl,
    headers: session.mcp.headers, // Authentication headers for the Composio MCP server
  },
});

const tools = await mcpClient.tools();
What's happening:
  • We're creating an MCP client that connects to our Composio Tool Router session via HTTP
  • The mcp.url provides the endpoint, and mcp.headers contains authentication credentials
  • The type: "http" is important - Composio requires HTTP transport
  • tools() retrieves all available Gleap tools that the agent can use

Initialize conversation and CLI interface

typescript
let messages: ModelMessage[] = [];

console.log("Chat started! Type 'exit' or 'quit' to end the conversation.\n");
console.log(
  "Ask any questions related to gleap, like summarize my last 5 emails, send an email, etc... :)))\n",
);

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

rl.prompt();
What's happening:
  • We initialize an empty messages array to maintain conversation history
  • A readline interface is created to accept user input from the command line
  • Instructions are displayed to guide the user on how to interact with the agent

Handle user input and stream responses with real-time tool feedback

typescript
rl.on("line", async (userInput: string) => {
  const trimmedInput = userInput.trim();

  if (["exit", "quit", "bye"].includes(trimmedInput.toLowerCase())) {
    console.log("\nGoodbye!");
    rl.close();
    process.exit(0);
  }

  if (!trimmedInput) {
    rl.prompt();
    return;
  }

  messages.push({ role: "user", content: trimmedInput });
  console.log("\nAgent is thinking...\n");

  try {
    const stream = streamText({
      model: openai("gpt-5"),
      messages,
      tools,
      toolChoice: "auto",
      stopWhen: stepCountIs(10),
      onStepFinish: (step) => {
        for (const toolCall of step.toolCalls) {
          console.log(`[Using tool: ${toolCall.toolName}]`);
          }
          if (step.toolCalls.length > 0) {
            console.log(""); // Add space after tool calls
          }
        },
      });

      for await (const chunk of stream.textStream) {
        process.stdout.write(chunk);
      }

      console.log("\n\n---\n");

      // Get final result for message history
      const response = await stream.response;
      if (response?.messages?.length) {
        messages.push(...response.messages);
      }
    } catch (error) {
      console.error("\nAn error occurred while talking to the agent:");
      console.error(error);
      console.log(
        "\nYou can try again or restart the app if it keeps happening.\n",
      );
    } finally {
      rl.prompt();
    }
  });

  rl.on("close", async () => {
    await mcpClient.close();
    console.log("\n👋 Session ended.");
    process.exit(0);
  });
}

main().catch((err) => {
  console.error("Fatal error:", err);
  process.exit(1);
});
What's happening:
  • We use streamText instead of generateText to stream responses in real-time
  • toolChoice: "auto" allows the model to decide when to use Gleap tools
  • stopWhen: stepCountIs(10) allows up to 10 steps for complex multi-tool operations
  • onStepFinish callback displays which tools are being used in real-time
  • We iterate through the text stream to create a typewriter effect as the agent responds
  • The complete response is added to conversation history to maintain context
  • Errors are caught and displayed with helpful retry suggestions

Complete Code

Here's the complete code to get you started with Gleap and Vercel AI SDK:

typescript
import "dotenv/config";
import { openai } from "@ai-sdk/openai";
import { Composio } from "@composio/core";
import * as readline from "readline";
import { streamText, type ModelMessage, stepCountIs } from "ai";
import { createMCPClient } from "@ai-sdk/mcp";

const composioAPIKey = process.env.COMPOSIO_API_KEY;
const composioUserID = process.env.COMPOSIO_USER_ID;

if (!process.env.OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!composioAPIKey) throw new Error("COMPOSIO_API_KEY is not set");
if (!composioUserID) throw new Error("COMPOSIO_USER_ID is not set");

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

async function main() {
  // Create a tool router session for the user
  const session = await composio.create(composioUserID!, {
    toolkits: ["gleap"],
  });

  const mcpUrl = session.mcp.url;

  const mcpClient = await createMCPClient({
    transport: {
      type: "http",
      url: mcpUrl,
      headers: session.mcp.headers, // Authentication headers for the Composio MCP server
    },
  });

  const tools = await mcpClient.tools();

  let messages: ModelMessage[] = [];

  console.log("Chat started! Type 'exit' or 'quit' to end the conversation.\n");
  console.log(
    "Ask any questions related to gleap, like summarize my last 5 emails, send an email, etc... :)))\n",
  );

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

  rl.prompt();

  rl.on("line", async (userInput: string) => {
    const trimmedInput = userInput.trim();

    if (["exit", "quit", "bye"].includes(trimmedInput.toLowerCase())) {
      console.log("\nGoodbye!");
      rl.close();
      process.exit(0);
    }

    if (!trimmedInput) {
      rl.prompt();
      return;
    }

    messages.push({ role: "user", content: trimmedInput });
    console.log("\nAgent is thinking...\n");

    try {
      const stream = streamText({
        model: openai("gpt-5"),
        messages,
        tools,
        toolChoice: "auto",
        stopWhen: stepCountIs(10),
        onStepFinish: (step) => {
          for (const toolCall of step.toolCalls) {
            console.log(`[Using tool: ${toolCall.toolName}]`);
          }
          if (step.toolCalls.length > 0) {
            console.log(""); // Add space after tool calls
          }
        },
      });

      for await (const chunk of stream.textStream) {
        process.stdout.write(chunk);
      }

      console.log("\n\n---\n");

      // Get final result for message history
      const response = await stream.response;
      if (response?.messages?.length) {
        messages.push(...response.messages);
      }
    } catch (error) {
      console.error("\nAn error occurred while talking to the agent:");
      console.error(error);
      console.log(
        "\nYou can try again or restart the app if it keeps happening.\n",
      );
    } finally {
      rl.prompt();
    }
  });

  rl.on("close", async () => {
    await mcpClient.close();
    console.log("\n👋 Session ended.");
    process.exit(0);
  });
}

main().catch((err) => {
  console.error("Fatal error:", err);
  process.exit(1);
});

Conclusion

You've successfully built a Gleap agent using the Vercel AI SDK with streaming capabilities! This implementation provides a powerful foundation for building AI applications with natural language interfaces and real-time feedback.

Key features of this implementation:

  • Real-time streaming responses for a better user experience with typewriter effect
  • Live tool execution feedback showing which tools are being used as the agent works
  • Dynamic tool loading through Composio's Tool Router with secure authentication
  • Multi-step tool execution with configurable step limits (up to 10 steps)
  • Comprehensive error handling for robust agent execution
  • Conversation history maintenance for context-aware responses

You can extend this further by adding custom error handling, implementing specific business logic, or integrating additional Composio toolkits to create multi-app workflows.

How to build Gleap MCP Agent with another framework

FAQ

What are the differences in Tool Router MCP and Gleap MCP?

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.

Can I use Tool Router MCP with Vercel AI SDK v6?

Yes, you can. Vercel AI SDK v6 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.

Can I manage the permissions and scopes for Gleap while using Tool Router?

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.

How safe is my data with Composio Tool Router?

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.

Used by agents from

Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai

Never worry about agent reliability

We handle tool reliability, observability, and security so you never have to second-guess an agent action.