# How to integrate Cloudcart MCP with LlamaIndex

```json
{
  "title": "How to integrate Cloudcart MCP with LlamaIndex",
  "toolkit": "Cloudcart",
  "toolkit_slug": "cloudcart",
  "framework": "LlamaIndex",
  "framework_slug": "llama-index",
  "url": "https://composio.dev/toolkits/cloudcart/framework/llama-index",
  "markdown_url": "https://composio.dev/toolkits/cloudcart/framework/llama-index.md",
  "updated_at": "2026-05-12T10:06:36.502Z"
}
```

## Introduction

This guide walks you through connecting Cloudcart to LlamaIndex using the Composio tool router. By the end, you'll have a working Cloudcart agent that can add three t-shirts to a customer’s cart, create a new product called summer mug, register a new customer with email and name through natural language commands.
This guide will help you understand how to give your LlamaIndex agent real control over a Cloudcart account through Composio's Cloudcart MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Cloudcart with

- [OpenAI Agents SDK](https://composio.dev/toolkits/cloudcart/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/cloudcart/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/cloudcart/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/cloudcart/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/cloudcart/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/cloudcart/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/cloudcart/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/cloudcart/framework/cli)
- [Google ADK](https://composio.dev/toolkits/cloudcart/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/cloudcart/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/cloudcart/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/cloudcart/framework/mastra-ai)
- [CrewAI](https://composio.dev/toolkits/cloudcart/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- Set your OpenAI and Composio API keys
- Install LlamaIndex and Composio packages
- Create a Composio Tool Router session for Cloudcart
- Connect LlamaIndex to the Cloudcart MCP server
- Build a Cloudcart-powered agent using LlamaIndex
- Interact with Cloudcart through natural language

## What is LlamaIndex?

LlamaIndex is a data framework for building LLM applications. It provides tools for connecting LLMs to external data sources and services through agents and tools.
Key features include:
- ReAct Agent: Reasoning and acting pattern for tool-using agents
- MCP Tools: Native support for Model Context Protocol
- Context Management: Maintain conversation context across interactions
- Async Support: Built for async/await patterns

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

The Cloudcart MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Cloudcart account. It provides structured and secure access to your online store, so your agent can perform actions like managing products, handling customer accounts, processing orders, and organizing categories on your behalf.
- Product and inventory management: Add new products, create variants, and update your store catalog efficiently through your agent.
- Customer onboarding and management: Register new customers or update existing profiles, enabling seamless customer experiences directly from your agent.
- Order processing and cart handling: Let your agent create new orders, add items to carts, or clear carts to streamline the purchase flow.
- Category and vendor organization: Create new product categories or onboard vendors, keeping your store organized and expanding easily.
- Variant configuration and customization: Add or update product variants and their parameters, allowing your agent to manage different product options and custom attributes.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `CLOUDCART_ADD_CATEGORY_PROPERTIES` | Add Category Properties | Tool to add properties to a category relationship. Use when you need to associate one or more properties with a category for filtering or organization purposes. |
| `CLOUDCART_ADD_TO_CART` | Add to Cart | Tool to add an item to the cart. Use after confirming a product selection with desired quantity. |
| `CLOUDCART_CLEAR_CART` | Clear Cart | Tool to remove all items from the specified cart. Use when you need to empty the cart before adding new items or starting over. |
| `CLOUDCART_CREATE_BLOG_CATEGORY` | Create Blog Category | Tool to create a new blog category in CloudCart. Use when you need to organize blog posts into categories. Requires a category name and optionally accepts an image URL for visual representation. |
| `CLOUDCART_CREATE_BLOG_POST` | Create Blog Post | Tool to create a new blog post in CloudCart. Use when you need to publish blog content to your store. Requires post title, content, blog ID, and author ID. |
| `CLOUDCART_CREATE_BLOG_TAGS` | Create Blog Tag | Tool to create a new blog tag in CloudCart. Use when you need to add tags for organizing blog content. Tags help categorize and filter blog posts for better content discovery. |
| `CLOUDCART_CREATE_CATEGORY` | Create Category | Tool to create a new category. Use when you need to add organizational structure to your product catalog. |
| `CLOUDCART_CREATE_CUSTOMER` | Create Customer | Tool to create a new customer in CloudCart. Use when you need to register a new customer profile. Provide validated customer details (first name, last name, email, and password). Returns the created customer with their unique ID and timestamps. |
| `CLOUDCART_CREATE_CUSTOMER_BILLING_ADDRESS` | Create Customer Billing Address | Tool to create a new customer billing address. Use when you need to add a billing address for an existing customer. Requires customer ID and address details (name, country, city, street). |
| `CLOUDCART_CREATE_CUSTOMER_GROUPS` | Create Customer Groups | Tool to create a new customer group in CloudCart. Use when you need to organize customers into categories or segments for targeted marketing, pricing, or permissions. The group name must be unique. |
| `CLOUDCART_CREATE_CUSTOMER_SHIPPING_ADDRESS` | Create Customer Shipping Address | Tool to create a customer shipping address in CloudCart. Use when you need to add a new delivery address for an existing customer. Requires customer ID and complete address details (name, phone, country, city, street, postal code). |
| `CLOUDCART_CREATE_CUSTOMER_TAGS` | Create Customer Tag | Tool to create a new customer tag in CloudCart. Use when you need to add tags for organizing and categorizing customers. Tags can be used for filtering, grouping, or marketing purposes. |
| `CLOUDCART_CREATE_DISCOUNT` | Create Discount | Tool to create a new discount in CloudCart. Use when you need to add promotional discounts, sales, or special offers. Supports various discount types (fixed, percent, flat, shipping) and flexible targeting (all products, specific products, categories, or customers). |
| `CLOUDCART_CREATE_DISCOUNT_CODE` | Create Discount Code | Create a new discount code in CloudCart. Use when you need to add promotional discount codes to the store. The value represents the discount percentage multiplied by 100 (e.g., 1500 = 15% off). |
| `CLOUDCART_CREATE_IMAGES` | Create Image | Tool to create a new image for a product. Use when you need to add an image to an existing product by providing the image URL and product ID. |
| `CLOUDCART_CREATE_LINKED_PRODUCTS` | Create Linked Products | Tool to create linked product relationships in CloudCart. Use when you need to associate related products together, such as complementary items or product bundles. Supports bidirectional linking where linked products reference each other. |
| `CLOUDCART_CREATE_ORDER` | Create Order | Tool to create a new order. Use after assembling customer ID, cart items, and optional addresses/payment info. |
| `CLOUDCART_CREATE_PRODUCT` | Create Product | Creates a new product in CloudCart catalog. Requires product name, price, and at least one category ID. Supports optional fields like SKU, description (HTML allowed), quantity, weight, barcode, status, tags, and images. Use this when you need to add a new product to the store inventory. |
| `CLOUDCART_CREATE_PRODUCTS_PROPERTY_OPTIONS` | Create Products Property Options | Tool to add property options to a product relationship. Use when you need to associate one or more property options with a product for configuration or customization purposes. |
| `CLOUDCART_CREATE_PRODUCT_TO_DISCOUNT` | Create Product to Discount | Tool to create a product to discount relationship in CloudCart. Use when you need to associate a product variant with a discount and optionally set a discounted price. |
| `CLOUDCART_CREATE_PROPERTIES` | Create Property | Tool to create a new property in CloudCart. Properties are attributes that can be assigned to products (e.g., color, size, material). Use when you need to define new product characteristics or attributes for your catalog. |
| `CLOUDCART_CREATE_PROPERTY_OPTION` | Create Property Option | Tool to create a new property option. Use when you need to add a new option value to a product property (e.g., adding "Red" to a "Color" property or "Large" to a "Size" property). |
| `CLOUDCART_CREATE_REDIRECTS` | Create Redirect | Create a new URL redirect in CloudCart. Supports five redirect types: 'manual' for custom paths, 'external' for external URLs, and 'product', 'category', or 'vendor' to link to specific store items. Use when you need to redirect old URLs to new locations or specific store resources. |
| `CLOUDCART_CREATE_SUBSCRIBERS` | Create Subscriber | Tool to create a new subscriber in CloudCart. Use when you need to add a subscriber to the mailing list. Provide the subscriber's first name, last name, and two-letter country code. |
| `CLOUDCART_CREATE_SUBSCRIBERS_CHANNELS` | Create Subscriber Channel | Tool to create a new subscriber channel in CloudCart. Use when you need to add a communication channel (email or phone) for a subscriber. Provide the subscriber ID, channel type, contact identifier, and consent flags. |
| `CLOUDCART_CREATE_SUBSCRIBERS_TAGS` | Create Subscriber Tag | Tool to create a new subscriber-tag association in CloudCart. Use when you need to associate a tag with a subscriber for organizing, categorizing, or filtering subscribers. |
| `CLOUDCART_CREATE_VARIANT` | Create Variant | Tool to create a new product variant for a given product. Use when you need to add a variant with specific SKU, price, and options. |
| `CLOUDCART_CREATE_VARIANT_OPTION` | Create Variant Option | Tool to create a new variant option for a specific product variant. Use when you need to add an option (e.g., 'Large') with an optional price adjustment to an existing variant. |
| `CLOUDCART_CREATE_VARIANT_OPTIONS` | Create Variant Options | Tool to create a new variant option. Use when you need to add a new option (e.g., 'Medium', 'Blue') to an existing variant parameter. |
| `CLOUDCART_CREATE_VARIANT_PARAMETER` | Create Variant Parameter | Tool to create a new variant parameter for a product variant. Use when you need to add custom attributes (e.g., color, size) after a variant is created. |
| `CLOUDCART_CREATE_VARIANT_PARAMETERS` | Create Variant Parameter | Tool to create a new variant parameter definition. Use when you need to define a new product attribute type (e.g., Size, Color, Material) that can be used across products. |
| `CLOUDCART_CREATE_VENDOR` | Create Vendor | Create a new vendor in your CloudCart store. Vendors represent brands, manufacturers, or suppliers. The image_url is optional - if not provided, a default placeholder will be used. If provided, it must be a valid, publicly accessible image URL. |
| `CLOUDCART_CREATE_WEBHOOKS` | Create Webhook | Tool to create a new webhook subscription in CloudCart. Use when you need to register a webhook URL for receiving real-time event notifications (e.g., order.created, order.updated). CloudCart will send HTTP POST requests to your webhook URL when the specified event occurs. Retry policy: up to 6 attempts at 60, 120, 180, 240, 300 second intervals. |
| `CLOUDCART_DELETE_BLOG_CATEGORY` | Delete Blog Category | Tool to delete a blog category by its ID. Use after confirming the correct ID to permanently remove it. |
| `CLOUDCART_DELETE_BLOG_POST` | Delete Blog Post | Tool to delete a blog post by its ID. Use after confirming the correct ID to permanently remove the blog post. |
| `CLOUDCART_DELETE_BLOG_TAG` | Delete Blog Tag | Tool to delete a blog tag by its ID. Use after confirming the correct ID to permanently remove the tag. The API returns 204 No Content on successful deletion. |
| `CLOUDCART_DELETE_CATEGORY` | Delete Category | Tool to delete a category by its ID. Use after confirming the correct ID to permanently remove it. |
| `CLOUDCART_DELETE_CUSTOMER` | Delete Customer | Tool to delete a customer. Use when you need to remove a customer by their ID. Example: "Delete customer with ID 123". |
| `CLOUDCART_DELETE_CUSTOMER_BILLING_ADDRESS` | Delete Customer Billing Address | Tool to delete a customer billing address by its ID. Use when you need to remove a billing address from a customer's account. |
| `CLOUDCART_DELETE_CUSTOMER_GROUP` | Delete Customer Group | Tool to delete a customer group by its ID. Use when you need to permanently remove a customer group from the store. |
| `CLOUDCART_DELETE_CUSTOMER_SHIPPING_ADDRESS` | Delete Customer Shipping Address | Tool to delete a customer shipping address. Use when you need to remove a customer's shipping address by its ID. |
| `CLOUDCART_DELETE_CUSTOMER_TAG` | Delete Customer Tag | Tool to delete a customer tag by its ID. Use after confirming the tag exists to permanently remove it. |
| `CLOUDCART_DELETE_DISCOUNT` | Delete Discount | Tool to delete a discount by its ID. Use after confirming the discount exists to permanently remove it from the store. |
| `CLOUDCART_DELETE_DISCOUNT_CODE` | Delete Discount Code | Tool to delete a discount code by its ID. Use after confirming the discount code exists to permanently remove it from the store. |
| `CLOUDCART_DELETE_IMAGE` | Delete Image | Tool to delete an image by its ID. Use when you need to remove an image permanently from the CloudCart store. |
| `CLOUDCART_DELETE_ORDER` | Delete Order | Tool to delete an order. Use after confirming the order exists. |
| `CLOUDCART_DELETE_PRODUCT` | Delete Product | Tool to delete a product by its ID. Use after confirming the product exists to permanently remove it from the catalog. |
| `CLOUDCART_DELETE_PRODUCTS_LINKED_PRODUCTS` | Delete Linked Products | Tool to delete linked product relationships in CloudCart. Use when you need to remove associations between related products. This removes the link but does not delete the products themselves. |
| `CLOUDCART_DELETE_PRODUCT_TO_DISCOUNT` | Delete Product To Discount | Tool to delete a product-to-discount relationship by its ID. Use to remove the association between a product and a discount. |
| `CLOUDCART_DELETE_PROPERTY` | Delete Property | Tool to delete a property by its ID. Use after confirming the correct property ID to permanently remove it from the store. |
| `CLOUDCART_DELETE_PROPERTY_OPTIONS` | Delete Property Options | Tool to delete a property option by its ID. Use when you need to remove obsolete property options or clean up test data. |
| `CLOUDCART_DELETE_REDIRECT` | Delete Redirect | Tool to delete a redirect by its ID. Use this when you need to remove obsolete redirects or clean up redirect rules in the CloudCart store. |
| `CLOUDCART_DELETE_SUBSCRIBER` | Delete Subscriber | Tool to delete a subscriber by their ID. Use when you need to remove a subscriber from the mailing list. |
| `CLOUDCART_DELETE_SUBSCRIBERS_CHANNEL` | Delete Subscribers Channel | Tool to delete a subscriber channel by ID. Use when you need to remove a subscriber channel from the system. The API returns 204 No Content on successful deletion. |
| `CLOUDCART_DELETE_SUBSCRIBERS_TAG` | Delete Subscriber Tag | Tool to delete a subscriber tag by its ID. Use after confirming the tag exists to permanently remove it. |
| `CLOUDCART_DELETE_VARIANT` | Delete Variant | Tool to delete a variant by its ID. Use when you need to permanently remove a product variant from the catalog. |
| `CLOUDCART_DELETE_VARIANT_OPTION` | Delete Variant Option | Tool to delete a variant option by its ID. Use when you need to permanently remove a variant option from a product variant in the CloudCart store. |
| `CLOUDCART_DELETE_VARIANT_PARAMETER` | Delete Variant Parameter | Tool to delete a variant parameter by its ID. Use when you need to permanently remove a variant parameter from the CloudCart store. The API returns 204 No Content on successful deletion. |
| `CLOUDCART_DELETE_VENDOR` | Delete Vendor | Delete a vendor by its ID from the CloudCart store. This operation permanently removes the vendor record. The API returns 204 No Content on successful deletion. Use this tool when you need to remove obsolete vendors, clean up test data, or manage vendor records in your store. |
| `CLOUDCART_DELETE_WEBHOOK` | Delete Webhook | Tool to delete a webhook by its ID from the CloudCart store. Use when you need to remove webhooks that are no longer needed or to clean up webhook subscriptions. |
| `CLOUDCART_GENERATE_DISCOUNT_CODES` | Generate Discount Codes | Tool to generate multiple discount codes with a specified discount percentage. Use when you need to create multiple promotional codes with the same discount value. The discount value is multiplied by 100 (e.g., 1000 = 10%, 2500 = 25%). |
| `CLOUDCART_GET_BLOG_AUTHOR` | Get Blog Author | Tool to retrieve details of a specific blog author by ID. Use when you need information about a blog author. |
| `CLOUDCART_GET_BLOG_CATEGORY` | Get Blog Category | Tool to retrieve details of a specific blog category by ID. Use when you need information about a particular blog category. |
| `CLOUDCART_GET_BLOG_POST` | Get Blog Post | Tool to retrieve a single blog post by its ID. Use when you need detailed information about a specific blog post including title, content, author, publish date, and images. |
| `CLOUDCART_GET_BLOG_TAG` | Get Blog Tag | Tool to retrieve details of a specific blog tag by ID. Use when you need to fetch information about a particular tag. |
| `CLOUDCART_GET_CART` | Get Cart | Tool to retrieve the current shopping cart. Use when you need to view or verify the cart contents before checkout. |
| `CLOUDCART_GET_CATEGORIES` | Get Categories | Tool to retrieve a list of all categories. Use when you need to list available categories for selection. Returns numeric category IDs; use these IDs directly (not names or slugs) when setting categories in other tools like CLOUDCART_CREATE_PRODUCT. |
| `CLOUDCART_GET_CATEGORIES_PROPERTIES` | Get Category Properties | Tool to retrieve properties relationship for a category. Use when you need to get the list of properties assigned to a specific category. |
| `CLOUDCART_GET_CATEGORY` | Get Category | Tool to retrieve details of a specific category by ID. Use when you need information about a single category. |
| `CLOUDCART_GET_CUSTOMER` | Get Customer | Tool to retrieve details of a specific customer by ID. Use when you need information about a single customer. |
| `CLOUDCART_GET_CUSTOMER_BILLING_ADDRESS` | Get Customer Billing Address | Tool to retrieve a specific customer billing address by its ID. Use when you need to fetch details of a particular billing address including country, state, city, street information, and contact details. Optionally include related customer data using the 'include' parameter. |
| `CLOUDCART_GET_CUSTOMER_GROUP` | Get Customer Group | Tool to retrieve details of a specific customer group by ID. Use when you need to fetch information about a particular customer group. |
| `CLOUDCART_GET_CUSTOMER_GROUPS_CUSTOMERS` | Get Customer Groups Customers | Tool to retrieve customers from a specific customer group. Use when you need to list all customers belonging to a particular group. |
| `CLOUDCART_GET_CUSTOMERS` | Get Customers | Tool to retrieve a list of all customers. Use when you need to display or process multiple customer profiles. Note: The response is paginated; use page[number] and page[size] to control pagination. |
| `CLOUDCART_GET_CUSTOMER_SHIPPING_ADDRESS` | Get Customer Shipping Address | Tool to retrieve a single customer shipping address by ID. Use when you need details about a specific shipping address. Optionally include related customer data or filter specific fields to return only needed attributes. |
| `CLOUDCART_GET_CUSTOMER_TAG` | Get Customer Tag | Tool to retrieve details of a specific customer tag. Use when you have the customer tag ID and need to get its details. |
| `CLOUDCART_GET_IMAGE` | Get Image | Tool to retrieve details of a specific image by ID. Use when you need information about a single image including its dimensions, URLs, thumbnails, and related product. |
| `CLOUDCART_GET_ORDERS` | Get Orders | Retrieve a paginated list of orders from your CloudCart store. Returns order details including order ID, status, total amount, currency, and creation/update timestamps. Supports pagination through page[number] (starting from 1) and page[size] (items per page) parameters. Use this action to list all orders, check order statuses, retrieve order histories, or process orders programmatically. The response includes pagination metadata (current page, total orders, total pages) and navigation links for easy pagination handling. |
| `CLOUDCART_GET_PAYMENT_METHODS` | Get Payment Methods | Tool to retrieve all available payment methods. Use when you need to list supported payment options before checkout. |
| `CLOUDCART_GET_PRODUCTS` | Get Products | Tool to retrieve a list of products with optional filters. Use when you need a paginated catalog of products (e.g., by page, category, price range). |
| `CLOUDCART_GET_PRODUCTS_LINKED_PRODUCT` | Get Products Linked Product | Tool to retrieve linked products for a specific product. Use when you need to get related or complementary products that are associated with a main product. |
| `CLOUDCART_GET_PRODUCTS_LINKED_PRODUCTS` | Get Products Linked Products | Tool to retrieve linked products for a specific product. Use when you need to find products that are associated or related to a given product, such as complementary items or product recommendations. |
| `CLOUDCART_GET_PRODUCT_WITH_RELATIONS` | Get Product With Relations | Retrieves detailed information about a specific product including its relationships (category, vendor, variants). Use this action when you need comprehensive product details after obtaining a product ID from the Get Products action. Returns product attributes (name, description, pricing, status) and related entity references. |
| `CLOUDCART_GET_PROPERTY` | Get Property | Tool to retrieve details of a specific property by ID. Use when you need information about a single property. |
| `CLOUDCART_GET_PROPERTY_OPTION` | Get Property Option | Tool to retrieve details of a specific property option by ID. Use when you need information about a single property option. |
| `CLOUDCART_GET_PROPERTY_OPTIONS_RELATIONSHIP` | Get Property Options Relationship | Tool to retrieve property options relationship for a product. Use when you need to fetch which property options are assigned to a product after confirming it exists. |
| `CLOUDCART_GET_SHIPPING_METHODS` | Get Shipping Methods | Tool to retrieve all available shipping methods. Use when you need to list shipping options before checkout. |
| `CLOUDCART_GET_SUBSCRIBER` | Get Subscriber | Tool to retrieve details of a specific subscriber by ID. Use when you need information about a single subscriber including their engagement metrics and subscription details. |
| `CLOUDCART_GET_SUBSCRIBERS_CHANNEL` | Get Subscribers Channel | Tool to retrieve a single subscriber channel by its ID. Use when you need details about a specific subscriber's communication channel. Returns channel information including type, identifier, verification status, and marketing preferences. |
| `CLOUDCART_GET_SUBSCRIBERS_TAG` | Get Subscriber Tag | Tool to retrieve details of a specific subscriber tag by ID. Use when you need to get information about a subscriber tag association. |
| `CLOUDCART_GET_VARIANT` | Get Variant | Tool to retrieve details of a specific variant by ID. Use when you need information about a single product variant. |
| `CLOUDCART_GET_VARIANT_OPTION` | Get Variant Option | Tool to retrieve a specific variant option by its ID. Use when you need details about a particular variant option such as its name, sort order, color, visibility, or associated parameter. |
| `CLOUDCART_GET_VARIANT_PARAMETER` | Get Variant Parameter | Tool to retrieve details of a specific variant parameter by ID. Use when you need information about a single variant parameter. |
| `CLOUDCART_GET_VENDOR` | Get Vendor | Tool to retrieve details of a specific vendor. Use when you have the vendor ID. |
| `CLOUDCART_GET_WEBHOOK` | Get Webhook | Tool to retrieve details of a specific webhook by ID. Use when you need information about a webhook configuration. |
| `CLOUDCART_LIST_BLOG_CATEGORIES` | List Blog Categories | Tool to retrieve all blog categories with optional pagination, sorting, and filtering. Use when you need to list blog categories or get blog category information for content organization. |
| `CLOUDCART_LIST_BLOG_POSTS` | List Blog Posts | Tool to retrieve a list of all blog posts. Use when you need a paginated list of blog posts with optional filtering and sorting. Example: "List recent blog posts on page 1." |
| `CLOUDCART_LIST_BLOG_TAGS` | List Blog Tags | Tool to retrieve all blog tags from CloudCart. Use when you need to list available blog tags for filtering or selection. Supports pagination, sorting, and filtering. |
| `CLOUDCART_LIST_CUSTOMER_BILLING_ADDRESS` | List Customer Billing Addresses | Tool to retrieve a list of all customer billing addresses. Use when you need to access billing address information for customers. The response is paginated; use page[number] and page[size] parameters to control pagination. |
| `CLOUDCART_LIST_CUSTOMER_GROUPS` | List Customer Groups | Tool to retrieve all customer groups. Use when you need to display or process customer group information. The response is paginated; use page[number] and page[size] to control pagination. |
| `CLOUDCART_LIST_CUSTOMER_SHIPPING_ADDRESSES` | List Customer Shipping Addresses | Tool to retrieve a paginated list of customer shipping addresses. Use when you need to list all shipping addresses or filter by customer ID or country. Supports pagination and sorting. |
| `CLOUDCART_LIST_CUSTOMER_TAGS` | List Customer Tags | Tool to retrieve all customer tags. Use when you need to list available tags for customer categorization or filtering. |
| `CLOUDCART_LIST_DISCOUNT_CODES` | List Discount Codes | Tool to retrieve all discount codes from your CloudCart store. Use when you need to list available discount codes, check their status, or manage promotions. |
| `CLOUDCART_LIST_IMAGES` | List Images | Tool to retrieve all images from CloudCart. Use when you need a paginated list of images. |
| `CLOUDCART_LIST_ORDER_BILLING_ADDRESS` | List Order Billing Addresses | Tool to retrieve order billing addresses (read-only). Use when you need to access billing address information associated with orders. The response is paginated; use page[number] and page[size] parameters to control pagination. |
| `CLOUDCART_LIST_ORDER_PAYMENT` | List Order Payments | Retrieve payment information from orders. Since CloudCart API does not have a dedicated payments endpoint, this action fetches orders and extracts payment-related data. Use when you need to view payment status, methods, and amounts for orders. |
| `CLOUDCART_LIST_ORDER_PAYMENT2` | List Order Payment V2 | Tool to retrieve order payment data from the CloudCart order-payment endpoint. Use when you need to access payment transaction details including payment IDs, provider references, amounts, and statuses. |
| `CLOUDCART_LIST_ORDER_PRODUCTS` | List Order Products | Retrieve all order products from your CloudCart store (read-only). Returns order product details including product ID, attributes, and relationships to orders and product options. Supports pagination through page[number] and page[size] parameters. |
| `CLOUDCART_LIST_ORDER_PRODUCTS_OPTIONS` | List Order Products Options | Tool to retrieve order products options (read-only). Use when you need to list custom field options associated with products in orders. |
| `CLOUDCART_LIST_ORDER_SHIPPING` | List Order Shipping | Tool to retrieve order shipping data. Use when you need to list shipping information for orders. |
| `CLOUDCART_LIST_ORDER_SHIPPING_ADDRESS` | List Order Shipping Addresses | Tool to retrieve a paginated list of order shipping addresses. Use when you need to view shipping addresses associated with orders, filter by order ID, or export address data. Supports pagination and sorting. |
| `CLOUDCART_LIST_ORDER_STATUS` | List Order Status | Tool to retrieve all available order statuses from CloudCart. Returns status codes, names, translations, and types (order, payment, or shipping). Use when you need to view available order statuses for filtering orders or displaying status options. |
| `CLOUDCART_LIST_PAYMENT_PROVIDERS` | List Payment Providers | Tool to retrieve all payment providers (read-only). Use when you need to view configured payment providers in the store. |
| `CLOUDCART_LIST_PROPERTIES` | List Properties | Tool to retrieve all properties with optional pagination. Use when you need to list available properties or get property information for product configuration. |
| `CLOUDCART_LIST_PROPERTY_OPTIONS` | List Property Options | Tool to retrieve all property options with optional filtering and pagination. Use when you need to list property options or filter by property ID. |
| `CLOUDCART_LIST_REDIRECTS` | List Redirects | Tool to retrieve all redirects from CloudCart. Use when you need to view URL redirects configured in the store. |
| `CLOUDCART_LIST_SHIPPING_PROVIDERS` | List Shipping Providers | Tool to retrieve all shipping providers (read-only). Use when you need to view configured shipping providers in the store. |
| `CLOUDCART_LIST_SUBSCRIBERS` | List Subscribers | Tool to retrieve all subscribers from the store. Use when you need to display or process subscriber information with engagement metrics like open rates and click rates. |
| `CLOUDCART_LIST_SUBSCRIBERS_CHANNELS` | List Subscribers Channels | Tool to retrieve all subscriber channels. Use when you need to list available channels for subscriber management or filtering. |
| `CLOUDCART_LIST_SUBSCRIBERS_TAGS` | List Subscribers Tags | Tool to retrieve all subscriber tags. Use when you need to list tag associations for subscribers with flexible organization through customizable labeling. Supports pagination, filtering, and sorting. |
| `CLOUDCART_LIST_VARIANT_OPTIONS` | List Variant Options | Tool to retrieve all variant options. Use when you need to list available variant options with optional pagination. |
| `CLOUDCART_LIST_VARIANT_PARAMETERS` | List Variant Parameters | Tool to retrieve all variant parameters with pagination support. Use when you need to list product variant configuration options like size, color, or other custom attributes. |
| `CLOUDCART_LIST_VARIANTS` | List Variants | Tool to retrieve all product variants with optional pagination and filtering. Use when you need to list variants across products or filter by specific item ID or SKU. |
| `CLOUDCART_LIST_VENDORS` | List Vendors | Tool to retrieve a list of all vendors. Use when you need a paginated list of vendors or filter by name/status. Example: "List active vendors on page 2." |
| `CLOUDCART_LIST_WEBHOOKS` | List Webhooks | Tool to retrieve all webhooks. Use when you need to view configured webhooks, check webhook events, or manage webhook subscriptions. |
| `CLOUDCART_REMOVE_FROM_CART` | Remove from Cart | Tool to remove an item from the cart. Use after confirming the product exists in the cart to delete it. |
| `CLOUDCART_UPDATE_BLOG_CATEGORY` | Update Blog Category | Tool to update an existing blog category. Use when you need to modify blog category details such as name, SEO settings, or image. |
| `CLOUDCART_UPDATE_BLOG_POST` | Update Blog Post | Tool to update an existing blog post. Use when you need to modify the title or content of a blog post. Requires the blog post ID and at least one field to update (name or content). |
| `CLOUDCART_UPDATE_BLOG_TAG` | Update Blog Tag | Tool to update an existing blog tag. Use when you need to modify a blog tag's name or label. |
| `CLOUDCART_UPDATE_CART_ITEM` | Update Cart Item | Tool to update the quantity of an item in the cart. Use when you need to adjust item quantities in the cart before checkout. |
| `CLOUDCART_UPDATE_CATEGORY` | Update Category | Tool to update an existing category. Use when you need to modify category details after reviewing its current values. |
| `CLOUDCART_UPDATE_CUSTOMER` | Update Customer | Updates an existing customer's information in CloudCart. You can modify customer details such as first name, last name, email, password, and alternative phone number. All update fields are optional - only provide the fields you want to update. |
| `CLOUDCART_UPDATE_CUSTOMER_BILLING_ADDRESS` | Update Customer Billing Address | Tool to update an existing customer billing address in CloudCart. Use when you need to modify billing address details such as phone, location, or contact information. All update fields are optional - only provide the fields you want to update. |
| `CLOUDCART_UPDATE_CUSTOMER_GROUP` | Update Customer Group | Tool to update an existing customer group's name. Use when you need to modify a customer group's details after reviewing its current values. |
| `CLOUDCART_UPDATE_CUSTOMER_SHIPPING_ADDRESS` | Update Customer Shipping Address | Tool to update an existing customer shipping address in CloudCart. Use when you need to modify address details such as phone, name, or location fields. All update fields are optional - only provide the fields you want to change. |
| `CLOUDCART_UPDATE_CUSTOMER_TAG` | Update Customer Tag | Tool to update an existing customer tag in CloudCart. Use when you need to rename or modify a customer tag's label. |
| `CLOUDCART_UPDATE_DISCOUNT_CODE` | Update Discount Code | Tool to update an existing discount code in CloudCart. Use when you need to modify discount code properties such as the code value, discount amount, or activation status. At least one optional field must be provided to perform an update. |
| `CLOUDCART_UPDATE_LINKED_PRODUCT` | Update Linked Product | Updates linked product relationships for a specific product in CloudCart. This replaces all existing linked products with the provided list. Use when you need to establish product recommendations or cross-sell relationships. The two_way parameter controls bidirectional linking. |
| `CLOUDCART_UPDATE_ORDER` | Update Order | Tool to update an existing order. Use when you need to modify order details after creation (e.g., change status or addresses). Provide only the fields you wish to change. |
| `CLOUDCART_UPDATE_PRODUCT` | Update Product | Updates an existing product in CloudCart. Provide the product_id and at least one field to update. Returns updated product details. For variant-based products, price and stock are managed at the variant level and will return 0 in the response. Use GET_PRODUCTS or GET_PRODUCT_WITH_RELATIONS to retrieve current product details first. |
| `CLOUDCART_UPDATE_PROPERTY` | Update Property | Tool to update an existing property. Use when you need to modify property details such as display type, name, or visibility settings. |
| `CLOUDCART_UPDATE_PROPERTY_OPTION` | Update Property Option | Tool to update an existing property option. Use when you need to modify an option value of a product property (e.g., changing "Red" to "Crimson Red" in a "Color" property). |
| `CLOUDCART_UPDATE_SUBSCRIBER` | Update Subscriber | Tool to update an existing subscriber in CloudCart. Use when you need to modify subscriber details like first name, last name, or country code. Provide the subscriber ID and the updated attributes. |
| `CLOUDCART_UPDATE_SUBSCRIBERS_CHANNEL` | Update Subscribers Channel | Tool to update an existing subscriber channel in CloudCart. Use when you need to modify a subscriber's communication channel details such as contact information, marketing preferences, or verification status. All update fields are optional - only provide the fields you want to update. |
| `CLOUDCART_UPDATE_SUBSCRIBER_TAG` | Update Subscriber Tag | Tool to update an existing subscriber tag association in CloudCart. Use when you need to modify which subscriber or tag is associated in a subscribers-tags relationship. |
| `CLOUDCART_UPDATE_VARIANT` | Update Variant | Tool to update an existing product variant. Use when you need to modify variant details such as quantity, price, SKU, or other attributes. |
| `CLOUDCART_UPDATE_VARIANT_OPTION` | Update Variant Option | Tool to update an existing variant option. Use when you need to modify a variant option's name, sort order, color, or visibility. |
| `CLOUDCART_UPDATE_VARIANT_PARAMETER` | Update Variant Parameter | Tool to update an existing variant parameter for a product variant. Use when you need to modify attributes like display_type, name, sort order, or visibility. |
| `CLOUDCART_UPDATE_VENDOR` | Update Vendor | Updates an existing vendor's information in CloudCart. Use this to modify a vendor's name or image URL. You can update one or both fields. Requires a valid vendor ID - obtain this from Create Vendor or List Vendors actions first. This is a partial update (PATCH) operation, so you only need to provide the fields you want to change. |
| `CLOUDCART_UPDATE_WEBHOOK` | Update Webhook | Tool to update an existing webhook configuration in CloudCart. Use when you need to modify the webhook URL or custom request headers for webhook notifications. At least one optional field (url or request_headers) must be provided. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Cloudcart MCP server is an implementation of the Model Context Protocol that connects your AI agent to Cloudcart. It provides structured and secure access so your agent can perform Cloudcart operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before you begin, make sure you have:
- Python 3.8/Node 16 or higher installed
- A Composio account with the API key
- An OpenAI API key
- A Cloudcart account and project
- Basic familiarity with async Python/Typescript

### 1. Getting API Keys for OpenAI, Composio, and Cloudcart

No description provided.

### 2. Installing dependencies

No description provided.
```python
pip install composio-llamaindex llama-index llama-index-llms-openai llama-index-tools-mcp python-dotenv
```

```typescript
npm install @composio/llamaindex @llamaindex/openai @llamaindex/tools @llamaindex/workflow dotenv
```

### 3. Set environment variables

Create a .env file in your project root:
These credentials will be used to:
- Authenticate with OpenAI's GPT-5 model
- Connect to Composio's Tool Router
- Identify your Composio user session for Cloudcart access
```bash
OPENAI_API_KEY=your-openai-api-key
COMPOSIO_API_KEY=your-composio-api-key
COMPOSIO_USER_ID=your-user-id
```

### 4. Import modules

No description provided.
```python
import asyncio
import os
import dotenv

from composio import Composio
from composio_llamaindex import LlamaIndexProvider
from llama_index.core.agent.workflow import ReActAgent
from llama_index.core.workflow import Context
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

dotenv.load_dotenv()
```

```typescript
import "dotenv/config";
import readline from "node:readline/promises";
import { stdin as input, stdout as output } from "node:process";

import { Composio } from "@composio/core";

import { mcp } from "@llamaindex/tools";
import { agent as createAgent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";

dotenv.config();
```

### 5. Load environment variables and initialize Composio

No description provided.
```python
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not OPENAI_API_KEY:
    raise ValueError("OPENAI_API_KEY is not set in the environment")
if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set in the environment")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set in the environment")
```

```typescript
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const COMPOSIO_API_KEY = process.env.COMPOSIO_API_KEY;
const COMPOSIO_USER_ID = process.env.COMPOSIO_USER_ID;

if (!OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!COMPOSIO_API_KEY) throw new Error("COMPOSIO_API_KEY is not set");
if (!COMPOSIO_USER_ID) throw new Error("COMPOSIO_USER_ID is not set");
```

### 6. Create a Tool Router session and build the agent function

What's happening here:
- We create a Composio client using your API key and configure it with the LlamaIndex provider
- We then create a tool router MCP session for your user, specifying the toolkits we want to use (in this case, cloudcart)
- The session returns an MCP HTTP endpoint URL that acts as a gateway to all your configured tools
- LlamaIndex will connect to this endpoint to dynamically discover and use the available Cloudcart tools.
- The MCP tools are mapped to LlamaIndex-compatible tools and plug them into the Agent.
```python
async def build_agent() -> ReActAgent:
    composio_client = Composio(
        api_key=COMPOSIO_API_KEY,
        provider=LlamaIndexProvider(),
    )

    session = composio_client.create(
        user_id=COMPOSIO_USER_ID,
        toolkits=["cloudcart"],
    )

    mcp_url = session.mcp.url
    print(f"Composio MCP URL: {mcp_url}")

    mcp_client = BasicMCPClient(mcp_url, headers={"x-api-key": COMPOSIO_API_KEY})
    mcp_tool_spec = McpToolSpec(client=mcp_client)
    tools = await mcp_tool_spec.to_tool_list_async()

    llm = OpenAI(model="gpt-5")

    description = "An agent that uses Composio Tool Router MCP tools to perform Cloudcart actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Cloudcart actions.
    """
    return ReActAgent(tools=tools, llm=llm, description=description, system_prompt=system_prompt, verbose=True)
```

```typescript
async function buildAgent() {

  console.log(`Initializing Composio client...${COMPOSIO_USER_ID!}...`);
  console.log(`COMPOSIO_USER_ID: ${COMPOSIO_USER_ID!}...`);

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

  const session = await composio.create(
    COMPOSIO_USER_ID!,
    {
      toolkits: ["cloudcart"],
    },
  );

  const mcpUrl = session.mcp.url;
  console.log(`Composio Tool Router MCP URL: ${mcpUrl}`);

  const server = mcp({
    url: mcpUrl,
    clientName: "composio_tool_router_with_llamaindex",
    requestInit: {
      headers: {
        "x-api-key": COMPOSIO_API_KEY!,
      },
    },
    // verbose: true,
  });

  const tools = await server.tools();

  const llm = openai({ apiKey: OPENAI_API_KEY, model: "gpt-5" });

  const agent = createAgent({
    name: "composio_tool_router_with_llamaindex",
        description : "An agent that uses Composio Tool Router MCP tools to perform actions.",
    systemPrompt:
      "You are a helpful assistant connected to Composio Tool Router."+
"Use the available tools to answer user queries and perform Cloudcart actions." ,
    llm,
    tools,
  });

  return agent;
}
```

### 7. Create an interactive chat loop

No description provided.
```python
async def chat_loop(agent: ReActAgent) -> None:
    ctx = Context(agent)
    print("Type 'quit', 'exit', or Ctrl+C to stop.")

    while True:
        try:
            user_input = input("\nYou: ").strip()
        except (KeyboardInterrupt, EOFError):
            print("\nBye!")
            break

        if not user_input or user_input.lower() in {"quit", "exit"}:
            print("Bye!")
            break

        try:
            print("Agent: ", end="", flush=True)
            handler = agent.run(user_input, ctx=ctx)

            async for event in handler.stream_events():
                # Stream token-by-token from LLM responses
                if hasattr(event, "delta") and event.delta:
                    print(event.delta, end="", flush=True)
                # Show tool calls as they happen
                elif hasattr(event, "tool_name"):
                    print(f"\n[Using tool: {event.tool_name}]", flush=True)

            # Get final response
            response = await handler
            print()  # Newline after streaming
        except KeyboardInterrupt:
            print("\n[Interrupted]")
            continue
        except Exception as e:
            print(f"\nError: {e}")
```

```typescript
async function chatLoop(agent: ReturnType<typeof createAgent>) {
  const rl = readline.createInterface({ input, output });

  console.log("Type 'quit' or 'exit' to stop.");

  while (true) {
    let userInput: string;

    try {
      userInput = (await rl.question("\nYou: ")).trim();
    } catch {
      console.log("\nAgent: Bye!");
      break;
    }

    if (!userInput) {
      continue;
    }

    const lower = userInput.toLowerCase();
    if (lower === "quit" || lower === "exit") {
      console.log("Agent: Bye!");
      break;
    }

    try {
      process.stdout.write("Agent: ");

      const stream = agent.runStream(userInput);
      let finalResult: any = null;

      for await (const event of stream) {
        // The event.data contains the streamed content
        const data: any = event.data;

        // Check for streaming delta content
        if (data?.delta) {
          process.stdout.write(data.delta);
        }

        // Store final result for fallback
        if (data?.result || data?.message) {
          finalResult = data;
        }
      }

      // If no streaming happened, show the final result
      if (finalResult) {
        const answer =
          finalResult.result ??
          finalResult.message?.content ??
          finalResult.message ??
          "";
        if (answer && typeof answer === "string" && !answer.includes("[object")) {
          process.stdout.write(answer);
        }
      }

      console.log(); // New line after streaming completes
    } catch (err: any) {
      console.error("\nAgent error:", err?.message ?? err);
    }
  }

  rl.close();
}
```

### 8. Define the main entry point

What's happening here:
- We're orchestrating the entire application flow
- The agent gets built with proper error handling
- Then we kick off the interactive chat loop so you can start talking to Cloudcart
```python
async def main() -> None:
    agent = await build_agent()
    await chat_loop(agent)

if __name__ == "__main__":
    # Handle Ctrl+C gracefully
    signal.signal(signal.SIGINT, lambda s, f: (print("\nBye!"), exit(0)))
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\nBye!")
```

```typescript
async function main() {
  try {
    const agent = await buildAgent();
    await chatLoop(agent);
  } catch (err) {
    console.error("Failed to start agent:", err);
    process.exit(1);
  }
}

main();
```

### 9. Run the agent

When prompted, authenticate and authorise your agent with Cloudcart, then start asking questions.
```bash
python llamaindex_agent.py
```

```typescript
npx ts-node llamaindex-agent.ts
```

## Complete Code

```python
import asyncio
import os
import signal
import dotenv

from composio import Composio
from composio_llamaindex import LlamaIndexProvider
from llama_index.core.agent.workflow import ReActAgent
from llama_index.core.workflow import Context
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

dotenv.load_dotenv()

OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not OPENAI_API_KEY:
    raise ValueError("OPENAI_API_KEY is not set")
if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set")

async def build_agent() -> ReActAgent:
    composio_client = Composio(
        api_key=COMPOSIO_API_KEY,
        provider=LlamaIndexProvider(),
    )

    session = composio_client.create(
        user_id=COMPOSIO_USER_ID,
        toolkits=["cloudcart"],
    )

    mcp_url = session.mcp.url
    print(f"Composio MCP URL: {mcp_url}")

    mcp_client = BasicMCPClient(mcp_url, headers={"x-api-key": COMPOSIO_API_KEY})
    mcp_tool_spec = McpToolSpec(client=mcp_client)
    tools = await mcp_tool_spec.to_tool_list_async()

    llm = OpenAI(model="gpt-5")
    description = "An agent that uses Composio Tool Router MCP tools to perform Cloudcart actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Cloudcart actions.
    """
    return ReActAgent(
        tools=tools,
        llm=llm,
        description=description,
        system_prompt=system_prompt,
        verbose=True,
    );

async def chat_loop(agent: ReActAgent) -> None:
    ctx = Context(agent)
    print("Type 'quit', 'exit', or Ctrl+C to stop.")

    while True:
        try:
            user_input = input("\nYou: ").strip()
        except (KeyboardInterrupt, EOFError):
            print("\nBye!")
            break

        if not user_input or user_input.lower() in {"quit", "exit"}:
            print("Bye!")
            break

        try:
            print("Agent: ", end="", flush=True)
            handler = agent.run(user_input, ctx=ctx)

            async for event in handler.stream_events():
                # Stream token-by-token from LLM responses
                if hasattr(event, "delta") and event.delta:
                    print(event.delta, end="", flush=True)
                # Show tool calls as they happen
                elif hasattr(event, "tool_name"):
                    print(f"\n[Using tool: {event.tool_name}]", flush=True)

            # Get final response
            response = await handler
            print()  # Newline after streaming
        except KeyboardInterrupt:
            print("\n[Interrupted]")
            continue
        except Exception as e:
            print(f"\nError: {e}")

async def main() -> None:
    agent = await build_agent()
    await chat_loop(agent)

if __name__ == "__main__":
    # Handle Ctrl+C gracefully
    signal.signal(signal.SIGINT, lambda s, f: (print("\nBye!"), exit(0)))
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\nBye!")
```

```typescript
import "dotenv/config";
import readline from "node:readline/promises";
import { stdin as input, stdout as output } from "node:process";

import { Composio } from "@composio/core";
import { LlamaindexProvider } from "@composio/llamaindex";

import { mcp } from "@llamaindex/tools";
import { agent as createAgent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";

dotenv.config();

const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const COMPOSIO_API_KEY = process.env.COMPOSIO_API_KEY;
const COMPOSIO_USER_ID = process.env.COMPOSIO_USER_ID;

if (!OPENAI_API_KEY) {
    throw new Error("OPENAI_API_KEY is not set in the environment");
  }
if (!COMPOSIO_API_KEY) {
    throw new Error("COMPOSIO_API_KEY is not set in the environment");
  }
if (!COMPOSIO_USER_ID) {
    throw new Error("COMPOSIO_USER_ID is not set in the environment");
  }

async function buildAgent() {

  console.log(`Initializing Composio client...${COMPOSIO_USER_ID!}...`);
  console.log(`COMPOSIO_USER_ID: ${COMPOSIO_USER_ID!}...`);

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

  const session = await composio.create(
    COMPOSIO_USER_ID!,
    {
      toolkits: ["cloudcart"],
    },
  );

  const mcpUrl = session.mcp.url;
  console.log(`Composio Tool Router MCP URL: ${mcpUrl}`);

  const server = mcp({
    url: mcpUrl,
    clientName: "composio_tool_router_with_llamaindex",
    requestInit: {
      headers: {
        "x-api-key": COMPOSIO_API_KEY!,
      },
    },
    // verbose: true,
  });

  const tools = await server.tools();

  const llm = openai({ apiKey: OPENAI_API_KEY, model: "gpt-5" });

  const agent = createAgent({
    name: "composio_tool_router_with_llamaindex",
    description:
      "An agent that uses Composio Tool Router MCP tools to perform actions.",
    systemPrompt:
      "You are a helpful assistant connected to Composio Tool Router."+
"Use the available tools to answer user queries and perform Cloudcart actions." ,
    llm,
    tools,
  });

  return agent;
}

async function chatLoop(agent: ReturnType<typeof createAgent>) {
  const rl = readline.createInterface({ input, output });

  console.log("Type 'quit' or 'exit' to stop.");

  while (true) {
    let userInput: string;

    try {
      userInput = (await rl.question("\nYou: ")).trim();
    } catch {
      console.log("\nAgent: Bye!");
      break;
    }

    if (!userInput) {
      continue;
    }

    const lower = userInput.toLowerCase();
    if (lower === "quit" || lower === "exit") {
      console.log("Agent: Bye!");
      break;
    }

    try {
      process.stdout.write("Agent: ");

      const stream = agent.runStream(userInput);
      let finalResult: any = null;

      for await (const event of stream) {
        // The event.data contains the streamed content
        const data: any = event.data;

        // Check for streaming delta content
        if (data?.delta) {
          process.stdout.write(data.delta);
        }

        // Store final result for fallback
        if (data?.result || data?.message) {
          finalResult = data;
        }
      }

      // If no streaming happened, show the final result
      if (finalResult) {
        const answer =
          finalResult.result ??
          finalResult.message?.content ??
          finalResult.message ??
          "";
        if (answer && typeof answer === "string" && !answer.includes("[object")) {
          process.stdout.write(answer);
        }
      }

      console.log(); // New line after streaming completes
    } catch (err: any) {
      console.error("\nAgent error:", err?.message ?? err);
    }
  }

  rl.close();
}

async function main() {
  try {
    const agent = await buildAgent();
    await chatLoop(agent);
  } catch (err: any) {
    console.error("Failed to start agent:", err?.message ?? err);
    process.exit(1);
  }
}

main();
```

## Conclusion

You've successfully connected Cloudcart to LlamaIndex through Composio's Tool Router MCP layer.
Key takeaways:
- Tool Router dynamically exposes Cloudcart tools through an MCP endpoint
- LlamaIndex's ReActAgent handles reasoning and orchestration; Composio handles integrations
- The agent becomes more capable without increasing prompt size
- Async Python provides clean, efficient execution of agent workflows
You can easily extend this to other toolkits like Gmail, Notion, Stripe, GitHub, and more by adding them to the toolkits parameter.

## How to build Cloudcart MCP Agent with another framework

- [OpenAI Agents SDK](https://composio.dev/toolkits/cloudcart/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/cloudcart/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/cloudcart/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/cloudcart/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/cloudcart/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/cloudcart/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/cloudcart/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/cloudcart/framework/cli)
- [Google ADK](https://composio.dev/toolkits/cloudcart/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/cloudcart/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/cloudcart/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/cloudcart/framework/mastra-ai)
- [CrewAI](https://composio.dev/toolkits/cloudcart/framework/crew-ai)

## Related Toolkits

- [Addresszen](https://composio.dev/toolkits/addresszen) - Addresszen is a real-time address autocomplete and verification service. It helps capture accurate, deliverable addresses with instant suggestions and validation.
- [Asin data api](https://composio.dev/toolkits/asin_data_api) - Asin data api gives you detailed, real-time product data from Amazon, including price, rank, and reviews. Perfect for e-commerce pros and data-driven marketers who need instant marketplace insights.
- [Baselinker](https://composio.dev/toolkits/baselinker) - BaseLinker is an all-in-one e-commerce management platform connecting stores, marketplaces, carriers, and more. It streamlines order processing, inventory control, and automates your sales operations.
- [Bestbuy](https://composio.dev/toolkits/bestbuy) - Best Buy is a leading retailer offering APIs for product, store, and recommendation data. Instantly access up-to-date retail insights for smarter shopping and decision-making.
- [Btcpay server](https://composio.dev/toolkits/btcpay_server) - BTCPay Server is a free, open-source, self-hosted Bitcoin payment processor. It lets merchants accept Bitcoin payments directly, cutting out middlemen and boosting privacy.
- [Cdr platform](https://composio.dev/toolkits/cdr_platform) - Cdr platform is an API for purchasing carbon dioxide removal services. It enables businesses to offset emissions by accessing verified carbon removal projects.
- [Countdown api](https://composio.dev/toolkits/countdown_api) - Countdown API gives you real-time, structured eBay product data, reviews, and seller feedback. Perfect for powering price monitoring, product research, or marketplace analytics workflows.
- [Dpd2](https://composio.dev/toolkits/dpd2) - Dpd2 is a robust email management platform for handling, sorting, and automating email workflows. Streamline your communications and boost productivity with advanced sorting, labeling, and response tools.
- [Finerworks](https://composio.dev/toolkits/finerworks) - FinerWorks is an online platform for fine art and photo printing services. Artists and photographers use it to order custom prints and manage print inventory efficiently.
- [Fingertip](https://composio.dev/toolkits/fingertip) - Fingertip is a business management platform for selling, booking, and customer engagement—all from a single link. It helps businesses streamline operations and connect with customers across social channels.
- [Fraudlabs pro](https://composio.dev/toolkits/fraudlabs_pro) - FraudLabs Pro is an online payment fraud detection service for e-commerce and merchants. It helps minimize chargebacks and revenue loss by detecting and preventing fraudulent transactions.
- [Gift up](https://composio.dev/toolkits/gift_up) - Gift Up! is a digital platform for selling, managing, and redeeming gift cards online. It streamlines promotions and gift card transactions for businesses and their customers.
- [Goody](https://composio.dev/toolkits/goody) - Goody is a gifting platform that lets users send gifts and physical products without handling logistics. It streamlines gifting by managing delivery, fulfillment, and recipient experience.
- [Gumroad](https://composio.dev/toolkits/gumroad) - Gumroad is a platform for selling digital products, physical goods, and memberships with a simple checkout and marketing tools. It streamlines creator payouts and helps you grow your audience effortlessly.
- [Instacart](https://composio.dev/toolkits/instacart) - Instacart is an online grocery delivery and pickup service platform. It lets you discover local retailers and create shoppable lists and recipes with ease.
- [Junglescout](https://composio.dev/toolkits/junglescout) - Junglescout is an Amazon product research and analytics platform for sellers. It delivers sales estimates, competitive insights, and optimization tools to boost your Amazon business.
- [Ko fi](https://composio.dev/toolkits/ko_fi) - Ko-fi is a platform that lets creators receive donations, memberships, and sales from fans. It helps creators monetize their work and grow their audience with minimal friction.
- [Lemon squeezy](https://composio.dev/toolkits/lemon_squeezy) - Lemon Squeezy is a payments and subscription platform built for software companies. It makes managing payments, taxes, and customer subscriptions effortless.
- [Loyverse](https://composio.dev/toolkits/loyverse) - Loyverse is a point-of-sale (POS) platform for small businesses, offering tools for sales, inventory, and customer loyalty. It helps streamline retail operations and boost customer engagement.
- [Memberstack](https://composio.dev/toolkits/memberstack) - Memberstack lets you add user authentication, payments, and member management to your website—no backend code required. Easily manage your site's members and subscriptions from a single platform.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Cloudcart MCP?

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

### Can I use Tool Router MCP with LlamaIndex?

Yes, you can. LlamaIndex 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 Cloudcart tools.

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

Yes, absolutely. You can configure which Cloudcart 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 Cloudcart data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
