How to integrate Wrike MCP with LlamaIndex

Trusted by
AWS
Glean
Zoom
Airtable

30 min · no commitment · see it on your stack

Wrike logo
LlamaIndex logo
divider

Introduction

This guide walks you through connecting Wrike to LlamaIndex using the Composio tool router. By the end, you'll have a working Wrike agent that can create a new task in marketing folder, add multiple users to project group, invite a teammate to the workspace through natural language commands.

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

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

Also integrate Wrike with

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 Wrike
  • Connect LlamaIndex to the Wrike MCP server
  • Build a Wrike-powered agent using LlamaIndex
  • Interact with Wrike 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 Wrike MCP server, and what's possible with it?

The Wrike MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Wrike account. It provides structured and secure access to your project spaces, so your agent can perform actions like creating tasks, managing folders, handling group memberships, sending workspace invitations, and automating project workflows on your behalf.

  • Automated task creation and management: Let your agent quickly create new tasks in specific folders, assign details, and keep your projects moving forward without manual input.
  • Dynamic folder and project organization: Have your agent generate new folders or subfolders to structure work, or clean up by deleting old folders and their contents when projects wrap up.
  • Efficient user and group management: Easily add, remove, or modify group memberships and create new user groups to keep team permissions organized and up-to-date.
  • Seamless workspace invitations: Direct your agent to invite teammates or collaborators to your Wrike workspace via email, including customizing invitation details for better onboarding.
  • Custom field and data cleanup: Empower your agent to delete custom fields, tasks, or groups when they're no longer needed, helping you maintain a clean and efficient workspace.

Supported Tools & Triggers

Tools
Bulk modify group membersAdds or removes members for multiple Wrike groups in a single request; all specified user IDs must correspond to existing Wrike users.
Copy folderCopies a Wrike folder synchronously to a specified parent location with customizable options.
Copy folder asyncDuplicate a folder asynchronously in Wrike, creating a copy in a specified parent location.
Create account webhooksCreates a webhook for the current account to receive notifications about changes.
Create equipment assetTool to create equipment/asset in Wrike.
Create custom fieldTool to create a new custom field in Wrike.
Create a folderCreates a new Wrike subfolder within the specified `folderId`, optionally as a project if `customItemTypeId` is given; the folder is auto-shared with its creator.
Create folder bookingTool to create a booking in a Wrike folder.
Create approval in folderTool to create a new approval in a Wrike folder.
Create folder commentCreates a new comment on a specified Wrike folder.
Create timelog lock period for folderCreates a timelog lock period for a specific folder.
Create a webhook on folderTool to create a webhook for a Wrike folder or project.
Create a groupCreates a new user group in Wrike with a specified title, optionally setting members, parent group, avatar, and custom metadata.
Create invitationInvites a user to a Wrike workspace by email, optionally with name, specifying EITHER `userTypeId` OR a combination of `role`/`external`; custom email subject/message available for paid accounts.
Create space timelog lock periodTool to create a timelog lock period for a space to prevent time entries from being edited.
Create space webhookTool to create a webhook on a Wrike space for receiving notifications about changes to tasks, folders, and projects.
Create task in folderCreates a new task in a specified Wrike folder; if setting priority with `priorityBefore` or `priorityAfter`, the referenced task must be in the same folder or project.
Create task attachmentTool to upload a file attachment to a Wrike task.
Create task commentTool to create a new comment on a Wrike task.
Create task approvalTool to create an approval on a specific task in Wrike.
Create task dependencyTool to create a new dependency relationship between Wrike tasks.
Create task timelogTool to create a timelog entry for a specific task in Wrike.
Create timesheetTool to create a timesheet for a user for a specified time period.
Create workflowsTool to create a new custom workflow in Wrike.
Delete approvalCancels/deletes an approval by its identifier.
Delete assetPermanently deletes a Wrike asset/equipment by assetId.
Delete attachmentTool to permanently delete a Wrike attachment by its ID.
Delete bookingPermanently removes a resource booking allocation by its ID; use when deallocating resources from projects or tasks.
Delete commentPermanently deletes a Wrike comment by its ID; this action is irreversible and the comment must exist.
Delete custom field by idPermanently deletes a custom field by its ID; this action is irreversible and requires a valid, existing custom field ID.
Delete dependenciesPermanently removes a task dependency relationship by its ID; use when unlinking predecessor/successor task relationships.
Delete folderPermanently deletes the folder specified by `folderId` and all its contents (e.
Delete timelog lock period for folderDeletes a timelog lock period for a specific folder.
Delete group by idPermanently deletes a group by its `groupId`; this action is irreversible and does not affect user accounts that were members of the group.
Delete invitationPermanently deletes an existing invitation, specified by its unique `invitationId`; this action cannot be undone.
Delete job rolePermanently deletes a job role by its identifier; deleted job roles are removed from all tasks and users and cannot be restored.
Delete spacePermanently deletes a Wrike space and all its contents by spaceId; this action is irreversible and should be used with caution.
Delete spaces timelog lock periodTool to unlock (delete) a timelog lock period for a specific space in Wrike.
Delete taskPermanently deletes a Wrike task and all its associated data by its ID; this action is irreversible and the task must exist.
Delete timelogPermanently deletes a Wrike timelog entry by its ID; use when removing an incorrect or obsolete time log entry.
Delete webhookTool to permanently delete a webhook by webhook_id.
Fetch all tasksFetches tasks from a Wrike account, allowing filtering by status, due date, and subfolder inclusion, with customizable response fields and pagination.
Get account informationRetrieves detailed Wrike account information, where the response content is influenced by selected fields, account subscription, and user permissions.
Get all custom fieldsRetrieves all custom field definitions (including ID, name, type, and settings) from the Wrike account; this returns the definitions themselves, not their specific values on Wrike items, and is useful for obtaining custom field IDs.
Get all webhooksTool to retrieve a list of all webhooks created using the same API token.
Get approvalsTool to retrieve all approvals accessible to the authenticated user.
Get approvals by IDsTool to retrieve specific Wrike approvals by their IDs (up to 100).
Get async job statusTool to retrieve status and details for an asynchronous job in Wrike.
Get attachments by IDsTool to retrieve multiple Wrike attachments by their IDs (up to 100).
Download attachmentTool to download a Wrike attachment file.
Get attachment previewTool to download a preview version of a Wrike attachment.
Get attachment URLTool to get a public access URL for a Wrike attachment.
Get bookingsRetrieves one or more Wrike bookings by their IDs.
Get colorsTool to query the list of available colors in Wrike.
Get commentsTool to retrieve all comments accessible to the authorized user.
Get comments by IDsTool to retrieve multiple Wrike comments by their IDs.
Get contact hourly ratesTool to retrieve hourly budget rates for up to 100 Wrike contacts.
Get contactsRetrieves a list of Wrike contacts (e.
Get contacts historyTool to access field modification history for Wrike contacts.
Get contact timelogsTool to retrieve all timelog records created by a specific contact in Wrike.
Get custom item typesTool to retrieve all custom item types from Wrike.
Get dependencies by IDsTool to retrieve one or more Wrike dependencies by their IDs (up to 100).
Get folder bookingsTool to query bookings for a specific folder in Wrike.
Get foldersRetrieves folders and/or projects from Wrike, with filters; when using `nextPageToken`, all other filter parameters must match the initial request.
Get folder approvalsTool to retrieve all approvals from a specific Wrike folder.
Get folder attachmentsTool to retrieve all attachments from a specific Wrike folder.
Get folders by IDsTool to retrieve multiple Wrike folders by their IDs.
Get folder commentsTool to retrieve comments from a specific Wrike folder.
Get folders historyTool to access field modification history for Wrike folders.
Get folder hourly ratesTool to retrieve hourly budget rates for a specific Wrike folder.
Get folder rollupsTool to query rollup settings for items in a folder.
Get folder tasksQuery tasks within a specific folder.
Get folder timelog lock periodsTool to query timelog lock periods for a specific folder.
Get folders timelogsTool to retrieve all timelog records for a specific folder.
Convert legacy v2 IDs to v4Tool to convert legacy Wrike API v2 IDs to current v4 format.
Get specific contact informationRetrieves detailed information for a specific Wrike contact using their unique `contactId`, optionally including `metadata` and `customFields` if specified in the `fields` parameter.
Get job roles by IDsTool to retrieve details for one or more Wrike job roles by job role IDs.
Get placeholder hourly ratesTool to retrieve hourly budget rates for one or more Wrike placeholders.
Get placeholders by IDsTool to retrieve details for one or more Wrike placeholders by their IDs.
Get space by IDTool to retrieve details for a single Wrike space by spaceId.
Get space custom item typesTool to retrieve all custom item types scoped to a specific Wrike space.
Get space foldersTool to retrieve the folder tree for a specific Wrike space.
Get space custom fieldsTool to retrieve all custom fields defined for a specific Wrike space.
Get spaces tasksTool to query tasks within a specific Wrike space.
Get space workflowsTool to query workflows for a specific Wrike space.
Get space timelog lock periodsTool to query timelog lock periods for a specific space.
Get specific userRetrieves detailed information about a specific user in Wrike using their unique user ID.
Get task by idRetrieves read-only detailed information for a specific Wrike task by its unique ID, optionally allowing specification of fields to include in the response.
Get task dependenciesRetrieves all dependency relationships for a specific task.
Get task approvalsRetrieves all approval records for a specific task.
Get task attachmentsTool to retrieve all attachments from a specific Wrike task.
Get task commentsTool to retrieve all comments from a specific Wrike task.
Get tasks historyQuery task field modification history for up to 100 tasks.
Get task rollupsTool to query rollup settings for a specific task.
Get task timelog lock periodsTool to query timelog lock periods for a specific task.
Get task timelogsRetrieves all timelog records for a specific task.
Get timelog categoriesTool to query the list of timelog categories in Wrike.
Get timelogsRetrieves timelog records from Wrike with optional filters for dates, users, and task scope.
Get timelogs by IDsRetrieves detailed information for one or more Wrike timelogs by their unique IDs (up to 100), optionally including export and lock status.
Get timesheetsTool to query timesheets from Wrike.
Get timesheet submission rulesTool to retrieve global timesheet submission rules across all work schedules.
Get API versionTool to retrieve current Wrike API version information.
Get webhook by IDTool to retrieve details for a specific webhook by webhook_id.
Get work schedule timesheet rulesTool to retrieve timesheet submission rules for a specific work schedule.
Launch folder blueprint asyncAsynchronously launches a new project or folder structure in Wrike from a specified Folder Blueprint.
Launch Task Blueprint AsyncAsynchronously launches a Wrike Task Blueprint to create tasks/projects, requiring either `super_task_id` (parent task) or `parent_id` (parent folder/project) for placement.
List all attachmentsTool to retrieve all attachments from the Wrike account.
List Folder BlueprintsRetrieves all account-level Folder Blueprints, which are templates for standardizing folder/project creation with predefined structures, custom fields, and workflows.
List all placeholdersRetrieves all placeholders accessible to the authenticated user; placeholders are templates used in Wrike for creating standardized tasks or projects.
List space folder blueprintsLists all folder blueprints (templates for new folders/projects) within a specified Wrike space, requiring a valid and accessible space ID.
List spacesTool to list spaces the authorized user can access.
List space task blueprintsLists task blueprints (templates for creating tasks with consistent structures) available in a specific, accessible Wrike space.
List subfolders by folder idLists subfolders (metadata only, not their contents) for an existing Wrike folder specified by `folderId`, supporting recursive descent, filtering, and pagination.
List Task BlueprintsRetrieves a list of defined Task Blueprints (predefined task templates) from the Wrike account, supporting pagination.
Update account metadataUpdates or adds custom key-value metadata to the Wrike account, useful for integrations, storing app-specific data, or mapping external system identifiers.
Modify folder attributesModifies an existing Wrike folder: updates title, description, parents (not root/recycle bin), sharing, metadata, custom fields/columns; restores, converts to project, or manages access roles.
Modify groupUpdates an existing Wrike user group's attributes like title, members, parent, avatar, or metadata, using its `groupId` and specifying only the fields to change.
Modify taskModifies an existing Wrike task by its ID, allowing updates to attributes such as title, status, dates, assignees, and custom fields; `priorityBefore` and `priorityAfter` are mutually exclusive, and parent folder IDs for `addParents`/`removeParents` cannot be the Recycle Bin.
Retrieve custom field by idRetrieves a Wrike custom field's detailed information (e.
Query invitationsRetrieves all active invitations in Wrike, useful for viewing and auditing pending invitations or managing user onboarding.
Query job rolesTool to retrieve all available job roles in the Wrike account.
Get group by idRetrieves detailed information for a specific Wrike group using its `groupId`, optionally including 'metadata'.
Query workflowsFetches a list of all workflows with their detailed information from the Wrike account; this is a read-only action and does not support pagination or filtering through its parameters.
Retrieve list of groupsRetrieves a list of user groups from the Wrike account, supporting metadata filtering, pagination, and inclusion of specific fields; this is a read-only operation.
Search eDiscoveryTool to perform eDiscovery search across Wrike items (folders, projects, tasks).
Update approvalUpdates an existing Wrike approval by its ID, allowing modifications to the title, description, and due date.
Update assetTool to update a Wrike asset/equipment by ID.
Update attachmentTool to update a Wrike attachment by uploading new file content.
Update bookingUpdates a Wrike booking's date range by ID.
Update commentTool to update an existing Wrike comment.
Update custom field by idUpdates properties of an existing Wrike custom field by its ID, such as its title, type, scope, or sharing settings.
Update dependencyTool to modify an existing Wrike dependency relationship between tasks.
Update folder rollup settingsTool to update rollup settings for a folder.
Update invitationUpdates a pending Wrike invitation (`invitationId`) to resend it or change user's role/type (use EITHER `userTypeId` OR `role`/`external`).
Update job roleUpdates an existing Wrike job role by its ID, allowing modifications to the title and short title.
Update metadata on a specific contactUpdates metadata, job role, or custom fields for an existing Wrike contact specified by `contactId`; if `jobRoleId` is provided, it must be a valid ID.
Update a specific userUpdates specified profile attributes (e.
Update task rollup settingsUpdates rollup settings for a task.
Update timelog entryTool to modify an existing timelog entry in Wrike.
Update timesheet rowUpdates a Wrike timesheet row by its ID, allowing modification of the timelog category.
Update timesheetTool to update a timesheet's approval status in Wrike.
Update webhook stateTool to update the state of a Wrike webhook.
Update workflowTool to modify an existing Wrike workflow.
Update work schedule timesheet rulesTool to update timesheet submission rules for a work schedule.

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

What is Composio SDK?

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

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

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

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

Step-by-step Guide

Prerequisites

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

Getting API Keys for OpenAI, Composio, and Wrike

OpenAI API key (OPENAI_API_KEY)
  • Go to the OpenAI dashboard
  • Create an API key if you don't have one
  • Assign it to OPENAI_API_KEY in .env
Composio API key and user ID
  • Log into the Composio dashboard
  • Copy your API key from Settings
    • Use this as COMPOSIO_API_KEY
  • Pick a stable user identifier (email or ID)
    • Use this as COMPOSIO_USER_ID

Installing dependencies

pip install composio-llamaindex llama-index llama-index-llms-openai llama-index-tools-mcp python-dotenv

Create a new Python project and install the necessary dependencies:

  • composio-llamaindex: Composio's LlamaIndex integration
  • llama-index: Core LlamaIndex framework
  • llama-index-llms-openai: OpenAI LLM integration
  • llama-index-tools-mcp: MCP client for LlamaIndex
  • python-dotenv: Environment variable management

Set environment variables

bash
OPENAI_API_KEY=your-openai-api-key
COMPOSIO_API_KEY=your-composio-api-key
COMPOSIO_USER_ID=your-user-id

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 Wrike access

Import modules

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()

Create a new file called wrike_llamaindex_agent.py and import the required modules:

Key imports:

  • asyncio: For async/await support
  • Composio: Main client for Composio services
  • LlamaIndexProvider: Adapts Composio tools for LlamaIndex
  • ReActAgent: LlamaIndex's reasoning and action agent
  • BasicMCPClient: Connects to MCP endpoints
  • McpToolSpec: Converts MCP tools to LlamaIndex format

Load environment variables and initialize Composio

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")

What's happening:

This ensures missing credentials cause early, clear errors before the agent attempts to initialise.

Create a Tool Router session and build the agent function

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=["wrike"],
    )

    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 Wrike actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Wrike actions.
    """
    return ReActAgent(tools=tools, llm=llm, description=description, system_prompt=system_prompt, verbose=True)

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, wrike)
  • 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 Wrike tools.
  • The MCP tools are mapped to LlamaIndex-compatible tools and plug them into the Agent.

Create an interactive chat loop

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}")

What's happening here:

  • We're creating a direct terminal interface to chat with your Wrike database
  • The LLM's responses are streamed to the CLI for faster interaction.
  • The agent uses context to maintain conversation history
  • You can type 'quit' or 'exit' to stop the chat loop gracefully
  • Agent responses and any errors are displayed in a clear, readable format

Define the main entry point

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!")

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 Wrike

Run the agent

npx ts-node llamaindex-agent.ts

When prompted, authenticate and authorise your agent with Wrike, then start asking questions.

Complete Code

Here's the complete code to get you started with Wrike and LlamaIndex:

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=["wrike"],
    )

    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 Wrike actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Wrike 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!")

Conclusion

You've successfully connected Wrike to LlamaIndex through Composio's Tool Router MCP layer. Key takeaways:
  • Tool Router dynamically exposes Wrike 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 Wrike MCP Agent with another framework

FAQ

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

With a standalone Wrike MCP server, the agents and LLMs can only access a fixed set of Wrike tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Wrike 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 Wrike tools.

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

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

Used by agents from

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

Never worry about agent reliability

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