Tencent Cloud COS MCP Server

Tencent Cloud COS MCP Server

Enables interaction with Tencent Cloud Object Storage (COS) through MCP protocol. Supports file upload, download, deletion, listing objects, and generating temporary signed URLs for cloud storage management.

Category
访问服务器

README

腾讯云 COS MCP 服务器

一个基于 Node.js 的 Model Context Protocol (MCP)服务器,为 Claude Desktop、Cursor 和 Windsurf 等 IDE 提供腾讯云对象存储(COS)功能。

功能特性

  • 🚀 文件上传 - 支持单文件和批量文件上传到腾讯云 COS
  • 🔗 临时 URL - 生成带签名的临时访问链接,支持自定义过期时间
  • 📋 文件管理 - 列出存储桶中的对象,支持前缀过滤
  • 🗑️ 文件删除 - 安全删除 COS 中的指定对象
  • 🔧 MCP 兼容 - 完全兼容 Model Context Protocol 规范

快速开始

本地调试

# 克隆项目
git clone https://github.com/156554395/tx-cos-mcp.git
cd tx-cos-mcp

# 安装依赖
pnpm install

# 配置环境变量
export COS_SECRET_ID=your-secret-id
export COS_SECRET_KEY=your-secret-key
export COS_REGION=your-region
export COS_BUCKET=your-bucket
export COS_DOMAIN=your-custom-domain.com

# 启动调试服务器
pnpm inspector

环境配置

服务器通过环境变量读取腾讯云 COS 配置:

作为 MCP 服务器使用(推荐)

在 MCP 兼容编辑器中配置:

{
  "command": "npx",
  "args": ["-y", "tx-cos-mcp"],
  "env": {
    "COS_SECRET_ID": "your-secret-id",
    "COS_SECRET_KEY": "your-secret-key",
    "COS_REGION": "your-region",
    "COS_BUCKET": "your-bucket",
    "COS_DOMAIN": "your-custom-domain.com",
    "transportType": "stdio"
  }
}

环境变量说明

变量名 必需 说明 示例
COS_SECRET_ID 腾讯云 Secret ID AKIDxxx...
COS_SECRET_KEY 腾讯云 Secret Key xxx...
COS_REGION COS 地域 ap-beijing, ap-shanghai
COS_BUCKET 存储桶名称 my-bucket-1234567890
COS_DOMAIN 自定义域名 cdn.example.com

MCP 工具列表

1. upload_file - 单文件上传

{
  "file_path": "/path/to/local/file.jpg",    // 必需:本地文件路径
  "object_key": "images/file.jpg",           // 可选:COS中的对象键
  "custom_domain": "cdn.example.com"        // 可选:自定义域名
}

2. upload_multiple - 批量文件上传

{
  "files": [
    {
      "file_path": "/path/to/file1.jpg",
      "object_key": "images/file1.jpg"       // 可选
    },
    {
      "file_path": "/path/to/file2.png"      // 使用文件名作为对象键
    }
  ]
}

3. get_signed_url - 获取临时访问 URL

{
  "object_key": "images/file.jpg",          // 必需:COS对象键
  "expire_time": 3600                       // 可选:过期时间(秒),默认1小时
}

4. list_objects - 列出存储桶对象

{
  "prefix": "images/"                       // 可选:对象键前缀过滤
}

5. delete_object - 删除对象

{
  "object_key": "images/file.jpg"           // 必需:要删除的对象键
}

IDE 集成配置

使用本地运行集成

{
  "mcpServers": {
    "tx-cos-mcp": {
      "command": "node",
      "args": ["your-absolute-path/tx-cos-mcp/index.js"],
      "env": {
        "COS_SECRET_ID": "your-secret-id",
        "COS_SECRET_KEY": "your-secret-key",
        "COS_REGION": "your-region",
        "COS_BUCKET": "your-bucket",
        "COS_DOMAIN": "your-custom-domain.com"
      }
    }
  }
}

已发布到 npm 集成

{
  "mcpServers": {
    "tx-cos-mcp": {
      "command": "npx",
      "args": ["y", "tx-cos-mcp"],
      "env": {
        "COS_SECRET_ID": "your-secret-id",
        "COS_SECRET_KEY": "your-secret-key",
        "COS_REGION": "your-region",
        "COS_BUCKET": "your-bucket",
        "COS_DOMAIN": "your-custom-domain.com"
      },
      "transportType": "stdio"
    }
  }
}

Claude code 中集成

在配置中添加 MCP 服务器配置,使用相同的 JSON 格式。

Cursor IDE

在设置中添加 MCP 服务器配置,使用相同的 JSON 格式。

Windsurf IDE

参考官方文档配置 MCP 服务器,使用上述配置参数。

常用命令

# 查看版本
npx tx-cos-mcp --version

# 测试配置
COS_SECRET_ID=xxx COS_SECRET_KEY=xxx COS_REGION=your-region COS_BUCKET=test npx tx-cos-mcp

# 开发模式
npm run dev

# 发布到npm (维护者)
npm run publish:npm

开发指南

项目结构

tx-cos-mcp/
├── index.js              # MCP服务器主入口
├── src/
│   ├── cosService.js     # COS SDK封装服务
│   └── config.js         # 配置管理
├── config-examples/      # 配置示例
├── package.json          # 项目配置
└── README.md            # 项目文档

核心依赖

  • @modelcontextprotocol/sdk - MCP 协议实现
  • cos-nodejs-sdk-v5 - 腾讯云 COS 官方 SDK

贡献指南

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/new-feature)
  3. 提交更改 (git commit -am 'Add new feature')
  4. 推送分支 (git push origin feature/new-feature)
  5. 创建 Pull Request

许可证

MIT License - 查看LICENSE文件了解详情。

支持与反馈

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选