How to integrate Clickup MCP with OpenAI Agents SDK

Trusted by
AWS
Glean
Zoom
Airtable

30 min · no commitment · see it on your stack

Clickup logo
OpenAI Agents SDK logo
divider

Introduction

This guide walks you through connecting Clickup to the OpenAI Agents SDK using the Composio tool router. By the end, you'll have a working Clickup agent that can add 'urgent' tag to today's tasks, create a time entry for design work, share project folder with new guest user through natural language commands.

This guide will help you understand how to give your OpenAI Agents SDK agent real control over a Clickup account through Composio's Clickup MCP server.

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

Also integrate Clickup with

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 Clickup
  • Configure an AI agent that can use Clickup as a tool
  • Run a live chat session where you can ask the agent to perform Clickup 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 Clickup MCP server, and what's possible with it?

The Clickup MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your ClickUp account. It provides structured and secure access to your projects, tasks, and team collaboration features, so your agent can manage tasks, add dependencies, assign guests, tag work, and streamline workflows on your behalf.

  • Automated task management: Easily have your agent create new time entries, add tasks to multiple lists, or link related tasks to keep your projects organized and up to date.
  • Dependency tracking and updates: Instruct your agent to set up 'waiting on' or 'blocking' dependencies between tasks, ensuring everything flows smoothly and work bottlenecks are visible and managed automatically.
  • Seamless guest access: Let your agent add guests to folders, lists, or individual tasks with specific permissions, helping external collaborators get the right level of access instantly.
  • Tagging and time entry management: Direct your agent to add or update tags on time entries, or manage tags for specific tasks, enabling better tracking and reporting for your team's efforts.
  • Task and list organization: Have your agent quickly add existing tasks to additional lists or update key task attributes, so you can adapt to new priorities without manual effort.

Supported Tools & Triggers

Tools
Add dependencyAdds a 'waiting on' or 'blocking' dependency to a task, requiring either `depends_on` (task becomes waiting on) or `dependency_of` (task becomes blocking), but not both; `team_id` is required if `custom_task_ids` is true.
Add guest to folderAdds a guest to a folder with specified permissions; requires a ClickUp Enterprise Plan.
Add guest to listShares a ClickUp List with an existing guest user, granting them specified permissions; requires the Workspace to be on the ClickUp Enterprise Plan.
Add guest to taskAssigns a guest to a task with specified permissions; requires ClickUp Enterprise Plan, and `team_id` if `custom_task_ids` is true.
Add tags from time entriesAssociates a list of specified tags with one or more time entries within a given Team (Workspace).
Add tag to taskAdds an existing tag to a specified task; team_id is required if custom_task_ids is true.
Add task linkLinks two existing and accessible ClickUp tasks, identified by `task_id` (source) and `links_to` (target).
Add task to listAdds an existing task to an additional ClickUp List; the "Tasks in Multiple Lists" ClickApp must be enabled in the Workspace for this.
Update Doc PageTool to update/edit a ClickUp Doc page's title and/or content via the v3 Docs API.
Create a time entryCreates a new time entry for a specified team.
Create chat channelTool to create a chat channel in a ClickUp workspace.
Create chat messageTool to send a message in a ClickUp chat channel.
Create chat reactionTool to add a reaction to a ClickUp chat message.
Create chat view commentPosts a new comment to a specified ClickUp Chat view; the 'view_id' must correspond to an existing and accessible Chat view.
Create checklistCreates a new checklist with a specified name within an existing task, which can be identified by its standard ID or a custom task ID (if `custom_task_ids` is true, `team_id` is also required).
Create checklist itemCreates a new checklist item within a specified, existing checklist, optionally setting the item's name and assigning it to a user.
Create direct message channelTool to create a direct message channel in ClickUp.
Create DocTool to create a new ClickUp Doc in a Workspace (v3 Docs API) and return the new doc_id for follow-up page/content operations.
Create Doc PageTool to create a page in a ClickUp Doc (v3 Docs API).
Create folderCreates a new ClickUp Folder within the specified Space, which must exist and be accessible.
Create folderless listCreates a new folderless list (a list not part of any Folder) directly within a specified ClickUp Space.
Create folder viewCreates a new, highly customizable view within a specific ClickUp folder using its `folder_id`.
Create goalCreates a new goal in a ClickUp Team (Workspace).
Create key resultCreates a new Key Result (Target) for a specified Goal in ClickUp to define and track measurable objectives towards achieving that Goal.
Create listCreates a new list in ClickUp within an existing folder.
Create list commentAdds a new comment with specific text to an existing and accessible ClickUp List, assigns it to a user, and sets notification preferences for all list members.
Create list from template in folderCreates a new list from a template in a specified ClickUp folder.
Create list viewCreates a new, customizable view (e.
Create Location Chat ChannelTool to create a Channel on a Space, Folder, or List in ClickUp.
Create reply messageTool to create a reply to a chat message in ClickUp.
Create spaceCreates a new ClickUp Space within a specified Workspace, allowing feature configuration which defaults to Workspace settings if unspecified.
Create space tagCreates a new tag (name, foreground color, background color) in an existing ClickUp Space.
Create space viewCreates a customizable view (e.
Create a taskCreates a new ClickUp task in a specific list, optionally as a subtask if a `parent` task ID (which cannot be a subtask itself and must be in the same list) is provided.
Create task attachmentUploads a file as an attachment to a specified ClickUp task using multipart/form-data.
Create task commentAdds a comment to a ClickUp task; `team_id` is required if `custom_task_ids` is true.
Create task from templateCreates a new task in a specified ClickUp list from a task template, using the provided name for the new task.
Create teamCreates a new team (user group) with specified members in a Workspace; member IDs must be for existing users, and be aware that adding view-only guests as paid members may incur extra charges.
Create threaded commentTool to create a threaded reply to a comment in ClickUp.
Create webhookCreates a ClickUp webhook for a Team (Workspace) to notify a public URL on specified events (at least one, or '*' for all), optionally scoped to a Space, Folder, List, or Task; the endpoint must accept requests from dynamic IPs.
Create workspace Everything level viewCreates a new, customizable view (e.
Delete chat channelTool to delete a chat channel in ClickUp.
Delete chat messageTool to delete a chat message in ClickUp.
Delete chat reactionTool to delete a reaction from a chat message in ClickUp.
Delete checklistPermanently deletes an existing checklist identified by its `checklist_id`.
Delete checklist itemPermanently deletes an existing item, identified by `checklist_item_id`, from an existing checklist, identified by `checklist_id`.
Delete commentDeletes an existing comment from a task using its `comment_id`.
Delete dependencyRemoves a dependency relationship for a task.
Delete folderPermanently and irreversibly deletes a specified folder and all its contents (Lists, Tasks) if the folder_id exists.
Delete goalPermanently removes an existing Goal, identified by its `goal_id`, from the Workspace.
Delete key resultDeletes an existing Key Result, also referred to as a Target within a Goal, identified by its `key_result_id`.
Delete listPermanently deletes an existing List and all its contents; this action is destructive and irreversible via the API.
Delete spacePermanently deletes a specified Space in ClickUp; this action is irreversible as the Space cannot be recovered via the API.
Delete space tagDeletes a Tag from a Space, identified by `tag_name` in path; precise matching of Tag details in the request body (`tag_name_1`, `tag_tag_fg`, `tag_tag_bg`) is generally required for successful deletion.
Delete taskPermanently deletes a task, using its standard ID or a custom task ID (requires `custom_task_ids=true` and `team_id`).
Delete task linkDeletes an existing link, effectively a dependency or relationship, between two ClickUp tasks; set `custom_task_ids=true` and provide `team_id` if using custom task IDs.
Delete teamPermanently deletes an existing Team (user group) from the Workspace using its `group_id`.
Delete a time entryDeletes an existing time entry, specified by `timer_id`, from a Workspace identified by `team_id`.
Delete time trackedDeletes a time-tracked interval from a task; use this legacy endpoint for older time tracking systems.
Delete viewPermanently and irreversibly deletes an existing View in ClickUp, identified by its `view_id`.
Delete webhookPermanently removes an existing webhook, specified by its ID, thereby ceasing all its event monitoring and notifications.
Get accessible custom fieldsRetrieves all accessible Custom Field definitions for a specified ClickUp List using its `list_id`.
Get access tokenExchanges a ClickUp OAuth 2.
Get all tags from time entriesRetrieves all unique tags applied to time entries within a specified ClickUp Team (Workspace).
Get authorized teams workspacesRetrieves a list of Workspaces (Teams) the authenticated user can access.
Get authorized userRetrieves the details of the currently authenticated ClickUp user.
Get bulk tasks time in statusRetrieves the time spent in each status for multiple tasks; requires the 'Total time in Status' ClickApp to be enabled in the Workspace.
Get chat channelRetrieves details for a specific chat channel in a ClickUp Workspace.
Get chat channel followersTool to retrieve followers of a ClickUp chat channel.
Get chat channel membersTool to get members of a chat channel.
Get chat channelsTool to retrieve chat channels in a ClickUp workspace.
Get chat message reactionsTool to retrieve reactions on a ClickUp chat message.
Get chat message repliesRetrieves replies to a chat message in ClickUp.
Get chat messagesTool to retrieve messages from a ClickUp chat channel.
Get chat message tagged usersTool to retrieve users tagged in a ClickUp chat message.
Get chat view commentsRetrieves comments from a specified Chat view in ClickUp, supporting pagination via `start` and `start_id` to fetch comments older than the default 25 most recent.
Get custom rolesRetrieves all Custom Roles, which allow granular permission configurations, for a specified Workspace (Team).
Get custom task typesRetrieves all custom task types available within a specified Workspace (team_id).
Get Doc ContentTool to fetch the full content of a ClickUp Doc including metadata and all page contents in markdown format.
Get Doc Page ContentTool to fetch a single ClickUp Doc page's content and metadata by workspace_id + doc_id + page_id (v3 Docs API).
Get Doc Page ListingTool to fetch the page listing structure of a ClickUp Doc by workspace_id and doc_id.
Get Doc PagesTool to fetch pages belonging to a ClickUp Doc.
Get filtered team tasksRetrieves a paginated list of tasks (up to 100 per page) from a specified workspace based on various filter criteria, respecting user access permissions.
Get folderRetrieves detailed information about a specific folder in ClickUp.
Get Folder Available FieldsTool to view custom fields available in a ClickUp folder.
Get folderless listsRetrieves all Lists within a specified Space that are not located in any Folder.
Get foldersRetrieves Folders within a specified ClickUp Space, ensuring `space_id` is valid, with an option to filter by archived status.
Get folder viewsRetrieves all configured views (like List, Board, Calendar) for a specified, existing Folder in ClickUp.
Get goalRetrieves detailed information for an existing ClickUp Goal, specified by its unique `goal_id`.
Get goalsRetrieves goals for a specified ClickUp Workspace (Team); the `team_id` must be valid and accessible.
Get guestCall this to retrieve detailed information for a specific guest within a Team (Workspace), ensuring the `guest_id` is valid for the given `team_id`; this action requires the ClickUp Enterprise Plan.
Get listRetrieves detailed information for an existing List in ClickUp, identified by its unique `list_id`.
Get list commentsRetrieves comments for a specific ClickUp List, supporting pagination using `start` (timestamp) and `start_id` (comment ID) to fetch earlier comments; omits them for the latest 25.
Get list membersRetrieves all members of a specific, existing ClickUp List by its ID.
Get listsRetrieves all lists within a specified, existing ClickUp folder, optionally filtering by archived status.
Get list viewsRetrieves all task and page views for a specified and accessible ClickUp List.
Get running time entryRetrieves the currently active time entry for a user in a Workspace; a negative 'duration' in its data indicates it's running, and the response may be empty if no entry is active.
Shared hierarchyRetrieves the hierarchy of tasks, Lists, and Folders shared with the authenticated user within an existing ClickUp Team (Workspace), identified by its `team_id`.
Get spaceRetrieves detailed information for an existing Space in a ClickUp Workspace, identified by its unique space_id.
Get space available fieldsRetrieves all custom fields available in a ClickUp Space, identified by space_id.
Get spacesRetrieves Spaces for a Team ID; member information for private Spaces is returned only if the authenticated user is a member.
Get space tagsRetrieves all tags for tasks within a specified ClickUp Space, requiring a valid `space_id`.
Get space viewsRetrieves all task and page views for a specified Space ID in ClickUp.
Get post subtype IDsTool to retrieve post subtype IDs (Announcement, Discussion, Idea, Update) for a ClickUp Workspace.
Get taskRetrieves comprehensive details for a ClickUp task by its ID, supporting standard or custom task IDs (requires `team_id` for custom IDs).
Get task commentsRetrieves up to 25 comments for a specified task, supporting pagination using `start` and `start_id` to fetch older comments.
Get task membersRetrieves users with explicit access (directly assigned or shared) to a specific existing task, excluding users with inherited permissions.
Get tasksRetrieves tasks from a specified ClickUp list; only tasks whose home is the given list_id are returned.
Get task templatesRetrieves task templates for a specified Workspace (Team ID), supporting pagination.
Get task s time in statusRetrieves the duration a task has spent in each status, provided the 'Total time in Status' ClickApp is enabled for the Workspace.
Get team available fieldsRetrieves all custom fields available in a ClickUp Workspace (Team), identified by team_id.
Get teamsRetrieves user groups (Teams) from a ClickUp Workspace, typically requiring `team_id` (Workspace ID), with an option to filter by `group_ids`.
Get threaded commentsRetrieves threaded replies to a parent comment.
Get time entries within a date rangeRetrieves time entries for a specified Team (Workspace ID) within a date range (defaults to the last 30 days for the authenticated user if dates are omitted); active timers are indicated by negative durations in the response.
Get singular time entryFetches a specific time entry by its ID for a given team; a negative duration in the response indicates an active timer.
Get time entry historyRetrieves the modification history for an existing time entry within a specific ClickUp Team (Workspace).
Get tracked timeRetrieves tracked time for a task using a legacy endpoint; prefer newer Time Tracking API endpoints for managing time entries.
Get userRetrieves detailed information for a specific user within a ClickUp Workspace (Team), available only for Workspaces on the ClickUp Enterprise Plan.
Get viewFetches details for a specific ClickUp view, identified by its `view_id`, which must exist.
Get view tasksRetrieves all tasks visible in a specified ClickUp view, respecting its applied filters, sorting, and grouping.
Get webhooksFetches webhooks for a Team (Workspace), returning only those created by the authenticated user via API, for a `team_id` they can access.
Get workspace everything level viewsRetrieves all task and page views at the 'Everything Level' (a comprehensive overview of all tasks across all Spaces) for a specified ClickUp Workspace.
Get workspace planRetrieves the details of the current subscription plan for a specified ClickUp Workspace.
Get workspace seatsRetrieves seat utilization (used, total, available for members/guests) for a ClickUp Workspace (Team) ID, which must be for an existing Workspace.
Invite guest to workspaceInvites a guest by email to a ClickUp Workspace (Team) on an Enterprise Plan, setting initial permissions and optionally a custom role; further access configuration for specific items may require separate actions.
Invite user to workspaceInvites a user via email to a ClickUp Workspace (Team), optionally granting admin rights or a custom role; requires an Enterprise Plan for the Workspace.
Move task to new home listTool to move a task to a new home List using ClickUp Public API v3.
Remove custom field valueRemoves an existing value from a Custom Field on a specific task; this does not delete the Custom Field definition or its predefined options.
Remove guest from folderRevokes a guest's access to a specific ClickUp Folder, optionally unsharing items explicitly shared with them within it; requires an Enterprise Plan.
Remove guest from listRevokes a guest's access to a specific List, provided the guest currently has access to this List and the Workspace is on the ClickUp Enterprise Plan.
Remove guest from taskRevokes a guest's access to a specific task; only available for Workspaces on the ClickUp Enterprise Plan.
Remove guest from workspacePermanently removes a guest from a specified Workspace, revoking all their access; this destructive operation requires the Workspace to be on the ClickUp Enterprise Plan.
Remove tag from taskRemoves a tag from a specified task by disassociating it (does not delete the tag from Workspace), succeeding even if the tag is not on the task.
Remove tags from time entriesRemoves tags from specified time entries in a team, without deleting the tags from the workspace.
Remove task from listRemoves a task from an extra list (not its home list); the 'Tasks in Multiple Lists' ClickApp must be enabled.
Remove user from workspaceDeactivates a user from a specified ClickUp Workspace, revoking their access (user can be reactivated later); requires the Workspace to be on an Enterprise Plan.
Search DocsTool to search and list Docs metadata in a ClickUp workspace.
Set custom field valueSets or updates a Custom Field's value for a task; the new value (with type-dependent structure, e.
Start a time entryStarts a new time entry (timer) in the specified Team (Workspace), optionally associating it with a task, adding a description, setting billable status, or applying tags (tags feature requires Business Plan or higher).
Stop a time entryStops the authenticated user's currently active time entry in the specified Team (Workspace), which requires an existing time entry to be running.
Track timeRecords a time entry for a task using ClickUp's legacy time tracking system; newer endpoints are generally recommended.
Update chat channelTool to update a ClickUp chat channel's properties including name, topic, description, visibility, and location.
Update chat messageTool to update a ClickUp chat message's content, assignee, or resolved status via the v3 API.
Edit checklistUpdates an existing checklist's name or position, identified by its `checklist_id`.
Edit checklist itemUpdates an existing checklist item, allowing modification of its name, assignee, resolution status, or parent item for nesting.
Update commentUpdates an existing task comment's text, assignee (who must be a valid workspace member), or resolution status, requiring a valid existing comment_id.
Update folderUpdates the name of an existing folder in ClickUp.
Update goalUpdates attributes of an existing ClickUp goal, identified by its `goal_id`.
Edit guest on workspaceModifies the details and permissions of an existing guest user within a specific Workspace.
Edit key resultUpdates an existing key result's progress or note in ClickUp, where the key result measures progress towards a goal.
Update listUpdates attributes of an existing ClickUp list, such as its name, content, due date, priority, assignee, or color status, identified by its `list_id`.
Update spaceUpdates an existing ClickUp Space, allowing modification of its name, color, privacy, and feature settings (ClickApps).
Edit space tagUpdates an existing tag's name and colors in a ClickUp Space; requires current tag name for identification, and new values for tag name, foreground color, and background color, all of which are mandatory for the update.
Update taskUpdates attributes of an existing task; `team_id` is required if `custom_task_ids` is true, use a single space (" ") for `description` to clear it, and provide at least one modifiable field.
Update teamUpdates an existing ClickUp User Group (Team) using its `group_id`; note that adding a view-only guest as a paid member may incur charges.
Update a time entryUpdates an existing ClickUp time entry.
Change tag names from time entriesUpdates the name, background color, and/or foreground color for an existing time entry tag, identified by its current `name` and `team_id`.
Edit time trackedEdits a legacy time-tracked interval for a task (identified by `task_id` and `interval_id`) to update its start/end times and duration; `team_id` is required if `custom_task_ids` is true.
Edit user on workspaceUpdates a user's username, admin status, or custom role in a Workspace; requires the Workspace to be on an Enterprise Plan.
Update viewUpdates an existing ClickUp view's settings such as name, type, grouping, or filters; ensure `parent_id` and `parent_type` define a valid hierarchy, and that specified field names (e.
Update webhookUpdates the endpoint URL, monitored events, and status of an existing webhook, identified by its `webhook_id`.
Update workspace ACLUpdates privacy and access control list (ACL) permissions for a workspace object or location.

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 starting, make sure you have:
  • Composio API Key and OpenAI API Key
  • Primary know-how of OpenAI Agents SDK
  • A live Clickup project
  • Some knowledge of Python or Typescript

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

Install dependencies

pip install composio_openai_agents openai-agents python-dotenv

Install the Composio SDK and the OpenAI Agents SDK.

Set up environment variables

bash
OPENAI_API_KEY=sk-...your-api-key
COMPOSIO_API_KEY=your-api-key
USER_ID=composio_user@gmail.com

Create a .env file and add your OpenAI and Composio API keys.

Import dependencies

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
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 Clickup.

Set up the Composio instance

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())
What's happening:
  • load_dotenv() loads your .env file so OPENAI_API_KEY and COMPOSIO_API_KEY are available as environment variables.
  • Creating a Composio instance using the API Key and OpenAIAgentsProvider class.

Create a Tool Router session

# Create a Clickup Tool Router session
session = composio.create(
    user_id=user_id,
    toolkits=["clickup"]
)

mcp_url = session.mcp.url

What is happening:

  • You give the Tool Router the user id and the toolkits you want available. Here, it is only clickup.
  • The router checks the user's Clickup connection and prepares the MCP endpoint.
  • The returned session.mcp.url is the MCP URL that your agent will use to access Clickup.
  • This approach keeps things lightweight and lets the agent request Clickup tools only when needed during the conversation.

Configure the agent

# Configure agent with MCP tool
agent = Agent(
    name="Assistant",
    model="gpt-5",
    instructions=(
        "You are a helpful assistant that can access Clickup. "
        "Help users perform Clickup 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",
            }
        )
    ],
)
What's happening:
  • We're creating an Agent instance with a name, model (gpt-5), and clear instructions about its purpose.
  • The agent's instructions tell it that it can access Clickup and help with queries, inserts, updates, authentication, and fetching database information.
  • The tools array includes a HostedMCPTool that connects to the MCP server URL we created earlier.
  • The headers dict includes the Composio API key for secure authentication with the MCP server.
  • require_approval: 'never' means the agent can execute Clickup operations without asking for permission each time, making interactions smoother.

Start chat loop and handle conversation

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())
What's happening:
  • The program prints a session URL that you visit to authorize Clickup.
  • After authorization, the chat begins.
  • Each message you type is processed by the agent using Runner.run().
  • The responses are printed to the console, and conversations are saved locally using SQLite.
  • Typing exit, quit, or q cleanly ends the chat.

Complete Code

Here's the complete code to get you started with Clickup and OpenAI Agents SDK:

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=["clickup"]
)
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 Clickup. "
        "Help users perform Clickup 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())

Conclusion

This was a starter code for integrating Clickup MCP with OpenAI Agents SDK to build a functional AI agent that can interact with Clickup.

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 Clickup MCP Agent with another framework

FAQ

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

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

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

Yes, absolutely. You can configure which Clickup 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 Clickup 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.