Table of contents
How to connect a Box MCP with Codex (4 steps)
.png)
When you hand Codex a task to build a document-processing job or a Box sync, you usually describe the files in the prompt.
That description rarely matches what's actually in the account. The real folder structure, the columns in a stored spreadsheet, and the way collaborated folders nest are details a summary skips.
So Codex generates a parser for an assumed file shape, path logic that breaks on the real hierarchy, or a sync that ignores collaborated folders entirely. The source of truth lives in Box, not in the few lines you wrote into the task.
To give Codex direct access to Box as it works through your coding tasks, we'll show you how to connect Box with Merge Agent Handler's Box MCP server.
How it works
Merge Agent Handler connects Codex to the Box API through the Merge CLI.
You install the CLI, authenticate once, and run a single setup command from your project root.
That command writes a Merge CLI section to your project's AGENTS.md file, which tells Codex when to call merge search-tools and merge execute-tool to reach Box.
Once connected, Merge handles OAuth token storage and refresh on your behalf, so you never embed Box credentials in your repo or manage per-user authorization state yourself.
Related: How to use the Box MCP in Claude Code
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Codex access (available via the OpenAI platform)
- pipx installed (run
pipx --versionto confirm, or install viapip install pipx) - A Box account with access to the folders your tasks need
If you want to connect Merge Agent Handler's Box MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
1. Install the Merge CLI
Install the Merge CLI with pipx: pipx install merge-api
Verify the install: merge --version
2. Log in to Merge
Run the following to authenticate the CLI with your Merge Agent Handler account: merge login
This links the CLI to your Merge account and stores your session credentials locally.
3. Add Agent Handler to Codex
From the root of the project where you want Codex to reach Box, run:
This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task needs Box data. The command is idempotent, safe to re-run if you need to reset the configuration.
Commit the updated AGENTS.md so the configuration travels with the repo.
4. Authenticate Box
Create a Codex task that needs live Box data, for example: "Read the spreadsheets in the /Financials folder, then scaffold a job that parses them into our internal schema and flags malformed rows."
The first time Codex invokes a Box tool, a Magic Link will appear to complete connector authentication. And once authenticated, Codex can reach your Box account through Merge for every later task in this project.
{{this-blog-only-cta}}
Box MCP FAQ
In case you have more questions on setting up and using the Box MCP with Codex, we've addressed several more commonly-asked questions below.
What can you do once the Box MCP is connected to Codex?
With Box connected, Codex can:
- Read a real data file before scaffolding a parser: pull an actual spreadsheet or JSON file so the parsing code it generates matches the real columns, delimiters, and encoding rather than an assumed layout
- Pull a folder structure before generating path or sync logic: fetch the real hierarchy, including collaborated folders, so the traversal and path-handling code it writes matches how the account is actually organized
- Read a spec or requirements document before scaffolding a feature: retrieve a document stored in Box so the code it generates follows the requirements in the source rather than a paraphrase of them
- Pull file metadata before generating test fixtures for a processing job: fetch real file names, sizes, and modification dates so the fixtures and assertions it produces reflect what the job will actually encounter
- Read multiple files before generating batch-processing code: fetch a set of files so the batching and error-handling code it writes accounts for the real variation across them
Why use Merge Agent Handler vs. a self-hosted Box MCP server?
You can build your own MCP server on top of the Box API. For one developer on one account, it's workable: create an app, run the OAuth flow, and write tool schemas for the endpoints your tasks touch.
It gets harder once more than one person uses it or tasks run in CI. Box issues short-lived access tokens with refresh tokens, and every connected user needs their own token pair, refresh cycle, and handling for revoked access.
A silent refresh failure means a Codex task quietly runs against stale or missing files, with no central view of which connections are live. A self-hosted server doesn't change that, since you still own the OAuth plumbing, the app, and now the server too.
Merge Agent Handler handles credential storage and token refresh across every connected user. You can scope exactly which Box operations a Codex task can call, and every call is logged with identity, timestamp, and inputs.
For an agent reading files that can contain contracts or financial records, scoped access plus full audit logging is the foundation you want in place first.
Why connect Box to Codex?
Box holds the data files, folder structures, and documents that file-handling code has to match exactly. Codex tasks that build parsers, sync jobs, or batch-processing pipelines need that ground truth to produce code that works against the real account.
The alternative is describing the files in the prompt, and those descriptions are always incomplete. A guessed column layout, an omitted collaborated folder, or an assumed file format is enough to make Codex generate code that fails on the first real file.
Connecting Box lets Codex read the actual files when a task needs them. The real spreadsheet before a parser, the real hierarchy before path logic, the real spec before a feature: Codex works from the account itself, not a paraphrase of it.
Can I use Merge Agent Handler's Box MCP with my employees?
Yes, Agent Handler for Employees is built to help organizations provision, secure, and govern how employees connect AI tools like Codex to systems like Box.
Common patterns include:
- Provisioning and access control via SCIM with identity providers like Okta and Microsoft Entra ID, so IT can manage which folders an employee's agent can reach by role or team
- DLP and policy enforcement on tool calls, so admins can block retrieval of confidential documents before results reach a Codex task's context
- User-level audit logging so security and IT teams can review which files and folders were accessed, by which employee identity, and when
Taken together, employees can use the Box MCP to scaffold parsers against real data files, generate sync jobs that handle the real folder structure, and build batch pipelines grounded in actual file metadata, and more, while IT keeps centralized control over which folders each agent can reach.
.png)
.png)


.png)