MCP Server Box
by box-community
An MCP server capable of interacting with the Box API
What is MCP Server Box
MCP Server Box
Description
MCP Server Box 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-sdk-gen
library and provides a set of tools to interact with Box files and folders.
The Model Context Protocol (MCP) is a framework designed to standardize the way models interact with various data sources and services. In this project, MCP is used to facilitate seamless integration with the Box API, enabling efficient and scalable operations on Box files and folders. The MCP Server Box project aims to provide a robust and flexible solution for managing and processing Box data using advanced AI and machine learning techniques.
Tools implemented
Box Tools
box_who_am_i
Get your current user information and check connection status.
Returns: User information string
box_authorize_app_tool
Start the Box application authorization process.
Returns: Authorization status message
box_search_tool
Search for files in Box.
Parameters:
query
(str): Search queryfile_extensions
(List[str], optional): File extensions to filter bywhere_to_look_for_query
(List[str], optional): Where to search (NAME, DESCRIPTION, FILE_CONTENT, COMMENTS, TAG)ancestor_folder_ids
(List[str], optional): Folder IDs to search within
Returns: Search results
box_read_tool
Read the text content of a Box file.
Parameters:
file_id
(str): ID of the file to read
Returns: File content
box_ask_ai_tool
Ask Box AI about a file.
Parameters:
file_id
(str): ID of the fileprompt
(str): Question for the AI
Returns: AI response
box_search_folder_by_name
Locate a folder by name.
Parameters:
folder_name
(str): Name of the folder
Returns: Folder ID
box_ai_extract_data
Extract data from a file using AI.
Parameters:
file_id
(str): ID of the filefields
(str): Fields to extract
Returns: Extracted data in JSON format
box_list_folder_content_by_folder_id
List folder contents.
Parameters:
folder_id
(str): ID of the folderis_recursive
(bool): Whether to list recursively
Returns: Folder content in JSON format with id, name, type, and description
box_manage_folder_tool
Create, update, or delete folders in Box.
Parameters:
action
(str): Action to perform: "create", "delete", or "update"folder_id
(str, optional): ID of the folder (required for delete/update)name
(str, optional): Folder name (required for create, optional for update)parent_id
(str, optional): Parent folder ID (required for create, optional for update)description
(str, optional): Folder description (optional for update)recursive
(bool, optional): Whether to delete recursively (optional for delete)
Returns: Status message with folder details
box_upload_file_tool
Upload content as a file to Box.
Parameters:
content
(str): The content to upload as a filefile_name
(str): The name to give the file in Boxfolder_id
(Any, optional): The ID of the folder to upload to
Returns: Upload status with file ID and name
box_download_file_tool
Download a file from Box and return its content.
Parameters:
file_id
(Any): The ID of the file to downloadsave_file
(bool, optional): Whether to save the file locallysave_path
(str, optional): Path where to save the file
Returns: File content as text, base64-encoded image, or save status message
Requirements
- Python 3.13 or higher
- Box API credentials (Client ID, Client Secret, etc.)
Installation
-
Clone the repository:
git clone https://github.com/box-community/mcp-server-box.git cd mcp-server-box
-
Install
uv
if not installed yet:2.1 MacOS+Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
2.2 Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
-
Create and set up our project:
3.1 MacOS+Linux
# Create virtual environment and activate it uv venv source .venv/bin/activate # Lock the dependencies uv lock
3.1 Windows
# 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 add your Box API credentials:BOX_CLIENT_ID=your_client_id BOX_CLIENT_SECRET=your_client_secret
Usage
Running the MCP Server
To start the MCP server, run the following command:
uv --directory /Users/anovotny/Desktop/mcp-server-box run src/mcp_server_box.py
Using Claude as the client
- Edit your
claude_desktop_config
.json
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
- And add the following:
{
"mcpServers": {
"mcp-server-box": {
"command": "uv",
"args": [
"--directory",
"/Users/anovotny/Desktop/mcp-server-box",
"run",
"src/mcp_server_box.py"
]
}
}
}
- If CLaude is running restart it
## Running Tests
The project includes a suite of tests to verify Box API functionality. Before running the tests, you'll need to update the file and folder IDs in the test files to match files in your Box account.
### Setting Up Tests
1. **Update File and Folder IDs**:
- Each test file (in the `tests/` directory) contains hardcoded IDs for Box files and folders
- You need to replace these IDs with IDs of files and folders in your Box account
- Example: In `test_box_api_read.py`, replace `"1728677291168"` with the ID of a file in your Box account
2. **Test File ID References**:
- `test_box_api_read.py`: Needs a valid document file ID (e.g., a Word document)
- `test_box_api_search.py`: Update the search queries and file extensions to match your content
- `test_box_api_ai.py`: Needs a file ID for testing AI extraction capabilities
- Other test files may require specific folder IDs or file types
### Running Tests
Once you've updated the file IDs, you can run tests using pytest:
```bash
# Run all tests
pytest
# Run a specific test file
pytest tests/test_box_api_file_ops.py
# Run tests with detailed output
pytest -v
# Run tests and show print statements
pytest -v -s
Available Tests
test_box_auth.py
: Tests authentication functionalitytest_box_api_basic.py
: Basic Box API teststest_box_api_read.py
: Tests file reading capabilitiestest_box_api_search.py
: Tests search functionalitytest_box_api_ai.py
: Tests AI-based featurestest_box_api_file_ops.py
: Tests file upload and download operations
Creating New Tests
When creating new tests:
- Follow the pattern in existing test files
- Use the
box_client
fixture for authenticated API access - Clean up any test files or folders created during tests
- Add proper assertions to verify functionality
Troubleshooting
Leave a Comment
Comments section will be available soon. Stay tuned!
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
21st.dev Magic AI Agent
It's like v0 but in your Cursor/WindSurf/Cline. 21st dev Magic MCP server for working with your frontend like Magic
Requirements:
A Model Context Protocol Server for connecting with Adfin APIs
AgentQL MCP Server
Model Context Protocol server that integrates AgentQL's data extraction capabilities.
AgentRPC
A universal RPC layer for AI agents. Connect to any function, any language, any framework, in minutes.
Aiven MCP Server
Model Context Protocol server for Aiven
IoTDB MCP Server
Apache IoTDB MCP Server
Apify Model Context Protocol (MCP) Server
Model Context Protocol (MCP) Server for Apify's Actors
APIMatic Validator MCP Server
APIMatic Validator MCP Server for validating OpenAPI specs via APIMatic's API with MCP
๐ Audiense Insights MCP Server
Audiense Insights MCP Server is a server based on the Model Context Protocol (MCP) that allows Claude and other MCP-compatible clients to interact with your Audiense Insights account
Bankless Onchain MCP Server
Bringing the bankless onchain API to MCP
Submit Your MCP Server
Share your MCP server with the community
Submit Now