A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/box-community/mcp-server-box below:

box-community/mcp-server-box: An MCP server capable of interacting with the Box API

The 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-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 Box MCP Server project aims to provide a robust and flexible solution for managing and processing Box data using advanced AI and machine learning techniques.

Get your current user information and check connection status.

Start the Box application authorization process.

Search for files in Box.

Read the text content of a Box file.

Parameters:

Returns: File content

Ask Box AI about a file.

Parameters:

Returns: AI response

Ask Box AI about a hub. There is currently no way via API to discover a hub ID, so you must know the ID to use this tool. We will fix this in the future.

Parameters:

Returns: AI response

box_search_folder_by_name

Locate a folder by name.

Parameters:

Returns: Folder ID

Extract data from a file using AI.

Parameters:

Returns: Extracted data in JSON format

box_list_folder_content_by_folder_id

List folder contents.

Parameters:

Returns: Folder content in JSON format with id, name, type, and description

Create, update, or delete folders in Box.

Parameters:

Returns: Status message with folder details

box_search_folder_by_name_tool

Locate a folder in Box by its name.

box_ai_ask_file_single_tool

Query Box AI regarding a single file.

box_ai_ask_file_multi_tool

Query Box AI using multiple files.

Ask Box AI about a hub.

box_ai_extract_freeform_tool

Extract data from files using AI with a freeform prompt.

box_ai_extract_structured_using_fields_tool

Extract structured data from files using AI with specified fields.

box_ai_extract_structured_using_template_tool

Extract structured data from files using AI with a specified template.

box_ai_extract_structured_enhanced_using_fields_tool

Extract structured data from files using AI with enhanced processing and specified fields.

box_ai_extract_structured_enhanced_using_template_tool

Extract structured data from files using AI with enhanced processing and a template.

Read the text content of a Box file.

box_list_folder_content_by_folder_id

List a folder's content using its ID.

Create, update, or delete a folder in Box.

box_upload_file_from_path_tool

Upload a file to Box from a local filesystem path.

box_upload_file_from_content_tool

Upload content as a file to Box.

Download a file from Box.

box_metadata_template_create_tool

Create a metadata template.

box_metadata_template_get_by_key_tool

Retrieve a metadata template by its key.

box_metadata_template_get_by_name_tool

Retrieve a metadata template by its name.

box_metadata_set_instance_on_file_tool

Set a metadata instance on a file.

box_metadata_get_instance_on_file_tool

Get a metadata instance on a file.

box_metadata_update_instance_on_file_tool

Update a metadata instance on a file.

box_metadata_delete_instance_on_file_tool

Delete a metadata instance on a file.

box_docgen_create_batch_tool

Generate documents using a Box Doc Gen template and a local JSON file.

Fetch a single Doc Gen job by its ID.

box_docgen_list_jobs_tool

List all Doc Gen jobs associated with the current user.

box_docgen_list_jobs_by_batch_tool

List Doc Gen jobs belonging to a specific batch.

box_docgen_template_create_tool

Mark a file as a Box Doc Gen template.

box_docgen_template_list_tool

List all available Box Doc Gen templates.

box_docgen_template_delete_tool

Remove the Doc Gen template marking from a file.

box_docgen_template_get_by_id_tool

Retrieve details of a specific Doc Gen template.

box_docgen_template_list_tags_tool

List all tags associated with a Box Doc Gen template.

box_docgen_template_list_jobs_tool

List all Doc Gen jobs that used a specific template.

  1. Clone the repository:

    git clone https://github.com/box-community/mcp-server-box.git
    cd mcp-server-box
  2. 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"
  3. 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.2 Windows

    # Create virtual environment and activate it
    uv venv
    .venv\Scripts\activate
    
    # Lock the dependencies
    uv lock
  4. 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

The MCP server supports four transport methods: stdio (default), SSE (Server-Sent Events), HTTP (StreamableHttp), and FastAPI.

Running with stdio transport (default)
uv --directory /path/to/mcp-server-box run src/mcp_server_box.py
Using Claude as the client For stdio transport (recommended for Claude Desktop)
  1. Edit your claude_desktop_config.json:

    code ~/Library/Application\ Support/Claude/claude_desktop_config.json
  2. Add the configuration:

    {
        "mcpServers": {
            "mcp-server-box": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/path/to/mcp-server-box",
                    "run",
                    "src/mcp_server_box.py"
                ]
            }
        }
    }
  3. Restart Claude if it is running.

Using Cursor as the client
  1. Open your IDE with Cursor.

  2. In settings, select Cursor settings.

  3. In the left nav, select MCP.

  4. In the top-left, click Add new global MCP server.

  5. Paste the following JSON (update for your local values):

    {
      "mcpServers": {
        "box": {
          "command": "uv",
          "args": [
            "--directory",
            "/path/to/mcp-server-box",
            "run",
            "src/mcp_server_box.py"
          ]
        }
      }
    }
  6. Save and close the mcp.json file, and restart if necessary.

The project includes comprehensive test suites for both unit tests and integration tests to verify Box API functionality.

The project includes two types of tests:

  1. Unit Tests - Mock-based tests that don't require Box API access:

  2. Integration Tests - Tests that require actual Box API access (with _orig suffix):

Unit tests use mocks and don't require Box API credentials:

# Run all unit tests
pytest tests/test_box_tools_*.py tests/test_server_context.py tests/test_mcp_server_box.py

# Run specific unit test files
pytest tests/test_box_tools_ai.py
pytest tests/test_box_tools_generic.py
pytest tests/test_box_tools_metadata.py

# Run with coverage
pytest --cov=src tests/
Running Integration Tests

Integration tests require Box API credentials and valid file/folder IDs in your Box account:

  1. Set up Box API credentials in your .env file
  2. Update File and Folder IDs:
  3. File ID References:
# Run integration tests
pytest tests/test_*_orig.py

# Run specific integration test
pytest tests/test_box_tools_files_orig.py

# Run all tests (unit + integration)
pytest

# Run with detailed output
pytest -v

# Run with print statements
pytest -v -s

The test suite uses:

If you receive the error Error: spawn uv ENOENT on MacOS when running the MCP server with Claude Desktop, you may:

Note

Make sure your Box API credentials in .env are correctly set.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4