dbx-mcp-server

1.3.2 • Public • Published

dbx-mcp-server

A Model Context Protocol (MCP) server that provides comprehensive Dropbox integration with AI-powered PDF analysis capabilities. Features high-performance parallel processing, multi-directory indexing, and OpenRouter structured outputs for reliable document analysis.

Important Disclaimer: This project is not affiliated with, endorsed by, or sponsored by Dropbox. It is an independent integration that works with Dropbox's public API.

🚀 Key Features

  • 📁 Complete Dropbox Integration - Upload, download, search, and manage files
  • 🤖 AI-Powered PDF Analysis - Analyze PDFs with OpenRouter structured outputs using Gemini 2.5 Flash
  • 📊 Document Classification - Automatically classify documents as contracts, invoices, proposals, or reports
  • 🔍 Intelligent Document Search - Index and search documents by content and metadata
  • ⚡ High-Performance Processing - Parallel PDF analysis with configurable batch sizes (10-30 documents)
  • 📂 Multi-Directory Indexing - Index multiple directories simultaneously with targeted scoping
  • 💼 Business Intelligence - Track contract expirations, overdue invoices, and document analytics
  • 🏢 Dropbox Business Support - Full support for team accounts with user selection
  • 🔐 Enterprise Security - OAuth 2.0 with PKCE, encrypted token storage, and audit logging

Table of Contents

Quick Start

The fastest way to get started is using Claude Code with our npm package:

# Install the MCP server with Claude Code
claude mcp add dbx-mcp-server -- npx -y dbx-mcp-server

That's it! The server is now available in Claude Code. Continue to Authentication to set up your Dropbox credentials.

For manual installation or development, see Manual Installation.

Claude Code Installation

Prerequisites

Step 1: Add the MCP Server

Choose the installation scope that best fits your needs:

For Personal Use (User Scope)

# Available across all your projects
claude mcp add dbx-mcp-server -s user -- npx -y dbx-mcp-server

For Team Projects (Project Scope)

# Shared with your team via version control
claude mcp add dbx-mcp-server -s project -- npx -y dbx-mcp-server

For Current Project Only (Local Scope)

# Default - only for current project directory
claude mcp add dbx-mcp-server -- npx -y dbx-mcp-server

Step 2: Configure Environment Variables

Add your Dropbox credentials as environment variables:

# Add with environment variables
claude mcp add dbx-mcp-server -s user \
  -e DROPBOX_APP_KEY=your_app_key_here \
  -e DROPBOX_APP_SECRET=your_app_secret_here \
  -e DROPBOX_REDIRECT_URI=http://localhost:3000/callback \
  -e TOKEN_ENCRYPTION_KEY=your_32_plus_character_encryption_key \
  -e OPENROUTER_API_KEY=your_openrouter_api_key_here \
  -- npx -y dbx-mcp-server

Step 3: Verify Installation

Check that the server is properly configured:

# List all MCP servers
claude mcp list

# Get specific server details
claude mcp get dbx-mcp-server

# Test server connectivity in Claude Code
/mcp

Step 4: Authenticate with Dropbox

In Claude Code, ask Claude to help you authenticate:

"Help me set up authentication with Dropbox using the setup tool"

Claude will guide you through the OAuth process using the dbx_setup tool.

Scope Management

Claude Code offers three scopes for MCP server configuration:

Scope Storage Use Case Command Flag
Local Project-specific settings Personal dev, testing (default)
Project .mcp.json in repo Team collaboration -s project
User Global user settings Personal utilities -s user

Project scope is recommended for team environments as it creates a .mcp.json file that can be version controlled.

Troubleshooting

Server not starting?

# Check Node.js version
node --version  # Should be 18+

# Test server manually
npx dbx-mcp-server

Environment variables not loading?

# Verify your environment variables are set
claude mcp get dbx-mcp-server

Permission issues?

# Reset project choices if using project scope
claude mcp reset-project-choices

Manual Installation

For development or custom deployments:

1. Clone and Install

git clone https://github.com/olivierdebeuf/dbx-mcp-server.git
cd dbx-mcp-server
npm install
npm run build

2. Setup Dropbox App

Create app at Dropbox App Console:

  • Choose "Scoped access" API
  • Select required permissions: files.metadata.read, files.content.read, files.content.write, sharing.write, account_info.read
  • Add redirect URI: http://localhost:3000/callback
  • Note your App key and App secret

3. Get OpenRouter API Key

Sign up at OpenRouter for AI analysis

4. Configure Environment

# Create .env file with:
DROPBOX_APP_KEY=your_app_key
DROPBOX_APP_SECRET=your_app_secret
DROPBOX_REDIRECT_URI=http://localhost:3000/callback
TOKEN_ENCRYPTION_KEY=your_32_plus_character_encryption_key
OPENROUTER_API_KEY=your_openrouter_api_key

5. Run Setup & Test

npm run setup      # Complete OAuth authentication
npm run inspector  # Launch MCP inspector for testing

6. Start Analyzing PDFs! 🎉

Authentication

The server uses OAuth 2.0 with PKCE for secure authentication with Dropbox.

Environment Variables

Required:

  • DROPBOX_APP_KEY: Your Dropbox app's key
  • DROPBOX_APP_SECRET: Your Dropbox app's secret
  • DROPBOX_REDIRECT_URI: OAuth redirect URI
  • TOKEN_ENCRYPTION_KEY: 32+ character key for token encryption
  • OPENROUTER_API_KEY: API key for AI analysis (get from openrouter.ai)

Optional:

  • DROPBOX_BUSINESS_USER_ID: Team member ID for Dropbox Business accounts (auto-detected)
  • TOKEN_REFRESH_THRESHOLD_MINUTES: Minutes before expiration to refresh token (default: 5)
  • MAX_TOKEN_REFRESH_RETRIES: Maximum number of refresh attempts (default: 3)
  • TOKEN_REFRESH_RETRY_DELAY_MS: Delay between refresh attempts in ms (default: 1000)

Available Tools

File Operations

  • list_files: List files in a directory
  • upload_file: Upload a file
  • download_file: Download a file
  • safe_delete_item: Safely delete with recycle bin support
  • create_folder: Create a new folder
  • copy_item: Copy a file or folder
  • move_item: Move or rename a file/folder

Metadata and Search

  • get_file_metadata: Get file/folder metadata
  • search_file_db: Search files and folders
  • get_sharing_link: Create sharing links
  • get_file_content: Get file contents

Account Operations

  • get_account_info: Get account information

🤖 AI-Powered PDF Analysis Tools

  • dropbox_analyze_pdf: Analyze PDF files with custom AI prompts
  • dropbox_index_file: Index a single PDF for structured document management
  • dropbox_index_folder: Batch index all PDFs in a folder
  • dropbox_search_indexed: Search indexed documents by content and metadata
  • dropbox_document_stats: Get business intelligence and document analytics

PDF Analysis Features

🎯 Document Classification

The AI system automatically classifies PDFs into four main categories:

  1. 📄 Contracts - Legal agreements, service contracts, employment contracts

    • Extracts: parties, dates, values, terms, governing law
    • Tracks: expiration dates, renewal clauses, notice periods
  2. 🧾 Invoices - Bills, invoices, receipts, payment requests

    • Extracts: vendor details, amounts, due dates, line items
    • Tracks: overdue payments, payment status, tax information
  3. 📋 Proposals - Business proposals, project proposals, quotes

    • Extracts: client information, project details, timelines, deliverables
    • Tracks: proposal validity, project scope, pricing
  4. 📊 Reports - Research reports, financial reports, analysis documents

    • Extracts: findings, recommendations, data insights, conclusions
    • Tracks: report types, time periods, key metrics

🔍 Advanced Search & Analytics

  • Content-based search across all indexed documents
  • Metadata filtering by document type, date ranges, confidence scores
  • Business intelligence queries for expired contracts, overdue invoices
  • Document statistics and collection analytics

🏢 Enterprise Features

  • Dropbox Business support with automatic team member detection
  • Batch processing with configurable rate limiting
  • SQLite database for persistent document metadata storage
  • Confidence scoring for AI analysis quality assessment
  • Audit logging for compliance and tracking

🚫 Smart Exclusion System

Control exactly which files get indexed with flexible exclusion options:

  • Global exclusions via environment variables for organization-wide rules
  • Per-operation exclusions for specific indexing tasks
  • Path-based exclusions for exact folder matching
  • Pattern-based exclusions using glob patterns like */temp/*, *.backup/
  • Built-in defaults exclude system folders (.git, node_modules, .DS_Store, etc.)

Configuration Options:

# Global exclusions (applied to all indexing operations)
DROPBOX_INDEX_EXCLUDED_PATHS=/private,/temp,/backup

Usage Examples:

// Exclude specific paths and patterns
await mcp.useTool("dbx-mcp-server", "dropbox_index_folder", {
  path: "/documents",
  excludePaths: ["/documents/confidential"],
  excludePatterns: ["*/archive/*", "*/old_*"],
  respectGlobalExclusions: true
});

Usage Examples

Basic File Operations

// List files in root directory
await mcp.useTool("dbx-mcp-server", "list_files", { path: "" });

// Upload a file
await mcp.useTool("dbx-mcp-server", "upload_file", {
  path: "/test.txt",
  content: Buffer.from("Hello World").toString("base64"),
});

// Search for files
await mcp.useTool("dbx-mcp-server", "search_file_db", {
  query: "report",
  path: "/Documents",
  max_results: 10,
});

🤖 AI-Powered PDF Analysis

// Analyze a PDF with custom prompt
await mcp.useTool("dbx-mcp-server", "dropbox_analyze_pdf", {
  path: "/contracts/service_agreement.pdf",
  prompt: "Extract key contract terms, parties involved, and expiration date",
  useThinking: true  // Enable advanced reasoning mode
});

// Index a PDF for structured search
await mcp.useTool("dbx-mcp-server", "dropbox_index_file", {
  path: "/invoices/invoice_2024_001.pdf"
});

// Batch index entire folder
await mcp.useTool("dbx-mcp-server", "dropbox_index_folder", {
  path: "/documents",
  recursive: true,
  batchSize: 5  // Process 5 files at a time
});

// Index folder with exclusions
await mcp.useTool("dbx-mcp-server", "dropbox_index_folder", {
  path: "/documents",
  excludePaths: ["/documents/private", "/documents/temp"],
  excludePatterns: ["*/backup/*", "*/.git/*", "*/draft/*"],
  respectGlobalExclusions: true
});

// Search indexed documents
await mcp.useTool("dbx-mcp-server", "dropbox_search_indexed", {
  query: "overdue payments",
  docType: "invoice",  // Filter by document type
  limit: 10
});

// Get document analytics
await mcp.useTool("dbx-mcp-server", "dropbox_document_stats", {});

Real-World Use Cases

// Business Intelligence: Find expiring contracts
await mcp.useTool("dbx-mcp-server", "dropbox_search_indexed", {
  query: "expiring",
  docType: "contract"
});

// Financial Analysis: Track overdue invoices
await mcp.useTool("dbx-mcp-server", "dropbox_search_indexed", {
  query: "overdue",
  docType: "invoice"
});

// Document Management: Analyze proposal success rates
await mcp.useTool("dbx-mcp-server", "dropbox_document_stats", {});

Testing

Run the test suite:

npm test

Tests verify all operations including authentication, file operations, and error handling.

Test Structure

The test suite is organized into several modules:

  • Dropbox Operations: Tests for basic file operations (upload, download, list, etc.)
  • Account Operations: Tests for accessing account information
  • Search and Delete: Tests for search functionality and safe deletion with recycle bin support
  • Resource System: Tests for the MCP resource system integration

Handling Test Data

The tests use dynamically generated file and folder names based on timestamps to avoid conflicts. Test data is automatically cleaned up after test execution.

Running Specific Tests

To run a specific test file or test group:

npm test -- tests/dropbox/search-delete.test.ts  # Run specific test file
npm test -- -t "should search for files"        # Run tests matching description

Troubleshooting Tests

If tests fail with timing or authentication issues:

  1. Check that the mock implementations in tests/setup.ts match your test expectations
  2. Ensure test helpers are correctly configured
  3. For Jest scope errors, avoid referencing imported variables in mock factory functions

Development

Built with:

  • TypeScript
  • Model Context Protocol SDK
  • Dropbox SDK v10.34.0
  • Dropbox API v2

License

MIT License

Copyright (c) 2025 MCP Server Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i dbx-mcp-server

Weekly Downloads

10

Version

1.3.2

License

MIT

Unpacked Size

803 kB

Total Files

173

Last publish

Collaborators

  • markov_kernel