How to integrate Box MCP with Claude Agent SDK

Framework Integration Gradient
Box Logo
Claude Agent SDK Logo
divider

Introduction

This guide walks you through connecting Box to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Box agent that can add watermark to confidential file in box, create shared link for project folder, add classification label to financial report, update my user avatar in box through natural language commands.

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

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

TL;DR

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

What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.

Key features include:

  • Native MCP Support: Built-in support for Model Context Protocol servers
  • Permission Modes: Control tool execution permissions
  • Streaming Responses: Real-time response streaming for interactive applications
  • Context Manager: Clean async context management for sessions

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

The Box MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Box account. It provides structured and secure access to your files and folders, so your agent can perform actions like sharing files, managing classifications, applying watermarks, and controlling collaboration on your behalf.

  • File sharing and collaboration: Instantly add or manage shared links for files, folders, or web links, making it easy to collaborate securely with others.
  • Automated classification management: Let your agent add, initialize, or update file and folder classifications to enforce security or organizational policies.
  • Watermarking and content protection: Apply or update watermarks on files to safeguard sensitive information and manage compliance.
  • Group and user management: Have your agent add users to groups or update user avatars to streamline administrative tasks within your team.
  • Domain and access control: Automatically update the list of allowed collaboration domains, ensuring only trusted domains can access your resources.

Supported Tools & Triggers

Tools
Add classification to fileAdds a classification to a file by specifying the label of the classification to add.
Add classification to folderAdds a classification to a folder by specifying the label of the classification to add.
Add domain to list of allowed collaboration domainsCreates a new entry in the list of allowed domains to allow collaboration for.
Add initial classificationsWhen an enterprise does not yet have any classifications, this api call initializes the classification template with an initial set of classifications.
Add or update user avatarAdds or updates a user avatar.
Add shared link to fileAdds a shared link to a file.
Add shared link to folderAdds a shared link to a folder.
Add shared link to web linkAdds a shared link to a web link.
Add user to groupCreates a group membership.
Apply watermark to fileApplies or update a watermark on a file.
Apply watermark to folderApplies or update a watermark on a folder.
Ask questionSends an ai request to supported llms and returns an answer specifically focused on the user's question given the provided context.
Assign legal hold policyAssign a legal hold to a file, file version, folder, or user.
Assign retention policyAssigns a retention policy to an item.
Assign storage policyCreates a storage policy assignment for an enterprise or user.
Assign taskAssigns a task to a user.
Authorize userAuthorize a user by sending them through the [box](https://box.
Cancel box sign requestCancels a sign request.
Change shield information barrier statusChange status of shield information barrier with the specified id.
Commit upload sessionClose an upload session and create a file from the uploaded chunks.
Copy fileCreates a copy of a file.
Copy file requestCopies an existing file request that is already present on one folder, and applies it to another folder.
Copy folderCreates a copy of a folder within a destination folder.
Create ai agentCreates an ai agent.
Create box sign requestCreates a signature request.
Create box skill cards on fileApplies one or more box skills metadata cards to a file.
Create collaborationAdds a collaboration for a single user or a single group to a file or folder.
Create commentAdds a comment by the user to a specific file, or as a reply to an other comment.
Create email aliasAdds a new email alias to a user account.
Create folderCreates a new empty folder within the specified parent folder.
Create folder lockCreates a folder lock on a folder, preventing it from being moved and/or deleted.
Create groupCreates a new group of users in an enterprise.
Create jobs to terminate user group sessionValidates the roles and permissions of the group, and creates asynchronous jobs to terminate the group's sessions.
Create jobs to terminate users sessionValidates the roles and permissions of the user, and creates asynchronous jobs to terminate the user's sessions.
Create legal hold policyCreate a new legal hold policy.
Create metadata cascade policyCreates a new metadata cascade policy that applies a given metadata template to a given folder and automatically cascades it down to any files within that folder.
Create metadata instance on fileApplies an instance of a metadata template to a file.
Create metadata instance on folderApplies an instance of a metadata template to a folder.
Create metadata templateCreates a new metadata template that can be applied to files and folders.
Create retention policyCreates a retention policy.
Create shield information barrierCreates a shield information barrier to separate individuals/groups within the same firm and prevents confidential information passing between them.
Create shield information barrier reportCreates a shield information barrier report for a given barrier.
Create shield information barrier segmentCreates a shield information barrier segment.
Create shield information barrier segment memberCreates a new shield information barrier segment member.
Create shield information barrier segment restrictionCreates a shield information barrier segment restriction object.
Create slack integration mappingCreates a [slack integration mapping](https://support.
Create taskCreates a single task on a file.
Create teams integration mappingCreates a [teams integration mapping](https://support.
Create terms of serviceCreates a terms of service for a given enterprise and type of user.
Create terms of service status for new userSets the status for a terms of service for a user.
Create upload sessionCreates an upload session for a new file.
Create upload session for existing fileCreates an upload session for an existing file.
Create userCreates a new managed user in an enterprise.
Create user exemption from collaboration domain restrictionsCreate user exemption from collaboration domain restrictions.
Create user inviteInvites an existing external user to join an enterprise.
Create webhookCreates a webhook.
Create web linkCreates a web link object within a folder.
Create zip downloadCreates a request to download multiple files and folders as a single `zip` archive file.
Delete ai agentDeletes an ai agent using the provided parameters.
Delete fileDeletes a file, either permanently or by moving it to the trash.
Delete file requestDeletes a file request permanently.
Delete folderDeletes a folder, either permanently or by moving it to the trash.
Delete folder lockDeletes a folder lock on a given folder.
Delete retention policyPermanently deletes a retention policy.
Delete shield information barrier segmentDeletes the shield information barrier segment based on provided id.
Delete shield information barrier segment member by idDeletes a shield information barrier segment member based on provided id.
Delete shield information barrier segment restriction by idDelete shield information barrier segment restriction by id.
Delete slack integration mappingDeletes a [slack integration mapping](https://support.
Delete teams integration mappingDeletes a [teams integration mapping](https://support.
Delete userDeletes a user.
Delete user avatarRemoves an existing user avatar.
Download fileReturns the contents of a file in binary format.
Download zip archiveReturns the contents of a `zip` archive in binary format.
Extract metadata freeformSends an ai request to supported large language models (llms) and extracts metadata in form of key-value pairs.
Extract metadata structuredSends an ai request to supported large language models (llms) and returns extracted metadata as a set of key-value pairs.
Find app item for shared linkReturns the app item represented by a shared link.
Find file for shared linkReturns the file represented by a shared link.
Find folder for shared linkReturn the folder represented by a shared link.
Find metadata template by instance idFinds a metadata template by searching for the id of an instance of the template.
Find web link for shared linkReturns the web link represented by a shared link.
Force apply metadata cascade policy to folderForce the metadata on a folder with a metadata cascade policy to be applied to all of its children.
Generate textSends an ai request to supported large language models (llms) and returns generated text based on the provided prompt.
Get ai agent by agent idGets an ai agent using the `agent id` parameter.
Get ai agent default configurationGet the ai agent default config
Get allowed collaboration domainReturns a domain that has been deemed safe to create collaborations for within the current enterprise.
Get box sign request by idGets a sign request by id.
Get box sign template by idFetches details of a specific box sign template.
Get classification on fileRetrieves the classification metadata instance that has been applied to a file.
Get classification on folderRetrieves the classification metadata instance that has been applied to a folder.
Get collaborationRetrieves a single collaboration.
Get collection by idRetrieves a collection by its id.
Get commentRetrieves the message and metadata for a specific comment, as well as information on the user who created the comment.
Get current userRetrieves information about the user who is currently authenticated.
Get device pinRetrieves information about an individual device pin.
Get events long poll endpointThe listevents endpoint provides information about the events available in the box system.
Get file informationRetrieves the details about a file.
Get file requestRetrieves the information about a file request.
Get files under retentionReturns a list of files under retention for a retention policy assignment.
Get file thumbnailRetrieves a thumbnail, or smaller image representation, of a file.
Get file versionRetrieve a specific version of a file.
Get file version legal holdRetrieves information about the legal hold policies assigned to a file version.
Get file versions under retentionReturns a list of file versions under retention for a retention policy assignment.
Get folder informationRetrieves details for a folder, including the first 100 entries in the folder.
Get groupRetrieves information about a group.
Get group membershipRetrieves a specific group membership.
Get legal hold policyRetrieve a legal hold policy.
Get legal hold policy assignmentRetrieve a legal hold policy assignment.
Get metadata cascade policyRetrieve a specific metadata cascade policy assigned to a folder.
Get metadata instance on fileRetrieves the instance of a metadata template that has been applied to a file.
Get metadata instance on folderRetrieves the instance of a metadata template that has been applied to a folder.
Get metadata template by idRetrieves a metadata template by its id.
Get metadata template by nameRetrieves a metadata template by its `scope` and `templatekey` values.
Get retention on fileReturns information about a file version retention.
Get retention policyRetrieves a retention policy.
Get retention policy assignmentRetrieves a retention policy assignment
Get shared link for fileGets the information for a shared link on a file.
Get shared link for folderGets the information for a shared link on a folder.
Get shared link for web linkGets the information for a shared link on a web link.
Get shield information barrier report by idRetrieves a shield information barrier report by its id.
Get shield information barrier segment member by idRetrieves a shield information barrier segment member by its id.
Get shield information barrier segment restriction by idRetrieves a shield information barrier segment restriction based on provided id.
Get shield information barrier segment with specified idRetrieves shield information barrier segment based on provided id.
Get shield information barrier with specified idGet shield information barrier based on provided id.
Get storage policyFetches a specific storage policy.
Get storage policy assignmentFetches a specific storage policy assignment.
Get taskRetrieves information about a specific task.
Get task assignmentRetrieves information about a task assignment.
Get terms of serviceFetches a specific terms of service.
Get trashed fileRetrieves a file that has been moved to the trash.
Get trashed folderRetrieves a folder that has been moved to the trash.
Get trashed web linkRetrieves a web link that has been moved to the trash.
Get upload sessionReturn information about an upload session.
Get userRetrieves information about a user in the enterprise.
Get user avatarRetrieves an image of a the user's avatar.
Get user exempt from collaboration domain restrictionsReturns a users who has been exempt from the collaboration domain restrictions.
Get user invite statusReturns the status of a user invite.
Get watermark for folderRetrieve the watermark for a folder.
Get watermark on fileRetrieve the watermark for a file.
Get webhookRetrieves a specific webhook
Get web linkRetrieve information about a web link.
Get zip download statusReturns the download status of a `zip` archive, allowing an application to inspect the progress of the download as well as the number of items that might have been skipped.
List ai agentsLists ai agents based on the provided parameters.
List all classificationsRetrieves the classification metadata template and lists all the classifications available to this enterprise.
List all collectionsRetrieves all collections for a given user.
List all file versionsRetrieve a list of the past versions for a file.
List all global metadata templatesUsed to retrieve all generic, global metadata templates available to all enterprises using box.
List all legal hold policiesRetrieves a list of legal hold policies that belong to an enterprise.
List all metadata templates for enterpriseUsed to retrieve all metadata templates created to be used specifically within the user's enterprise
List allowed collaboration domainsReturns the list domains that have been deemed safe to create collaborations for within the current enterprise.
List all webhooksReturns all defined webhooks for the requesting application.
List box sign requestsGets signature requests created by a user.
List box sign templatesGets box sign templates created by a user.
List box skill cards on fileList the box skills metadata cards that are attached to a file.
List collection itemsRetrieves the files and/or folders contained within this collection.
List enterprise device pinsRetrieves all the device pins within an enterprise.
List enterprise usersReturns a list of all users for the enterprise along with their `user id`, `public name`, and `login`.
List file app item associations**this is a beta feature, which means that its availability might be limited.
List file collaborationsRetrieves a list of pending and active collaborations for a file.
List file commentsRetrieves a list of comments for a file.
List file version legal holdsGet a list of file versions on legal hold for a legal hold assignment.
List file version retentionsRetrieves all file version retentions for the given enterprise.
List folder app item associations**this is a beta feature, which means that its availability might be limited.
List folder collaborationsRetrieves a list of pending and active collaborations for a folder.
List folder locksRetrieves folder lock details for a given folder.
List group collaborationsRetrieves all the collaborations for a group.
List groups for enterpriseRetrieves all of the groups for a given enterprise.
List items in folderRetrieves a page of items in a folder.
List legal hold policy assignmentsRetrieves a list of items a legal hold policy has been assigned to.
List members of groupRetrieves all the members for a group.
List metadata cascade policiesRetrieves a list of all the metadata cascade policies that are applied to a given folder.
List metadata instances on fileRetrieves all metadata for a given file.
List metadata instances on folderRetrieves all metadata for a given folder.
List partsReturn a list of the chunks uploaded to the upload session so far.
List pending collaborationsRetrieves all pending collaboration invites for this user.
List previous file versions for legal hold policy assignmentList previous file versions for legal hold policy assignment
List recently accessed itemsReturns information about the recent items accessed by a user, either in the last 90 days or up to the last 1000 items accessed.
List retention policiesRetrieves all of the retention policies for an enterprise.
List retention policy assignmentsReturns a list of all retention policy assignments associated with a specified retention policy.
List shield information barrier reportsLists shield information barrier reports.
List shield information barriersRetrieves a list of shield information barrier objects for the enterprise of jwt.
List shield information barrier segment membersLists shield information barrier segment members based on provided segment ids.
List shield information barrier segment restrictionsLists shield information barrier segment restrictions based on provided segment id.
List shield information barrier segmentsRetrieves a list of shield information barrier segment objects for the specified information barrier id.
List slack integration mappingsLists [slack integration mappings](https://support.
List storage policiesFetches all the storage policies in the enterprise.
List storage policy assignmentsFetches all the storage policy assignment for an enterprise or user.
List task assignmentsLists all of the assignments for a given task.
List tasks on fileRetrieves a list of all the tasks for a file.
List teams integration mappingsLists [teams integration mappings](https://support.
List terms of servicesReturns the current terms of service text and settings for the enterprise.
List terms of service user statusesRetrieves an overview of users and their status for a terms of service, including whether they have accepted the terms and when.
List trashed itemsRetrieves the files and folders that have been moved to the trash.
List user and enterprise eventsReturns up to a year of past events for a given user or for the entire enterprise.
List user s email aliasesRetrieves all email aliases for a user.
List users exempt from collaboration domain restrictionsReturns a list of users who have been exempt from the collaboration domain restrictions.
List user s groupsRetrieves all the groups for a user.
List workflowsReturns list of workflows that act on a given `folder id`, and have a flow with a trigger type of `workflow manual start`.
Permanently remove filePermanently deletes a file that is in the trash.
Permanently remove folderPermanently deletes a folder that is in the trash.
Permanently remove web linkPermanently deletes a web link that is in the trash.
Preflight check before uploadPerforms a check to verify that a file will be accepted by box before you upload the entire file.
Promote file versionPromote a specific version of a file.
Query files folders by metadataCreate a search using sql-like syntax to return items that match specific metadata.
Refresh access tokenRefresh an access token using its client id, secret, and refresh token.
Remove box skill cards from fileRemoves any box skills cards metadata from a file.
Remove classification from fileRemoves any classifications from a file.
Remove classification from folderRemoves any classifications from a folder.
Remove collaborationDeletes a single collaboration.
Remove commentPermanently deletes a comment.
Remove device pinDeletes an individual device pin.
Remove domain from list of allowed collaboration domainsRemoves a domain from the list of domains that have been deemed safe to create collaborations for within the current enterprise.
Remove email aliasRemoves an email alias from a user.
Remove file versionMove a file version to the trash.
Remove groupPermanently deletes a group.
Remove legal hold policyDelete an existing legal hold policy.
Remove metadata cascade policyDeletes a metadata cascade policy.
Remove metadata instance from fileDeletes a piece of file metadata.
Remove metadata instance from folderDeletes a piece of folder metadata.
Remove metadata templateDelete a metadata template and its instances.
Remove retention policy assignmentRemoves a retention policy assignment applied to content.
Remove shared link from fileRemoves a shared link from a file.
Remove shared link from folderRemoves a shared link from a folder.
Remove shared link from web linkRemoves a shared link from a web link.
Remove taskRemoves a task from a file.
Remove upload sessionAbort an upload session and discard all data uploaded.
Remove User Domain ExemptionRemoves a user's exemption from the restrictions set out by the allowed list of domains for collaborations.
Remove user from groupDeletes a specific group membership.
Remove watermark from fileRemoves the watermark from a file.
Remove watermark from folderRemoves the watermark from a folder.
Remove webhookDeletes a webhook.
Remove web linkDeletes a web link.
Request access tokenRequest an access token using either a client-side obtained oauth 2.
Resend box sign requestResends a signature request email to all outstanding signers.
Restore fileRestores a file that has been moved to the trash.
Restore file versionRestores a specific version of a file after it was deleted.
Restore folderRestores a folder that has been moved to the trash.
Restore web linkRestores a web link that has been moved to the trash.
Review files on legal hold policy assignmentGet a list of files with current file versions for a legal hold assignment.
Revoke access tokenRevoke an active access token, effectively logging a user out that has been previously authenticated.
Search for contentSearches for files, folders, web links, and shared files across the users content or across the entire enterprise.
Starts workflow based on request bodyInitiates a flow with a trigger type of `workflow manual start`.
Transfer owned foldersTransfers ownership of a specific folder (with id 0) from one user to another in the box cloud storage system.
Unassign legal hold policyRemove a legal hold from an item.
Unassign storage policyDelete a storage policy assignment.
Unassign taskDeletes a specific task assignment.
Update ai agentUpdates an ai agent.
Update all box skill cards on fileAn alternative method that can be used to overwrite and update all box skill metadata cards on a file.
Update collaborationUpdates a collaboration.
Update commentUpdate the message of a comment.
Update fileUpdates a file.
Update file requestUpdates a file request.
Update folderUpdates a folder.
Update groupUpdates a specific group.
Update group membershipUpdates a user's group membership.
Update legal hold policyUpdate legal hold policy.
Update retention policyUpdates a retention policy.
Update shared link on fileUpdates a shared link on a file.
Update shared link on folderUpdates a shared link on a folder.
Update shared link on web linkUpdates a shared link on a web link.
Update shield information barrier segment with specified idUpdate shield information barrier segment with specified id
Update slack integration mappingUpdates a [slack integration mapping](https://support.
Update storage policy assignmentUpdates a specific storage policy assignment.
Update taskUpdates a task.
Update task assignmentUpdates a task assignment.
Update teams integration mappingUpdates a [teams integration mapping](https://support.
Update terms of serviceUpdates a specific terms of service.
Update terms of service status for existing userUpdates the status for a terms of service for a user.
Update userUpdates a managed or app user in an enterprise.
Update webhookUpdates a webhook.
Update web linkUpdates a web link object.
Upload fileUploads a small file to box.
Upload file versionUpdate a file's content.
Upload part of fileUploads a chunk of a file for an upload session.

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

What is Tool Router?

Composio's Tool Router 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 Tool Router

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

How the Tool Router works

The Tool Router 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 Claude/Anthropic API Key
  • Primary know-how of Claude Agents SDK
  • A Box account
  • Some knowledge of Python

Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
  • Go to the Anthropic Console and create an API key. You'll need credits to use the models.
  • 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.

Install dependencies

pip install composio-anthropic claude-agent-sdk python-dotenv

Install the Composio SDK and the Claude Agents SDK.

What's happening:

  • composio-anthropic provides Composio integration for Anthropic
  • claude-agent-sdk is the core agent framework
  • python-dotenv loads environment variables

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

Create a .env file in your project root.

What's happening:

  • COMPOSIO_API_KEY authenticates with Composio
  • USER_ID identifies the user for session management
  • ANTHROPIC_API_KEY authenticates with Anthropic/Claude

Import dependencies

import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()
What's happening:
  • We're importing all necessary libraries including the Claude Agent SDK and Composio
  • The load_dotenv() function loads environment variables from your .env file
  • This setup prepares the foundation for connecting Claude with Box functionality

Create a Composio instance and Tool Router session

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Box
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["box"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")
What's happening:
  • The function checks for the required COMPOSIO_API_KEY environment variable
  • We're creating a Composio instance using our API key
  • The create method creates a Tool Router session for Box
  • The returned url is the MCP server URL that your agent will use

Configure Claude Agent with MCP

# Configure remote MCP server for Claude
options = ClaudeAgentOptions(
    permission_mode="bypassPermissions",
    mcp_servers={
        "composio": {
            "type": "http",
            "url": url,
            "headers": {
                "x-api-key": os.getenv("COMPOSIO_API_KEY")
            }
        }
    },
    system_prompt="You are a helpful assistant with access to Box tools via Composio.",
    max_turns=10
)
What's happening:
  • We're configuring the Claude Agent options with the MCP server URL
  • permission_mode="bypassPermissions" allows the agent to execute operations without asking for permission each time
  • The system prompt instructs the agent that it has access to Box
  • max_turns=10 limits the conversation length to prevent excessive API usage

Create client and start chat loop

# Create client with context manager
async with ClaudeSDKClient(options=options) as client:
    print("\nChat started. Type 'exit' or 'quit' to end.\n")

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

        # Send query
        await client.query(user_input)

        # Receive and print response
        print("Claude: ", end="", flush=True)
        async for message in client.receive_response():
            if hasattr(message, "content"):
                for block in message.content:
                    if hasattr(block, "text"):
                        print(block.text, end="", flush=True)
        print()
What's happening:
  • The Claude SDK client is created using the async context manager pattern
  • The agent processes each query and streams the response back in real-time
  • The chat loop continues until the user types 'exit' or 'quit'

Run the application

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
What's happening:
  • This entry point runs the async chat_with_remote_mcp() function using asyncio.run()
  • The application will start, create the MCP connection, and begin the interactive chat session

Complete Code

Here's the complete code to get you started with Box and Claude Agent SDK:

import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Box
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["box"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")

    # Configure remote MCP server for Claude
    options = ClaudeAgentOptions(
        permission_mode="bypassPermissions",
        mcp_servers={
            "composio": {
                "type": "http",
                "url": url,
                "headers": {
                    "x-api-key": os.getenv("COMPOSIO_API_KEY")
                }
            }
        },
        system_prompt="You are a helpful assistant with access to Box tools via Composio.",
        max_turns=10
    )

    # Create client with context manager
    async with ClaudeSDKClient(options=options) as client:
        print("\nChat started. Type 'exit' or 'quit' to end.\n")

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

            # Send query
            await client.query(user_input)

            # Receive and print response
            print("Claude: ", end="", flush=True)
            async for message in client.receive_response():
                if hasattr(message, "content"):
                    for block in message.content:
                        if hasattr(block, "text"):
                            print(block.text, end="", flush=True)
            print()

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())

Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Box through Composio's Tool Router.

Key features:

  • Native MCP support through Claude's agent framework
  • Streaming responses for real-time interaction
  • Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

How to build Box MCP Agent with another framework

FAQ

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

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

Can I use Tool Router MCP with Claude Agent SDK?

Yes, you can. Claude Agent 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 Box tools.

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

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

Used by agents from

Context
ASU
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
ASU
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
ASU
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.