Self-hosted Box MCP Server
Self-hosted Box MCP Server
The Self-hosted Box MCP Server is a Python project that integrates with the Box API to perform various operations such as file search, text extraction, AI-based querying, and data extraction. It leverages the Box Python Next Gen SDK library and provides a set of tools to interact with Box files and folders.
Installation
Prerequisites
- Python 3.13 or higher
- Box Platform app credentials (Client ID, Client Secret)
Follow the steps from this section to set up the self-hosted Box MCP Server.
- Clone the repository:
git clone https://github.com/box-community/mcp-server-box.git
cd mcp-server-box
- Install
uv
if it's not installed on your machine:
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Restart your terminal afterwards to ensure that the uv
command gets picked up.
- Create and set up our project:
# Create virtual environment and activate it
uv venv
source .venv/bin/activate
# Lock the dependencies
uv lock
# Create virtual environment and activate it
uv venv
.venv\Scripts\activate
# Lock the dependencies
uv lock
- Create a
.env
file in the root directory and fill your Box Platform app credentials:
BOX_CLIENT_ID=your_client_id
BOX_CLIENT_SECRET=your_client_secret
You can also watch a video tutorial and see example usage of Box MCP tools.
Running Box MCP Server locally
To start the Box MCP Server, run the following command:
uv --directory /Users/USER_NAME/PATH_TO_PROJECT/mcp-server-box run src/mcp_server_box.py
Update the path so it reflects your local setup.
Use Cursor as the Box MCP client
Prerequisites:
- Download Cursor desktop app
Follow these instructions to start using Box MCP Sever with Cursor:
- Open the Cursor app.
- Click the cog icon to open settings.
- Select
MCP
within the Cursor Settings tab. - Click the
Add new global MCP server
button. This opens themcp.json
file. - Update the values with your local setup and paste the following JSON:
{
"mcpServers": {
"box": {
"command": "uv",
"args": [
"--directory",
"/Users/USER_NAME/PATH_TO_PROJECT/mcp-server-box",
"run",
"src/mcp_server_box.py"
]
}
}
}
- Save and close the
mcp.json
file. - Restart Cursor if necessary.
- Use the
box_authorize_app_tool
tool to start using Box MCP.
Use Claude for Desktop as the Box MCP client
Prerequisites:
- Download Claude for Desktop client
- Optionally, set up
code
command for VS Code
Follow these steps to set up Box MCP in Claude for Desktop:
- Edit your
claude_desktop_config.json
.
You can run this command in your terminal:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Alternatively, in the main Claude navigation choose Settings
. Select the Developers tab and click Edit Config
. This opens a folder window containing claude_desktop_config.json
.
- Add the configuration:
{
"mcpServers": {
"mcp-server-box": {
"command": "uv",
"args": [
"--directory",
"/Users/Users/USER_NAME/PATH_TO_PROJECT/mcp-server-box",
"run",
"src/mcp_server_box.py"
]
}
}
}
- Restart Claude for Desktop.
- Authenticate the Box MCP Server using
box_authorize_app_tool
tool.
Available tools
Authentication and user tools
Tool | Description | Parameters | Returns |
---|---|---|---|
box_who_am_i | Gets the current user information and checks the connection status. | None | User information string. |
box_authorize_app_tool | Starts the Box application authorization process. | None | Authorization status message. |
Search and navigation tools
Tool | Description | Parameters | Returns |
---|---|---|---|
| Search for files in Box |
| Newline-separated list of file names and IDs |
| Locate a folder by name |
| Folder ID and information |
| List folder contents |
| Folder content in JSON format |
File operations
Tool | Description | Parameters | Returns |
---|---|---|---|
| Read the text content of a Box file |
| File content |
| Upload a file from local path |
| File details or error message |
| Upload content as a file |
| Upload success message |
| Download a file from Box |
| File content or save confirmation |
Folder Management
Tool | Description | Parameters | Returns |
---|---|---|---|
| Create, update, or delete folders |
| Status message with folder details |
Box AI tools
Tool | Description | Parameters | Returns |
---|---|---|---|
| Ask Box AI about a file |
| AI response |
| Query Box AI using multiple files |
| AI-generated answer |
| Ask Box AI about a hub |
| AI response |
| Extract data from a file using AI |
| Extracted data in JSON format |
Box Doc Gen tools
Tool | Description | Parameters | Returns |
---|---|---|---|
| Generate documents using a template |
| Batch generation result |
| Fetch a Doc Gen job by ID |
| Job details in JSON |
| List all Doc Gen jobs |
| List of jobs in JSON |
| List jobs in a specific batch |
| Batch jobs details |
| Mark a file as a template |
| Template details |
| List all available templates |
| List of templates |
| Remove template marking |
| Deletion confirmation |
| Get template details |
| Template details |
| List template tags |
| List of tags |
| List jobs using a template |
| Job details |
Troubleshooting
In case of an Error: spawn uv ENOENT
on MacOS when running the MCP server with Claude Desktop, you can:
- Remove
uv
and reinstall it with Homebrew:brew install uv
. - Provide the full path to the
uv
executable in your configuration:
/Users/USER_NAME/.local/bin/uv --directory /Users/USER_NAME/local/mcp-server-box run src/mcp_server_box.py
In case of additional issues related to setup, post your question on our Developer Community forum.