Box MCP Server

Box MCP Server

Enables Large Language Models to securely interact with Box cloud storage, including file upload, retrieval, search, and AI-powered analysis, without storing files locally.

Category
访问服务器

README

Box MCP Server

A Model Context Protocol (MCP) server that provides secure access to Box cloud storage without local file persistence. This server enables Large Language Models to interact with Box files, folders, and AI capabilities through a standardized MCP interface.

Features

🔧 8 Core Tools (Intent-Based)

  • box_save_documents - Batch upload documents with automatic folder creation
  • box_read_document - Stream document content without local storage
  • box_manage_folders - Create and organize folder structures
  • box_explore_storage - Navigate Box directory tree with filtering
  • box_share_content - Create shared links and manage collaborations
  • box_analyze_document - Use Box AI for document analysis, Q&A, and extraction
  • box_search_content - Natural language search with advanced filtering
  • box_retrieve_documents - Batch retrieval with optional local saving

📚 MCP Resources (6 URI Templates)

  • box://file/{fileId} - Access specific Box files by ID
  • box://folder/{folderId} - Access specific Box folders by ID
  • box://search?q={query} - Search Box content with query parameters
  • box://user/storage - Current user's storage quota and usage
  • box://user/recent - Recently accessed files
  • box://folder/root/tree - Complete folder structure from root

💬 MCP Prompts (5 Interactive Templates)

  • share_file - Create shared links with customizable permissions
  • analyze_document - Use Box AI to analyze documents with specific prompts
  • organize_folder - Organize files using different strategies (by date, type, name)
  • bulk_upload - Upload multiple files with folder organization
  • collaboration_setup - Set up collaboration with specific users and roles

🔒 Security & Compliance

  • Zero Local Storage - All documents remain in Box cloud
  • Multi-Auth Support - OAuth 2.0, Client Credentials Grant (CCG), JWT
  • Encrypted Credentials - Secure token storage and auto-refresh
  • Enterprise-Grade - Leverages Box's enterprise security features

Quick Start

Prerequisites

  1. Box Developer Account - Create at Box Developer Console
  2. Node.js 18+ - Download Node.js
  3. Box App Configuration - OAuth 2.0 or Client Credentials Grant app

Installation

# Clone and install
git clone https://github.com/your-org/mcp-box
cd mcp-box
npm install

# Build the server
npm run build

Configuration

Create a .env file in the project root:

# Authentication Method (oauth | ccg)
AUTH_TYPE=oauth

# Box App Credentials
BOX_CLIENT_ID=your_client_id_here
BOX_CLIENT_SECRET=your_client_secret_here
BOX_ENTERPRISE_ID=your_enterprise_id_here  # Required for CCG

# Server Configuration
MCP_TRANSPORT=stdio              # stdio | http
LOG_LEVEL=info                   # debug | info | warn | error
NODE_ENV=development

Authentication Setup

OAuth 2.0 (Recommended for individual use)

Step 1: Box Developer Console Setup

  1. Go to Box Developer Console: https://developer.box.com/

  2. Create Custom App:

    • Click "Create New App"
    • Select "Custom App"
    • Choose "User Authentication (OAuth 2.0)"
    • Name your app (e.g., "MCP Box Server")
  3. Configure OAuth Settings:

    • Redirect URI: http://localhost:3000/auth/callback
    • Application Scopes: Select all needed permissions:
      • ✅ Read all files and folders
      • ✅ Write all files and folders
      • ✅ Manage users
      • ✅ Manage enterprise properties
    • Save your configuration
  4. Get Credentials:

    • Copy Client ID
    • Copy Client Secret

Step 2: Configure Your .env File

# OAuth 2.0 Configuration
AUTH_TYPE=oauth
BOX_CLIENT_ID=your_client_id_here
BOX_CLIENT_SECRET=your_client_secret_here

# Server Configuration
MCP_TRANSPORT=stdio
LOG_LEVEL=info
NODE_ENV=development

Step 3: First-Time Authentication

# Build and start the server
npm run build
npm start

What happens:

  1. Server detects no stored OAuth tokens
  2. Opens browser to Box login page automatically
  3. You log in with your Box credentials
  4. Box redirects back with authorization code
  5. Server exchanges code for access/refresh tokens
  6. Tokens are securely stored for future use

Client Credentials Grant (Enterprise)

Step 1: Box Developer Console Setup

  1. Go to Box Developer Console: https://developer.box.com/

  2. Create Custom App:

    • Click "Create New App"
    • Select "Custom App"
    • Choose "Server Authentication (Client Credentials Grant)"
    • Name your app (e.g., "MCP Box Server Enterprise")
  3. Configure CCG Settings:

    • Application Scopes: Select enterprise permissions needed
    • Enterprise ID: Note your enterprise ID
    • Submit for Approval: Enterprise admin must approve
  4. Get Credentials:

    • Copy Client ID
    • Copy Client Secret
    • Copy Enterprise ID

Step 2: Configure Your .env File

# CCG Configuration
AUTH_TYPE=ccg
BOX_CLIENT_ID=your_client_id
BOX_CLIENT_SECRET=your_client_secret
BOX_ENTERPRISE_ID=your_enterprise_id

# Server Configuration
MCP_TRANSPORT=stdio
LOG_LEVEL=info
NODE_ENV=production

Step 3: Enterprise Admin Approval

  • Enterprise admin must approve the app in Box Admin Console
  • Once approved, server will authenticate automatically

Integration Guides

Claude Code Integration

Add this MCP server to Claude Code for seamless Box integration:

  1. Build the server:

    npm run build
    
  2. Add to Claude Code configuration:

    Option A: Via Claude Code UI

    • Open Claude Code settings
    • Navigate to "MCP Servers"
    • Add new server with these settings:
      • Name: box-mcp-server
      • Command: node
      • Args: ["/Users/your-username/path-to/mcp-box/dist/index.js"]
      • Environment Variables: Add your .env variables

    Option B: Edit Claude Code config file

    {
      "mcpServers": {
        "box-mcp-server": {
          "command": "node",
          "args": ["/Users/your-username/path-to/mcp-box/dist/index.js"],
          "env": {
            "AUTH_TYPE": "oauth",
            "BOX_CLIENT_ID": "your_client_id",
            "BOX_CLIENT_SECRET": "your_client_secret"
          }
        }
      }
    }
    
  3. Restart Claude Code and verify the server appears in MCP servers list

  4. Test the integration:

    @box-mcp-server List my recent Box files
    @box-mcp-server Analyze the quarterly report in folder "Reports/2024"
    @box-mcp-server Share the presentation with my team
    

Claude Desktop Integration

For Claude Desktop, add to your MCP configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "box-mcp-server": {
      "command": "node",
      "args": ["/path/to/mcp-box/dist/index.js"],
      "env": {
        "AUTH_TYPE": "oauth",
        "BOX_CLIENT_ID": "your_client_id",
        "BOX_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Other MCP Clients

The server supports standard MCP transports:

STDIO (Default):

node dist/index.js

HTTP with Server-Sent Events:

MCP_TRANSPORT=http MCPSERVER_PORT=3000 AUTH_TOKEN=your_secret node dist/index.js

Usage Examples

Document Management

// Save multiple documents with organization
{
  "name": "box_save_documents",
  "arguments": {
    "documents": [
      {
        "content": "Meeting notes content...",
        "path": "Projects/2024/Q4/meeting-notes.md",
        "metadata": { "classification": "Internal" }
      }
    ],
    "options": {
      "createFolders": true,
      "shareSettings": { "createLink": true, "linkAccess": "company" }
    }
  }
}

AI-Powered Analysis

// Analyze document with Box AI
{
  "name": "box_analyze_document",
  "arguments": {
    "path": "Contracts/partnership-agreement.pdf",
    "analysisType": "qa",
    "options": {
      "questions": ["What are the key payment terms?", "When does this contract expire?"]
    }
  }
}

Smart Search

// Natural language search
{
  "name": "box_search_content",
  "arguments": {
    "query": "quarterly financial reports from 2024 with revenue data",
    "filters": {
      "extensions": ["pdf", "xlsx"],
      "dateRange": { "from": "2024-01-01" },
      "includeContent": true
    }
  }
}

MCP Protocol Support

This server implements the full MCP specification (v2025-06-18):

  • ✅ Tools - 8 intent-based tools with structured input/output
  • ✅ Resources - 6 Box URI templates for LLM context
  • ✅ Prompts - 5 interactive templates for common workflows
  • ✅ Transports - STDIO and HTTP/SSE support
  • ✅ Authentication - Bearer token support for HTTP transport
  • ✅ Error Handling - Comprehensive error responses with user-friendly messages

Development

Running Tests

# Unit + Integration tests
npm test

# E2E tests (requires Box credentials)
npm run test:e2e

# Test coverage
npm run test:coverage

Development Server

# Watch mode with hot reload
npm run dev

# Debug mode with verbose logging
LOG_LEVEL=debug npm start

Project Structure

mcp-box/
├── src/
│   ├── server.ts           # MCP server implementation
│   ├── index.ts           # Entry point & transport setup
│   ├── types.ts           # TypeScript definitions
│   ├── box/               # Box API client
│   └── tools/             # Individual MCP tools
├── tests/                 # Test suites
├── docs/                  # Planning documentation
└── dist/                  # Compiled JavaScript

API Reference

Tools

Tool Description Key Features
box_save_documents Upload files to Box Batch upload, auto-folder creation, metadata
box_read_document Read file content Stream content, no local storage, text extraction
box_manage_folders Folder operations Create, move, rename, delete, batch operations
box_explore_storage Navigate folders Tree view, filtering, size info
box_share_content Sharing & collaboration Shared links, collaborator management
box_analyze_document Box AI analysis Summarize, extract, Q&A, classify, translate
box_search_content Content search Natural language, filters, metadata search
box_retrieve_documents Download files Batch download, optional local save

Resources

URI Template Description
box://file/{fileId} Access file by ID
box://folder/{folderId} Access folder by ID
box://search?q={query} Search results
box://user/storage Storage quota info
box://user/recent Recent files
box://folder/root/tree Complete folder tree

Prompts

Prompt Purpose Arguments
share_file Create shared links fileId, access, password, expiresAt
analyze_document AI document analysis fileId, analysisType, prompt, focus
organize_folder File organization folderId, strategy, createSubfolders
bulk_upload Multiple file upload targetFolder, createFolders, classification
collaboration_setup Team collaboration itemId, itemType, collaborators, role

Troubleshooting

Authentication Issues

OAuth 2.0 Troubleshooting

  • Browser doesn't open automatically?
    # Manual OAuth URL will be displayed in console
    # Copy and paste into browser
    
  • "Invalid redirect URI" error?
    • Check Box app configuration matches your server settings
    • Ensure redirect URI is exactly: http://localhost:3000/auth/callback
    • Verify no trailing slashes or extra characters
  • "Access denied" during login?
    • Check Box app has correct scopes enabled
    • Verify user has access to requested files/folders
    • Ensure app is not disabled in Box Admin Console
  • Tokens not persisting?
    • Check file system permissions for token storage
    • Verify .env file has correct credentials
    • Try deleting stored tokens and re-authenticating

CCG Troubleshooting

  • CCG Setup: Verify enterprise ID and app approval status
  • "App not authorized" error?
    • Enterprise admin must approve app in Box Admin Console
    • Check enterprise ID matches exactly
    • Verify app has required scopes enabled
  • Token Refresh: Check credential storage permissions

General Auth Issues

  • "Invalid client" errors: Double-check Client ID and Client Secret
  • "Unauthorized" responses: Verify auth method matches Box app type
  • Token refresh failures: Check network connectivity and Box API status

Common Errors

  • File Not Found: Use box_search_content to find correct file paths
  • Permission Denied: Verify Box app scopes and user permissions
  • Rate Limits: Server handles throttling automatically with exponential backoff

Debugging

# Enable debug logging
LOG_LEVEL=debug node dist/index.js

# Test MCP protocol compliance
npm run test:contract

# Validate Box API connectivity
npm run test:integration

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Follow TDD: Write tests first, then implementation
  4. Ensure all tests pass: npm test
  5. Update documentation as needed
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support


Secure document management meets AI - Keep your files in Box cloud while enabling powerful AI interactions through the Model Context Protocol.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选