How to integrate Zoho invoice MCP with CrewAI

This guide walks you through connecting Zoho invoice to CrewAI using the Composio tool router. By the end, you'll have a working Zoho invoice agent that can list all unpaid invoices from last month, show expenses categorized by project for may, find payments received from a specific client through natural language commands. This guide will help you understand how to give your CrewAI agent real control over a Zoho invoice account through Composio's Zoho invoice MCP server. Before we dive in, let's take a quick look at the key ideas and tools involved.

Zoho invoice logoZoho invoice
Oauth2

Zoho Invoice is an online invoicing and billing platform for freelancers and small businesses. It streamlines professional invoice creation, recurring payments, and expense tracking.

137 Tools

Introduction

This guide walks you through connecting Zoho invoice to CrewAI using the Composio tool router. By the end, you'll have a working Zoho invoice agent that can list all unpaid invoices from last month, show expenses categorized by project for may, find payments received from a specific client through natural language commands.

This guide will help you understand how to give your CrewAI agent real control over a Zoho invoice account through Composio's Zoho invoice MCP server.

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

Also integrate Zoho invoice with

TL;DR

Here's what you'll learn:
  • Get a Composio API key and configure your Zoho invoice connection
  • Set up CrewAI with an MCP enabled agent
  • Create a Tool Router session or standalone MCP server for Zoho invoice
  • Build a conversational loop where your agent can execute Zoho invoice operations

What is CrewAI?

CrewAI is a powerful framework for building multi-agent AI systems. It provides primitives for defining agents with specific roles, creating tasks, and orchestrating workflows through crews.

Key features include:

  • Agent Roles: Define specialized agents with specific goals and backstories
  • Task Management: Create tasks with clear descriptions and expected outputs
  • Crew Orchestration: Combine agents and tasks into collaborative workflows
  • MCP Integration: Connect to external tools through Model Context Protocol

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

The Zoho invoice 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 Invoice account. It provides structured and secure access to your invoicing, billing, and expense data, so your agent can perform actions like listing invoices, fetching payments, retrieving contacts, and managing expenses on your behalf.

  • Comprehensive invoice management: Let your agent list and review all invoices, making it easy to track billing history, filter by status, or check for outstanding payments.
  • Automated expense tracking: Have your agent retrieve and organize expense records, helping you monitor spending and simplify bookkeeping.
  • Contact catalog access: Quickly pull a list of clients, vendors, or customers from your Zoho Invoice account to streamline outreach and relationship management.
  • Real-time payment tracking: Direct your agent to list all payments, filter by customer or date range, and ensure nothing falls through the cracks.
  • Itemized inventory insights: Fetch detailed item catalogs or retrieve specific item details to keep your invoicing accurate and up to date.

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

What is Composio SDK?

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

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

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

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

Step-by-step Guide

Step by step08 STEPS
1

Prerequisites

Before starting, make sure you have:
  • Python 3.9 or higher
  • A Composio account and API key
  • A Zoho invoice connection authorized in Composio
  • An OpenAI API key for the CrewAI LLM
  • Basic familiarity with Python
2

Getting API Keys for OpenAI and Composio

OpenAI API Key
  • Go to the OpenAI dashboard and create an API key. You'll need credits to use the models, or you can connect to another model provider.
  • Keep the API key safe.
Composio API Key
  • Log in to the Composio dashboard.
  • Navigate to your API settings and generate a new API key.
  • Store this key securely as you'll need it for authentication.
3

Install dependencies

bash
pip install composio crewai crewai-tools[mcp] python-dotenv
What's happening:
  • composio connects your agent to Zoho invoice via MCP
  • crewai provides Agent, Task, Crew, and LLM primitives
  • crewai-tools[mcp] includes MCP helpers
  • python-dotenv loads environment variables from .env
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key_here

Create a .env file in your project root.

What's happening:

  • COMPOSIO_API_KEY authenticates with Composio
  • USER_ID scopes the session to your account
  • OPENAI_API_KEY lets CrewAI use your chosen OpenAI model
5

Import dependencies

python
import os
from composio import Composio
from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter
import dotenv

dotenv.load_dotenv()

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

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")
What's happening:
  • CrewAI classes define agents and tasks, and run the workflow
  • MCPServerHTTP connects the agent to an MCP endpoint
  • Composio will give you a short lived Zoho invoice MCP URL
6

Create a Composio Tool Router session for Zoho invoice

python
composio_client = Composio(api_key=COMPOSIO_API_KEY)
session = composio_client.create(user_id=COMPOSIO_USER_ID, toolkits=["zoho_invoice"])

url = session.mcp.url
What's happening:
  • You create a Zoho invoice only session through Composio
  • Composio returns an MCP HTTP URL that exposes Zoho invoice tools
7

Initialize the MCP Server

python
server_params = {
    "url": url,
    "transport": "streamable-http",
    "headers": {"x-api-key": COMPOSIO_API_KEY},
}

with MCPServerAdapter(server_params) as tools:
    agent = Agent(
        role="Search Assistant",
        goal="Help users search the internet effectively",
        backstory="You are a helpful assistant with access to search tools.",
        tools=tools,
        verbose=False,
        max_iter=10,
    )
What's Happening:
  • Server Configuration: The code sets up connection parameters including the MCP server URL, streamable HTTP transport, and Composio API key authentication.
  • MCP Adapter Bridge: MCPServerAdapter acts as a context manager that converts Composio MCP tools into a CrewAI-compatible format.
  • Agent Setup: Creates a CrewAI Agent with a defined role (Search Assistant), goal (help with internet searches), and access to the MCP tools.
  • Configuration Options: The agent includes settings like verbose=False for clean output and max_iter=10 to prevent infinite loops.
  • Dynamic Tool Usage: Once created, the agent automatically accesses all Composio Search tools and decides when to use them based on user queries.
8

Create a CLI Chatloop and define the Crew

python
print("Chat started! Type 'exit' or 'quit' to end.\n")

conversation_context = ""

while True:
    user_input = input("You: ").strip()

    if user_input.lower() in ["exit", "quit", "bye"]:
        print("\nGoodbye!")
        break

    if not user_input:
        continue

    conversation_context += f"\nUser: {user_input}\n"
    print("\nAgent is thinking...\n")

    task = Task(
        description=(
            f"Conversation history:\n{conversation_context}\n\n"
            f"Current request: {user_input}"
        ),
        expected_output="A helpful response addressing the user's request",
        agent=agent,
    )

    crew = Crew(agents=[agent], tasks=[task], verbose=False)
    result = crew.kickoff()
    response = str(result)

    conversation_context += f"Agent: {response}\n"
    print(f"Agent: {response}\n")
What's Happening:
  • Interactive CLI Setup: The code creates an infinite loop that continuously prompts for user input and maintains the entire conversation history in a string variable.
  • Input Validation: Empty inputs are ignored to prevent processing blank messages and keep the conversation clean.
  • Context Building: Each user message is appended to the conversation context, which preserves the full dialogue history for better agent responses.
  • Dynamic Task Creation: For every user input, a new Task is created that includes both the full conversation history and the current request as context.
  • Crew Execution: A Crew is instantiated with the agent and task, then kicked off to process the request and generate a response.
  • Response Management: The agent's response is converted to a string, added to the conversation context, and displayed to the user, maintaining conversational continuity.

Complete Code

Here's the complete code to get you started with Zoho invoice and CrewAI:

python
from crewai import Agent, Task, Crew, LLM
from crewai_tools import MCPServerAdapter
from composio import Composio
from dotenv import load_dotenv
import os

load_dotenv()

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

if not GOOGLE_API_KEY:
    raise ValueError("GOOGLE_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.")

# Initialize Composio and create a session
composio = Composio(api_key=COMPOSIO_API_KEY)
session = composio.create(
    user_id=COMPOSIO_USER_ID,
    toolkits=["zoho_invoice"],
)
url = session.mcp.url

# Configure LLM
llm = LLM(
    model="gpt-5",
    api_key=os.getenv("OPENAI_API_KEY"),
)

server_params = {
    "url": url,
    "transport": "streamable-http",
    "headers": {"x-api-key": COMPOSIO_API_KEY},
}

with MCPServerAdapter(server_params) as tools:
    agent = Agent(
        role="Search Assistant",
        goal="Help users with internet searches",
        backstory="You are an expert assistant with access to Composio Search tools.",
        tools=tools,
        llm=llm,
        verbose=False,
        max_iter=10,
    )

    print("Chat started! Type 'exit' or 'quit' to end.\n")

    conversation_context = ""

    while True:
        user_input = input("You: ").strip()

        if user_input.lower() in ["exit", "quit", "bye"]:
            print("\nGoodbye!")
            break

        if not user_input:
            continue

        conversation_context += f"\nUser: {user_input}\n"
        print("\nAgent is thinking...\n")

        task = Task(
            description=(
                f"Conversation history:\n{conversation_context}\n\n"
                f"Current request: {user_input}"
            ),
            expected_output="A helpful response addressing the user's request",
            agent=agent,
        )

        crew = Crew(agents=[agent], tasks=[task], verbose=False)
        result = crew.kickoff()
        response = str(result)

        conversation_context += f"Agent: {response}\n"
        print(f"Agent: {response}\n")

Conclusion

You now have a CrewAI agent connected to Zoho invoice through Composio's Tool Router. The agent can perform Zoho invoice operations through natural language commands.

Next steps:

  • Add role-specific instructions to customize agent behavior
  • Plug in more toolkits for multi-app workflows
  • Chain tasks for complex multi-step operations
TOOLS

Supported Tools

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

Add Credit Note to Invoices

Tool to apply a credit note to one or more invoices.

Add Invoice Comment

Tool to add a comment to an invoice.

Apply Credits to Invoice

Tool to apply credit notes to an invoice in Zoho Invoice.

Cancel Write Off Invoice

Tool to cancel a write-off on an invoice.

Clone Zoho Invoice Project

Tool to clone an existing project.

Create Additional Address

Tool to add an additional address to a contact.

Create Contact

Tool to create a contact in Zoho Invoice.

Create Contact Person

Tool to create a contact person for an existing contact.

Create Credit Note

Tool to create a credit note to refund or give credit to a customer.

Create Credit Note Comment

Tool to add a comment to a credit note.

Create Currency

Tool to create a new currency in Zoho Invoice.

Create Customer Payment

Tool to create a customer payment in Zoho Invoice.

Create Employee

Tool to create an employee in Zoho Invoice.

Create Estimate

Tool to create a new estimate (quote) for a customer.

Create Estimate Comment

Tool to add a comment to an estimate.

Create Exchange Rate

Tool to create an exchange rate for a specified currency.

Create Expense Category

Tool to create a new expense category in Zoho Invoice.

Create Invoice

Tool to create a new invoice for a customer in Zoho Invoice.

Create Item

Tool to create a new item in Zoho Invoice.

Create Project Comment

Tool to post a comment to a project.

Create Recurring Invoice

Tool to create a recurring invoice profile that automatically generates invoices at specified intervals.

Create Refund Credit Note Refunds

Tool to create a refund for a credit note.

Create Task

Tool to create a new task in a Zoho Invoice project.

Create Tax

Tool to create a new tax in Zoho Invoice.

Create Tax Group

Tool to create a new tax group in Zoho Invoice.

Create Time Entry

Tool to log time entries for projects in Zoho Invoice.

Create Zoho Invoice User

Tool to create a new user in Zoho Invoice.

Delete Additional Address

Tool to delete an additional address from a contact.

Delete Contact

Tool to delete a contact from Zoho Invoice.

Delete Contact Person

Tool to delete a contact person from Zoho Invoice.

Delete Credit Notes Applied to Invoice

Tool to delete invoices credited from a credit note.

Delete Currency

Tool to delete a currency from Zoho Invoice settings.

Delete Customer Payment

Tool to delete an existing payment from Zoho Invoice.

Delete Employee

Tool to delete an employee from Zoho Invoice.

Delete Estimate Comment

Tool to delete a comment from an estimate.

Delete Estimates

Tool to delete one or more estimates (quotes).

Delete Expense

Tool to delete an expense from Zoho Invoice.

Delete Expense Category

Tool to delete an expense category from Zoho Invoice.

Delete Invoice

Tool to delete an existing invoice from Zoho Invoice.

Delete Invoice Attachment

Tool to delete an attachment from an invoice.

Delete Invoice Comment

Tool to delete a comment from an invoice.

Delete Invoice Expense Receipt

Tool to delete the receipt attached to an expense in Zoho Invoice.

Delete Item

Tool to delete an existing item from Zoho Invoice.

Delete Project

Tool to delete a project from Zoho Invoice.

Delete Project Comment

Tool to delete a comment from a project.

Delete Tax

Tool to delete a simple or compound tax from Zoho Invoice settings.

Delete Task

Tool to delete a task from a Zoho Invoice project.

Delete Time Entry

Tool to delete a time entry from Zoho Invoice.

Delete User

Tool to delete a user from Zoho Invoice.

Disable Contact Payment Reminders

Tool to disable payment reminders for a contact.

Disable Invoice Payment Reminder

Tool to disable payment reminders for an invoice.

Email Contact Statement

Tool to email a statement to a contact in Zoho Invoice.

Email Estimate

Tool to email an estimate to a customer.

Email Invoice

Tool to email an invoice to customers.

Email Multiple Estimates

Tool to send estimates via email to customers in bulk.

Enable Invoice Payment Reminder

Tool to enable payment reminders for an invoice.

Enable Payment Reminders

Tool to enable payment reminders for a contact.

Enable Portal Access

Tool to enable portal access for contact persons in Zoho Invoice.

Bulk Export Invoices

Tool to bulk export multiple invoices as a single PDF file.

Get All Tasks

Tool to list all tasks in a Zoho Invoice project.

Get Client Review

Tool to retrieve details of a particular client review by comment ID.

Get Contact

Tool to retrieve a specific contact by ID.

Get Contact Addresses

Tool to retrieve all addresses for a contact.

Get Contact Person

Tool to retrieve details of a specific contact person.

Get Credit Note

Tool to retrieve the details of a specific credit note by creditnote_id.

Get Credit Note Email History

Tool to retrieve email history for a credit note.

Get Credit Note Refund

Tool to retrieve details of a specific credit note refund.

Get Expense

Tool to retrieve a specific expense by ID.

Get Invoice

Tool to retrieve the details of a specific invoice by invoice_id.

Get Invoice Attachment

Tool to get invoice attachment details.

Get Invoice Email Content

Tool to retrieve the email content for a specific invoice.

Get Zoho Invoice Item

Tool to retrieve the details of a specific item by item_id.

Get Payment Reminder Mail Content

Tool to retrieve payment reminder mail content for a specific invoice.

Get Price List

Tool to retrieve the details of a specific price list by pricebook_id.

Get Project

Tool to retrieve details of a specific project by project ID.

Get Project User

Tool to retrieve a specific user from a project.

Get Recurring Invoice

Tool to retrieve the details of a specific recurring invoice by recurring_invoice_id.

Get Statement Mail Content

Tool to retrieve statement mail content for a specific contact.

Get Task

Tool to retrieve a specific task from a Zoho Invoice project.

Get Tax

Tool to retrieve details of a specific tax by tax_id.

Get Tax Group

Tool to retrieve a specific tax group by ID.

Get Time Entry

Tool to retrieve a specific time entry from Zoho Invoice.

Inactivate Project

Tool to deactivate a project in Zoho Invoice.

List Child Expenses Created

Tool to list child expenses created from a recurring expense.

List Client Reviews

Tool to retrieve all client reviews for contacts.

List Contact Comments

Tool to list all comments on a contact.

List Contact Refunds

Tool to list refunds associated with a contact.

List Contacts

Tool to list contacts.

List Credit Notes

Tool to list credit notes.

List Currencies

Tool to list all currencies configured for the organization.

List Customer Payment Refunds

Tool to list refunds of a customer payment.

List Employees

Tool to list all employees in the organization.

List Estimates

Tool to list all estimates.

List Expense Categories

Tool to list all expense categories with optional filtering, sorting, and pagination.

List Expense Comments

Tool to list expense history and comments.

List Expenses

List all expenses with optional filtering, sorting, and pagination.

List Invoice Comments

Tool to list all comments and history for an invoice.

List Invoice Payments

Tool to list payments for a specific invoice.

List Invoices

Tool to list invoices.

List Invoices Credited

Tool to list invoices to which a specific credit note has been applied.

List Items

Tool to list all items.

List Organizations

Tool to list all organizations.

List Payments

Tool to list payments.

List Price Lists

Tool to list all price lists.

List Project Comments

Tool to list all comments for a project.

List Project Invoices

Tool to list all invoices for a specific project.

List Projects

Tool to list all projects.

List Project Users

Tool to list all users assigned to a specific project.

List Recurring Invoices

Tool to list recurring invoices.

List Retainer Invoices

Tool to list retainer invoices.

List Retainer Invoice Templates

Tool to list retainer invoice templates.

List Users

Tool to list users in a Zoho Invoice organization.

Mark Contact as Active

Tool to mark an inactive contact as active.

Mark Contact as Inactive

Tool to mark a contact as inactive in Zoho Invoice.

Mark Contact Person as Primary

Tool to mark a contact person as primary in Zoho Invoice.

Mark Estimate as Declined

Tool to mark an estimate as declined.

Mark Expense Category as Active

Tool to mark an inactive expense category as active.

Mark Invoice as Sent

Tool to mark an invoice as sent.

Mark Invoice as Void

Tool to mark an invoice as void.

Mark Item as Inactive

Tool to mark an active item as inactive.

Mark Retainer Invoice as Sent

Tool to mark a retainer invoice as sent.

Bulk Print Estimates

Tool to bulk print multiple estimates as PDF.

Bulk Print Invoices

Tool to bulk print invoices as PDF.

Refund Customer Payment

Tool to refund an excess customer payment.

Resume Recurring Invoice

Tool to resume a recurring invoice in Zoho Invoice.

Send Bulk Invoice Reminder

Tool to send payment reminders for multiple invoices in bulk.

Send Contact Email

Tool to send an email to a contact in Zoho Invoice.

Start Timer

Tool to start a timer on an existing time entry in Zoho Invoice.

Stop Recurring Invoice

Tool to stop a recurring invoice in Zoho Invoice.

Update Additional Address

Tool to update an additional address for a contact.

Update Contact

Tool to update an existing contact in Zoho Invoice.

Update Contact Person

Tool to update a contact person in Zoho Invoice.

Update Credit Note

Tool to update an existing credit note in Zoho Invoice.

Update Credit Note Template

Tool to update the template associated with a credit note.

Update Customer Payment Refund

Tool to update an existing customer payment refund.

Update Estimate Shipping Address

Tool to update the shipping address for an estimate.

Write Off Invoice

Tool to write off an invoice.

FAQ

Frequently asked questions

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

Yes, you can. CrewAI 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 invoice tools.

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

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

Start with Zoho invoice.It takes 30 seconds.

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

Start building