# How to integrate Zoho inventory MCP with OpenAI Agents SDK

```json
{
  "title": "How to integrate Zoho inventory MCP with OpenAI Agents SDK",
  "toolkit": "Zoho inventory",
  "toolkit_slug": "zoho_inventory",
  "framework": "OpenAI Agents SDK",
  "framework_slug": "open-ai-agents-sdk",
  "url": "https://composio.dev/toolkits/zoho_inventory/framework/open-ai-agents-sdk",
  "markdown_url": "https://composio.dev/toolkits/zoho_inventory/framework/open-ai-agents-sdk.md",
  "updated_at": "2026-05-12T10:31:26.751Z"
}
```

## Introduction

This guide walks you through connecting Zoho inventory to the OpenAI Agents SDK using the Composio tool router. By the end, you'll have a working Zoho inventory agent that can check current stock for a specific item, list all pending sales orders today, create a new purchase order for supplier through natural language commands.
This guide will help you understand how to give your OpenAI Agents SDK agent real control over a Zoho inventory account through Composio's Zoho inventory MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Zoho inventory with

- [ChatGPT](https://composio.dev/toolkits/zoho_inventory/framework/chatgpt)
- [Claude Agent SDK](https://composio.dev/toolkits/zoho_inventory/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/zoho_inventory/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/zoho_inventory/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/zoho_inventory/framework/codex)
- [Cursor](https://composio.dev/toolkits/zoho_inventory/framework/cursor)
- [VS Code](https://composio.dev/toolkits/zoho_inventory/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/zoho_inventory/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/zoho_inventory/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/zoho_inventory/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/zoho_inventory/framework/cli)
- [Google ADK](https://composio.dev/toolkits/zoho_inventory/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/zoho_inventory/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/zoho_inventory/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/zoho_inventory/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/zoho_inventory/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/zoho_inventory/framework/crew-ai)

## TL;DR

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

## What is OpenAI Agents SDK?

The OpenAI Agents SDK is a lightweight framework for building AI agents that can use tools and maintain conversation state. It provides a simple interface for creating agents with hosted MCP tool support.
Key features include:
- Hosted MCP Tools: Connect to external services through hosted MCP endpoints
- SQLite Sessions: Persist conversation history across interactions
- Simple API: Clean interface with Agent, Runner, and tool configuration
- Streaming Support: Real-time response streaming for interactive applications

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

The Zoho inventory MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Zoho Inventory account. It provides structured and secure access to your inventory management system, so your agent can perform actions like tracking stock levels, managing sales and purchase orders, updating product details, and syncing inventory across sales channels on your behalf.
- Real-time stock tracking and updates: Let your agent monitor inventory levels, adjust quantities, and receive alerts when items are running low or out of stock.
- Order management automation: Have the agent create, update, or track sales and purchase orders, making it easy to keep tabs on every transaction.
- Product catalog management: Direct your agent to add new products, update existing details, or manage pricing and SKU information to keep your catalog current and accurate.
- Multi-channel inventory syncing: Enable your agent to synchronize inventory data across multiple online stores and marketplaces, ensuring consistency and reducing errors.
- Shipment and fulfillment handling: Empower your agent to generate shipment orders, track deliveries, and manage warehouse operations for streamlined fulfillment.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `ZOHO_INVENTORY_ADD_CREDIT_NOTE_COMMENT` | Add Credit Note Comment | Tool to add a comment to a credit note in Zoho Inventory. Use when needing to add notes or comments to a specific credit note for record-keeping or audit purposes. |
| `ZOHO_INVENTORY_ADD_INVOICE_ATTACHMENT` | Add Invoice Attachment | Tool to upload an attachment to a specific invoice. Use when you need to add a file attachment to an invoice. |
| `ZOHO_INVENTORY_ADD_INVOICE_COMMENT` | Add Invoice Comment | Tool to add a comment to a specific invoice in Zoho Inventory. Use when you need to add notes, updates, or internal/client-visible comments to an invoice. |
| `ZOHO_INVENTORY_APPLY_CREDITS_TO_INVOICES` | Apply Credits To Invoices | Tool to apply credits from a credit note to one or more invoices. Use when you need to apply available credits from a credit note to settle invoice balances. |
| `ZOHO_INVENTORY_BULK_DELETE_SALES_ORDERS` | Bulk Delete Sales Orders | Tool to bulk delete sales orders. Use this to remove multiple sales orders at once. |
| `ZOHO_INVENTORY_BULK_EMAIL_INVOICES` | Bulk Email Invoices | Sends multiple invoices by email to a contact in a single API call. Use this tool when you need to email up to 10 invoices at once to a customer. The invoices will be scheduled for delivery and the contact will receive individual emails for each invoice. If contact_id is not provided, the action will automatically fetch the customer_id from the first invoice and use that as the contact. |
| `ZOHO_INVENTORY_BULK_EXPORT_INVOICES` | Bulk Export Invoices | Tool to bulk export invoices as a single PDF. Use when you need to download multiple invoices in a single file for archiving or sharing. |
| `ZOHO_INVENTORY_BULK_PRINT_INVOICES` | Bulk Print Invoices | Generate a consolidated PDF containing multiple invoices for printing or archiving. Use this tool to download one or more invoices as a single PDF document. The PDF can contain up to 25 invoices and is useful for bulk printing, record keeping, or sharing with customers. |
| `ZOHO_INVENTORY_BULK_PRINT_PACKAGES` | Bulk Print Packages | Tool to bulk print package slips as a consolidated PDF. Use when you need a PDF file of multiple package slips for printing or archiving. |
| `ZOHO_INVENTORY_CANCEL_INVOICE_WRITE_OFF` | Cancel Invoice Write Off | Tool to cancel write off for an invoice. Use when undoing a previously applied write off on an invoice after verifying the invoice has a write off applied. |
| `ZOHO_INVENTORY_CREATE_BILL` | Create Bill | Tool to create a bill in Zoho Inventory. Use when a vendor supplies goods/services on credit and you need to track the amount owed. |
| `ZOHO_INVENTORY_CREATE_CONTACT` | Create Contact | Tool to create a new contact (customer or vendor) in Zoho Inventory. Use when you need to add a new business relationship to your organization. |
| `ZOHO_INVENTORY_CREATE_CONTACT_PERSON` | Create Contact Person | Tool to create a contact person. Use when you need to add a new contact person to an existing contact in Zoho Inventory. |
| `ZOHO_INVENTORY_CREATE_CREDIT_NOTE` | Create Credit Note | Tool to create a new credit note in Zoho Inventory. Use when you need to issue a credit note to a customer for returns, refunds, or adjustments. |
| `ZOHO_INVENTORY_CREATE_CUSTOMER_PAYMENT` | Create Customer Payment | Tool to create a customer payment in Zoho Inventory. Use when recording a payment received from a customer against one or more invoices. |
| `ZOHO_INVENTORY_CREATE_INVOICE` | Create Invoice | Tool to create a new invoice in Zoho Inventory. Use when you need to invoice a customer for products or services sold. |
| `ZOHO_INVENTORY_CREATE_ITEM` | Create Item | Tool to create a new item in Zoho Inventory. Use when you need to add a new product or service to your inventory catalog. |
| `ZOHO_INVENTORY_CREATE_ITEM_GROUP` | Create Item Group | Tool to create an item group in Zoho Inventory. Use when you need to create a new item group with multiple items that share common attributes like size or color variations. |
| `ZOHO_INVENTORY_CREATE_PACKAGE` | Create Package | Tool to create a package for a sales order in Zoho Inventory. Use when you need to prepare items from a sales order for shipping. |
| `ZOHO_INVENTORY_CREATE_PURCHASE_ORDER` | Create Purchase Order | Tool to create a purchase order in Zoho Inventory. Use when you need to order goods or services from a vendor. |
| `ZOHO_INVENTORY_CREATE_SALES_ORDER` | Create Sales Order | Tool to create a sales order in Zoho Inventory. Use when a customer places an order for products and you need to track the sale before invoicing. |
| `ZOHO_INVENTORY_DEACTIVATE_CONTACT` | Deactivate Contact | Tool to mark a contact as inactive in Zoho Inventory. Use when you need to deactivate a contact without permanently deleting it. |
| `ZOHO_INVENTORY_DEACTIVATE_ITEM` | Deactivate Item | Tool to mark an item as inactive in Zoho Inventory. Use when you need to deactivate an item without permanently deleting it. |
| `ZOHO_INVENTORY_DEACTIVATE_ITEM_GROUP` | Deactivate Item Group | Tool to mark an item group as inactive in Zoho Inventory. Use when you need to deactivate an item group and all its items without permanently deleting them. |
| `ZOHO_INVENTORY_DELETE_COMPOSITE_ITEM` | Delete Composite Item | Permanently deletes a composite item from Zoho Inventory. A composite item (also known as a bundle or kit) is a product made up of multiple individual inventory items sold together as a single unit. This action removes the composite item definition but does not affect the underlying component items. Prerequisites: - Composite items feature must be enabled in the organization's item preferences - The composite item must exist and not be associated with active transactions Common error codes: - 2006: Resource does not exist (invalid composite_item_id) - 2054: Composite items feature not enabled in organization settings API Endpoint: DELETE /inventory/v1/compositeitems/{composite_item_id} |
| `ZOHO_INVENTORY_DELETE_CONTACT` | Delete Contact | Tool to delete a contact. Use when you need to remove an existing contact from your organization after confirming it is no longer needed. |
| `ZOHO_INVENTORY_DELETE_CONTACT_PERSON` | Delete Contact Person | Tool to delete a contact person. Use when you need to remove a contact person from your organization after confirming it is no longer needed. |
| `ZOHO_INVENTORY_DELETE_INVOICE` | Delete Invoice | Tool to delete an invoice. Use when you need to remove an existing invoice that has no payments or credits applied. |
| `ZOHO_INVENTORY_DELETE_INVOICE_ATTACHMENT` | Delete Invoice Attachment | Tool to delete an invoice attachment. Use when you need to remove a file attached to an invoice. |
| `ZOHO_INVENTORY_DELETE_INVOICE_COMMENT` | Delete Invoice Comment | Delete a specific comment from an invoice in Zoho Inventory. Zoho API: DELETE /inventory/v1/invoices/{invoice_id}/comments/{comment_id} Required query param: organization_id Auth header format: Authorization: Zoho-oauthtoken |
| `ZOHO_INVENTORY_DELETE_ITEM` | Delete Item | Tool to delete an item. Use when you need to remove an existing inventory item after confirming it is not referenced in any transactions. |
| `ZOHO_INVENTORY_DELETE_ITEM_GROUP` | Delete Item Group | Tool to delete an item group. Use to remove an existing item group that is no longer needed. |
| `ZOHO_INVENTORY_DELETE_ITEM_IMAGE` | Delete Item Image | Tool to delete an image associated with an item. Use when you need to remove an item's image after ensuring it's no longer required. |
| `ZOHO_INVENTORY_DELETE_PACKAGE` | Delete Package | Tool to delete a package. Use when you need to remove an existing package created for a sales order. |
| `ZOHO_INVENTORY_DELETE_SALES_ORDER` | Delete Sales Order | Tool to delete a sales order. Use when you need to remove an existing sales order. |
| `ZOHO_INVENTORY_DISABLE_PAYMENT_REMINDER` | Disable Payment Reminder | Tool to disable payment reminders for an invoice. Use when you want to stop automatic payment reminders for an invoice after it has been issued. |
| `ZOHO_INVENTORY_EMAIL_CONTACT` | Email Contact | Tool to email a contact in Zoho Inventory. Use when you need to send an email to a specific contact with a custom subject and body. |
| `ZOHO_INVENTORY_EMAIL_CONTACT_STATEMENT` | Email Contact Statement | Tool to email a statement of transactions to a contact. Use when you need to send account statements to customers or vendors. |
| `ZOHO_INVENTORY_EMAIL_CREDIT_NOTE` | Email Credit Note | Tool to email a credit note to customers. Use when you need to send a credit note via email to recipients. |
| `ZOHO_INVENTORY_EMAIL_INVOICE` | Email Invoice | Tool to email a specific invoice to customers. Use when you need to send an invoice via email, with optional attachments. |
| `ZOHO_INVENTORY_ENABLE_INVOICE_PAYMENT_REMINDER` | Enable Invoice Payment Reminder | Tool to enable payment reminders for an invoice. Use when you want to activate automatic payment reminders for an invoice after it has been issued. |
| `ZOHO_INVENTORY_GET_CONTACT` | Get Contact | Tool to retrieve a specific contact by ID from Zoho Inventory. Use when you need to get detailed information about a customer or vendor contact. |
| `ZOHO_INVENTORY_GET_CONTACT_ADDRESS` | Get Contact Address | Tool to get contact address. Use when you need to retrieve address information for a specific contact. |
| `ZOHO_INVENTORY_GET_CREDIT_NOTE` | Get Credit Note | Tool to retrieve a credit note by ID. Use when you need to fetch detailed information about a specific credit note. |
| `ZOHO_INVENTORY_GET_CREDIT_NOTE_EMAIL_CONTENT` | Get Credit Note Email Content | Tool to get credit note email content including subject, body, recipients, and available templates. Use when you need to preview or retrieve the email content for a credit note before sending it. |
| `ZOHO_INVENTORY_GET_CURRENT_USER` | Get Current User | Tool to get details of the currently authenticated user in Zoho Inventory. Use when you need to retrieve user profile information, permissions, or validate the authenticated user. |
| `ZOHO_INVENTORY_GET_SALES_ORDER` | Get Sales Order | Tool to retrieve the details of an existing sales order. Use when you need to get complete information about a sales order including line items, customer details, shipping information, and order status. |
| `ZOHO_INVENTORY_LIST_BILLS` | List Bills | Tool to list bills. Use when needing to fetch bills for an organization. |
| `ZOHO_INVENTORY_LIST_CONTACTS` | List Contacts | Tool to list all contacts (customers and vendors) in Zoho Inventory. Use when needing to fetch contacts for an organization. |
| `ZOHO_INVENTORY_LIST_CREDIT_NOTES` | List Credit Notes | Tool to list all credit notes. Use when needing to fetch credit notes for an organization. Supports filtering by status, customer, date, and other criteria. |
| `ZOHO_INVENTORY_LIST_CURRENCIES` | List Currencies | Tool to list all currencies configured in Zoho Inventory. Use when you need to retrieve available currencies, exchange rates, or identify the base currency for an organization. |
| `ZOHO_INVENTORY_LIST_INVOICE_PAYMENTS` | List Invoice Payments | Tool to list all payments received for a specific invoice. Use when you need to retrieve payment records for an invoice. |
| `ZOHO_INVENTORY_LIST_INVOICES` | List Invoices | Tool to list all invoices in Zoho Inventory. Use when you need to retrieve invoices for an organization. |
| `ZOHO_INVENTORY_LIST_ITEM_GROUPS` | List Item Groups | Tool to list all item groups in Zoho Inventory. Use when needing to fetch item groups for an organization. Item groups allow grouping of related items with variations. |
| `ZOHO_INVENTORY_LIST_ITEMS` | List Items | Tool to list all items in Zoho Inventory. Use when you need to retrieve inventory items for an organization. |
| `ZOHO_INVENTORY_LIST_ORGANIZATIONS` | List Organizations | Tool to list all organizations the user has access to in Zoho Inventory. Use when you need to get organization IDs or view available organizations. This action does not require organization_id as a parameter. |
| `ZOHO_INVENTORY_LIST_PURCHASE_ORDERS` | List Purchase Orders | Tool to list purchase orders. Use when needing to fetch purchase orders for an organization. |
| `ZOHO_INVENTORY_LIST_SALES_ORDERS` | List Sales Orders | Tool to list sales orders. Use when needing to fetch sales orders for an organization. |

## Supported Triggers

None listed.

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

The Zoho inventory MCP server is an implementation of the Model Context Protocol that connects your AI agent to Zoho inventory. It provides structured and secure access so your agent can perform Zoho inventory 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 starting, make sure you have:
- Composio API Key and OpenAI API Key
- Primary know-how of OpenAI Agents SDK
- A live Zoho inventory project
- Some knowledge of Python or Typescript

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

OpenAI API Key
- Go to the [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys) 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](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Go to Settings and copy your API key.

### 2. Install dependencies

Install the Composio SDK and the OpenAI Agents SDK.
```python
pip install composio_openai_agents openai-agents python-dotenv
```

```typescript
npm install @composio/openai-agents @openai/agents dotenv
```

### 3. Set up environment variables

Create a .env file and add your OpenAI and Composio API keys.
```bash
OPENAI_API_KEY=sk-...your-api-key
COMPOSIO_API_KEY=your-api-key
USER_ID=composio_user@gmail.com
```

### 4. Import dependencies

What's happening:
- You're importing all necessary libraries.
- The Composio and OpenAIAgentsProvider classes are imported to connect your OpenAI agent to Composio tools like Zoho inventory.
```python
import asyncio
import os
from dotenv import load_dotenv

from composio import Composio
from composio_openai_agents import OpenAIAgentsProvider
from agents import Agent, Runner, HostedMCPTool, SQLiteSession
```

```typescript
import 'dotenv/config';
import { Composio } from '@composio/core';
import { OpenAIAgentsProvider } from '@composio/openai-agents';
import { Agent, hostedMcpTool, run, OpenAIConversationsSession } from '@openai/agents';
import * as readline from 'readline';
```

### 5. Set up the Composio instance

No description provided.
```python
load_dotenv()

api_key = os.getenv("COMPOSIO_API_KEY")
user_id = os.getenv("USER_ID")

if not api_key:
    raise RuntimeError("COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key")

# Initialize Composio
composio = Composio(api_key=api_key, provider=OpenAIAgentsProvider())
```

```typescript
dotenv.config();

const composioApiKey = process.env.COMPOSIO_API_KEY;
const userId = process.env.USER_ID;

if (!composioApiKey) {
  throw new Error('COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key');
}
if (!userId) {
  throw new Error('USER_ID is not set');
}

// Initialize Composio
const composio = new Composio({
  apiKey: composioApiKey,
  provider: new OpenAIAgentsProvider(),
});
```

### 6. Create a Tool Router session

What is happening:
- You give the Tool Router the user id and the toolkits you want available. Here, it is only zoho_inventory.
- The router checks the user's Zoho inventory connection and prepares the MCP endpoint.
- The returned session.mcp.url is the MCP URL that your agent will use to access Zoho inventory.
- This approach keeps things lightweight and lets the agent request Zoho inventory tools only when needed during the conversation.
```python
# Create a Zoho inventory Tool Router session
session = composio.create(
    user_id=user_id,
    toolkits=["zoho_inventory"]
)

mcp_url = session.mcp.url
```

```typescript
// Create Tool Router session for Zoho inventory
const session = await composio.create(userId as string, {
  toolkits: ['zoho_inventory'],
});
const mcpUrl = session.mcp.url;
```

### 7. Configure the agent

No description provided.
```python
# Configure agent with MCP tool
agent = Agent(
    name="Assistant",
    model="gpt-5",
    instructions=(
        "You are a helpful assistant that can access Zoho inventory. "
        "Help users perform Zoho inventory operations through natural language."
    ),
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "tool_router",
                "server_url": mcp_url,
                "headers": {"x-api-key": api_key},
                "require_approval": "never",
            }
        )
    ],
)
```

```typescript
// Configure agent with MCP tool
const agent = new Agent({
  name: 'Assistant',
  model: 'gpt-5',
  instructions:
    'You are a helpful assistant that can access Zoho inventory. Help users perform Zoho inventory operations through natural language.',
  tools: [
    hostedMcpTool({
      serverLabel: 'tool_router',
      serverUrl: mcpUrl,
      headers: { 'x-api-key': composioApiKey },
      requireApproval: 'never',
    }),
  ],
});
```

### 8. Start chat loop and handle conversation

No description provided.
```python
print("\nComposio Tool Router session created.")

chat_session = SQLiteSession("conversation_openai_toolrouter")

print("\nChat started. Type your requests below.")
print("Commands: 'exit', 'quit', or 'q' to end\n")

async def main():
    try:
        result = await Runner.run(
            agent,
            "What can you help me with?",
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")
    except Exception as e:
        print(f"Error: {e}\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "q"}:
            print("Goodbye!")
            break

        result = await Runner.run(
            agent,
            user_input,
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")

asyncio.run(main())
```

```typescript
// Keep conversation state across turns
const conversationSession = new OpenAIConversationsSession();

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

console.log('\nComposio Tool Router session created.');
console.log('\nChat started. Type your requests below.');
console.log("Commands: 'exit', 'quit', or 'q' to end\n");

try {
  const first = await run(agent, 'What can you help me with?', { session: conversationSession });
  console.log(`Assistant: ${first.finalOutput}\n`);
} catch (e) {
  console.error('Error:', e instanceof Error ? e.message : e, '\n');
}

rl.prompt();

rl.on('line', async (userInput) => {
  const text = userInput.trim();

  if (['exit', 'quit', 'q'].includes(text.toLowerCase())) {
    console.log('Goodbye!');
    rl.close();
    process.exit(0);
  }

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

  try {
    const result = await run(agent, text, { session: conversationSession });
    console.log(`\nAssistant: ${result.finalOutput}\n`);
  } catch (e) {
    console.error('Error:', e instanceof Error ? e.message : e, '\n');
  }

  rl.prompt();
});

rl.on('close', () => {
  console.log('\n👋 Session ended.');
  process.exit(0);
});
```

## Complete Code

```python
import asyncio
import os
from dotenv import load_dotenv

from composio import Composio
from composio_openai_agents import OpenAIAgentsProvider
from agents import Agent, Runner, HostedMCPTool, SQLiteSession

load_dotenv()

api_key = os.getenv("COMPOSIO_API_KEY")
user_id = os.getenv("USER_ID")

if not api_key:
    raise RuntimeError("COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key")

# Initialize Composio
composio = Composio(api_key=api_key, provider=OpenAIAgentsProvider())

# Create Tool Router session
session = composio.create(
    user_id=user_id,
    toolkits=["zoho_inventory"]
)
mcp_url = session.mcp.url

# Configure agent with MCP tool
agent = Agent(
    name="Assistant",
    model="gpt-5",
    instructions=(
        "You are a helpful assistant that can access Zoho inventory. "
        "Help users perform Zoho inventory operations through natural language."
    ),
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "tool_router",
                "server_url": mcp_url,
                "headers": {"x-api-key": api_key},
                "require_approval": "never",
            }
        )
    ],
)

print("\nComposio Tool Router session created.")

chat_session = SQLiteSession("conversation_openai_toolrouter")

print("\nChat started. Type your requests below.")
print("Commands: 'exit', 'quit', or 'q' to end\n")

async def main():
    try:
        result = await Runner.run(
            agent,
            "What can you help me with?",
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")
    except Exception as e:
        print(f"Error: {e}\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "q"}:
            print("Goodbye!")
            break

        result = await Runner.run(
            agent,
            user_input,
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")

asyncio.run(main())
```

```typescript
import 'dotenv/config';
import { Composio } from '@composio/core';
import { OpenAIAgentsProvider } from '@composio/openai-agents';
import { Agent, hostedMcpTool, run, OpenAIConversationsSession } from '@openai/agents';
import * as readline from 'readline';

const composioApiKey = process.env.COMPOSIO_API_KEY;
const userId = process.env.USER_ID;

if (!composioApiKey) {
  throw new Error('COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key');
}
if (!userId) {
  throw new Error('USER_ID is not set');
}

// Initialize Composio
const composio = new Composio({
  apiKey: composioApiKey,
  provider: new OpenAIAgentsProvider(),
});

async function main() {
  // Create Tool Router session
  const session = await composio.create(userId as string, {
    toolkits: ['zoho_inventory'],
  });
  const mcpUrl = session.mcp.url;

  // Configure agent with MCP tool
  const agent = new Agent({
    name: 'Assistant',
    model: 'gpt-5',
    instructions:
      'You are a helpful assistant that can access Zoho inventory. Help users perform Zoho inventory operations through natural language.',
    tools: [
      hostedMcpTool({
        serverLabel: 'tool_router',
        serverUrl: mcpUrl,
        headers: { 'x-api-key': composioApiKey },
        requireApproval: 'never',
      }),
    ],
  });

  // Keep conversation state across turns
  const conversationSession = new OpenAIConversationsSession();

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

  console.log('\nComposio Tool Router session created.');
  console.log('\nChat started. Type your requests below.');
  console.log("Commands: 'exit', 'quit', or 'q' to end\n");

  try {
    const first = await run(agent, 'What can you help me with?', { session: conversationSession });
    console.log(`Assistant: ${first.finalOutput}\n`);
  } catch (e) {
    console.error('Error:', e instanceof Error ? e.message : e, '\n');
  }

  rl.prompt();

  rl.on('line', async (userInput) => {
    const text = userInput.trim();

    if (['exit', 'quit', 'q'].includes(text.toLowerCase())) {
      console.log('Goodbye!');
      rl.close();
      process.exit(0);
    }

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

    try {
      const result = await run(agent, text, { session: conversationSession });
      console.log(`\nAssistant: ${result.finalOutput}\n`);
    } catch (e) {
      console.error('Error:', e instanceof Error ? e.message : e, '\n');
    }

    rl.prompt();
  });

  rl.on('close', () => {
    console.log('\nSession ended.');
    process.exit(0);
  });
}

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

## Conclusion

This was a starter code for integrating Zoho inventory MCP with OpenAI Agents SDK to build a functional AI agent that can interact with Zoho inventory.
Key features:
- Hosted MCP tool integration through Composio's Tool Router
- SQLite session persistence for conversation history
- Simple async chat loop for interactive testing
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

## How to build Zoho inventory MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/zoho_inventory/framework/chatgpt)
- [Claude Agent SDK](https://composio.dev/toolkits/zoho_inventory/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/zoho_inventory/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/zoho_inventory/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/zoho_inventory/framework/codex)
- [Cursor](https://composio.dev/toolkits/zoho_inventory/framework/cursor)
- [VS Code](https://composio.dev/toolkits/zoho_inventory/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/zoho_inventory/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/zoho_inventory/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/zoho_inventory/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/zoho_inventory/framework/cli)
- [Google ADK](https://composio.dev/toolkits/zoho_inventory/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/zoho_inventory/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/zoho_inventory/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/zoho_inventory/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/zoho_inventory/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/zoho_inventory/framework/crew-ai)

## Related Toolkits

- [Stripe](https://composio.dev/toolkits/stripe) - Stripe is a global online payments platform offering APIs for managing payments, customers, and subscriptions. Trusted by businesses for secure, efficient, and scalable payment processing worldwide.
- [Alpha vantage](https://composio.dev/toolkits/alpha_vantage) - Alpha Vantage is a financial data platform offering real-time and historical stock market APIs. Get instant, reliable access to equities, forex, and technical analysis data for smarter trading decisions.
- [Altoviz](https://composio.dev/toolkits/altoviz) - Altoviz is a cloud-based billing and invoicing platform for businesses. It streamlines online payments, expense tracking, and customizable invoice management.
- [Benzinga](https://composio.dev/toolkits/benzinga) - Benzinga provides real-time financial news and data APIs for market coverage. It helps you track breaking news and actionable market insights instantly.
- [Chaser](https://composio.dev/toolkits/chaser) - Chaser is accounts receivable automation software that sends invoice reminders and helps businesses get paid faster. It streamlines the collections process to save time and improve cash flow.
- [Clientary](https://composio.dev/toolkits/clientary) - Clientary is a platform for managing clients, invoices, projects, proposals, and more. It streamlines client work and saves you serious admin time.
- [Coinbase](https://composio.dev/toolkits/coinbase) - Coinbase is a platform for buying, selling, and storing cryptocurrency. It makes exchanging and managing crypto simple and secure for everyone.
- [Coinranking](https://composio.dev/toolkits/coinranking) - Coinranking is a comprehensive cryptocurrency market data platform offering access to real-time coin prices, market caps, and historical data. Get accurate, up-to-date stats for thousands of digital assets in one place.
- [Coupa](https://composio.dev/toolkits/coupa) - Coupa is a business spend management platform for procurement, invoicing, and expenses. It helps organizations streamline purchasing, control costs, and gain complete visibility over financial operations.
- [CurrencyScoop](https://composio.dev/toolkits/currencyscoop) - CurrencyScoop is a developer-friendly API for real-time and historical currency exchange rates. Easily access fiat and crypto data for smart, up-to-date financial applications.
- [Daffy](https://composio.dev/toolkits/daffy) - Daffy is a modern charitable giving platform with a donor-advised fund. Easily set aside funds, grow them tax-free, and donate to over 1.7 million U.S. charities.
- [Eagle doc](https://composio.dev/toolkits/eagle_doc) - Eagle doc is an AI-powered OCR API for invoices and receipts. It delivers fast, reliable, and accurate document data extraction for seamless automation.
- [Eodhd apis](https://composio.dev/toolkits/eodhd_apis) - Eodhd apis delivers comprehensive financial data, including live and historical stock prices, via robust APIs. Easily access reliable, up-to-date market insights to power your apps, dashboards, and analytics.
- [Fidel api](https://composio.dev/toolkits/fidel_api) - Fidel api is a secure platform for linking payment cards to web and mobile apps. It enables real-time card transaction monitoring and event-based automation for businesses.
- [Finage](https://composio.dev/toolkits/finage) - Finage is a secure API platform delivering real-time and historical financial data for stocks, forex, crypto, indices, and commodities. It empowers developers and businesses to access, analyze, and act on market data instantly.
- [Finmei](https://composio.dev/toolkits/finmei) - Finmei is an invoicing tool that simplifies billing, invoice management, and expense tracking. Ideal for automating and organizing your business finances in one place.
- [Fixer](https://composio.dev/toolkits/fixer) - Fixer is a currency data API offering real-time and historical exchange rates for 170 currencies. Instantly access accurate, up-to-date forex data for your applications and workflows.
- [Fixer io](https://composio.dev/toolkits/fixer_io) - Fixer.io is a lightweight API for real-time and historical foreign exchange rates. It makes global currency conversion fast, accurate, and hassle-free.
- [Flutterwave](https://composio.dev/toolkits/flutterwave) - Flutterwave is a global payments platform enabling businesses to accept and send payments across Africa and beyond. Its robust APIs simplify cross-border transactions and financial operations.
- [Freeagent](https://composio.dev/toolkits/freeagent) - Freeagent is a cloud-based accounting platform designed for freelancers and small businesses. It simplifies bookkeeping, invoicing, and expense management in one place.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Zoho inventory MCP?

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

### Can I use Tool Router MCP with OpenAI Agents SDK?

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

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

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

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