Back to MCP directory
publicPublicdnsLocal runtime

Dropbox

一个提供与Dropbox集成的MCP服务器,允许MCP兼容客户端通过一套强大的工具与Dropbox交互。

article

README

🚀 dbx-mcp-server

dbx-mcp-server 是一个与 Dropbox 集成的模型上下文协议(MCP)服务器。借助一系列强大工具,它能让 MCP 兼容客户端通过 Dropbox 公开 API 进行交互。

⚠️ 重要声明

该项目未得到、获得或由 Dropbox 赞助,是一个独立的集成项目,通过 Dropbox 的公共 API 开展工作。

🚀 快速开始

  1. 克隆仓库。
  2. 运行 npm install 安装依赖项。
  3. 运行 npm run build 构建项目。
  4. Dropbox应用控制台注册一个 Dropbox 应用:
    • 选择“范围访问”API。
    • 选择您的应用所需的访问类型。
    • 命名您的应用并点击“继续”。
    • 添加回调 URL(例如:http://localhost:3000/callback)。
  5. 获取生成的应用密钥和秘密,并将它们添加到 dropbox.json 文件中:
    {
      "DROPBOX_APP_KEY": "your-app-key",
      "DROPBOX_APP_SECRET": "your-app-secret"
    }
    
  6. 安装并运行 MCP 代理以开始使用。

📦 安装指南

git clone [仓库地址]
cd dbx-mcp-server
npm install

✨ 主要特性

  • 简化了与 Dropbox API 的交互。
  • 提供统一的身份验证流。
  • 支持多种用户身份验证方法。

🔐 身份验证

该服务器使用OAuth 2.0标准进行身份验证,具体实现采用AUTHORIZATION_CODE授予类型。支持的范围包括文件和目录访问权限。

💻 可用工具

文件操作

// 上传文件
async function uploadFile(filePath: string, content: Buffer): Promise<void> {
  const dbx = new DropboxClient();
  await dbx.files.upload(filePath, content);
}

// 下载文件
async function downloadFile(filePath: string): Promise<Buffer> {
  const dbx = new DropboxClient();
  return await dbx.files.download(filePath);
}

目录管理

// 创建目录
async function createDirectory(directoryPath: string): Promise<void> {
  const dbx = new DropboxClient();
  await dbx.files.createFolder(directoryPath);
}

// 删除目录
async function deleteDirectory(directoryPath: string): Promise<void> {
  const dbx = new DropboxClient();
  await dbx.files.deleteFolder(directoryPath);
}

文件共享

// 分享文件
async function shareFile(filePath: string): Promise<string> {
  const dbx = new DropboxClient();
  return await dbx.sharing.createShare(filePath);
}

// 恢复已分享的文件
async function restoreSharedFile(shareId: string): Promise<Buffer> {
  const dbx = new DropboxClient();
  return await dbx.sharing.revoke(shareId);
}

⚙️ 配置

环境变量

# 推荐设置
export DROPBOX_APP_KEY="your-app-key"
export DROPBOX_APP_SECRET="your-app-secret"

应用配置文件

创建 config.json 文件:

{
  "dropbox": {
    "appKey": "your-app-key",
    "appSecret": "your-app-secret"
  }
}

💻 使用示例

基础用法

import { DropboxClient } from './dbx-mcp-server';

async function main() {
  const dbx = new DropboxClient();
  
  // 上传本地文件
  await dbx.files.upload('/uploads/test.txt', fs.readFileSync('test.txt'));
  
  // 下载远程文件
  const content = await dbx.files.download('/uploads/test.txt');
  console.log(content.toString());
}

main().catch(console.error);

高级用法

import { DropboxClient } from './dbx-mcp-server';

async function main() {
  const dbx = new DropboxClient();
  
  // 创建新目录
  await dbx.files.createFolder('/my-new-folder');
  
  // 删除目录
  await dbx.files.deleteFolder('/my-empty-folder');
}

🧪 测试

快速运行测试

npm test

指定测试文件

npm test tests/dropbox/search-delete.test.ts

过滤测试描述

npm test -- -t "should search for files"

🛠️ 开发

该服务器使用以下技术构建:

📄 许可证

MIT License

版权 (c) 2025 MCP Server Contributors

允许任何人免费获得和分发此软件及其关联的文档文件(“软件”),并且可以不受限制地进行研究、开发、测试、商业部署或销售。

在以下条件下,您可以在任何情况下使用、复制、修改、合并、发布、分发、 sublicense 和/或出售该软件,并允许获得该软件的人对其进行操作:

  1. 本版权声明和此许可声明必须包含在所有副本或该软件的实质性部分中。
  2. 本软件按“原样”提供,不附带任何明示或暗示的保证。包括但不限于对适销性、适用性和非侵权性的保证。

贡献者

  • [你的名字] - 初始实现
  • [其他贡献者]
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client