Ali OSS MCP server

Provides a bridge between AI systems and Ali OSS cloud storage, enabling file upload, download, listing, and management operations through a RESTful API.
Back to servers
Setup instructions
Provider
1yhy
Release date
Mar 24, 2025
Language
TypeScript
Stats
4 stars

This MCP server allows large language models to directly upload files to Alibaba Cloud Object Storage Service (OSS). It seamlessly integrates with other MCP tools to create powerful workflows for file management and storage in the cloud.

Installation

Using NPM

Install the OSS MCP server globally with npm or pnpm:

# Using npm
npm install -g oss-mcp

# Or using pnpm
pnpm add -g oss-mcp

From Source

# Clone the repository
git clone https://github.com/1yhy/oss-mcp.git
cd oss-mcp

# Install dependencies
pnpm install

# Build the project
pnpm build

Configuration

You can configure the Alibaba Cloud OSS parameters in two ways:

Method 1: Using a .env File

Create a .env file in the project root directory using the .env.example template. You can configure multiple OSS services:

# Default OSS configuration
OSS_CONFIG_DEFAULT={"region":"oss-cn-hangzhou","accessKeyId":"your-access-key-id","accessKeySecret":"your-access-key-secret","bucket":"your-bucket-name","endpoint":"oss-cn-hangzhou.aliyuncs.com"}

# Other OSS configuration
OSS_CONFIG_TEST={"region":"oss-cn-beijing","accessKeyId":"your-access-key-id-2","accessKeySecret":"your-access-key-secret-2","bucket":"your-bucket-name-2","endpoint":"oss-cn-beijing.aliyuncs.com"}

Method 2: Setting Environment Variables Directly

You can also set environment variables directly in your system or in the startup command:

# Set environment variables and start
pnpm dev --oss-config='{ "default": { "region": "oss-cn-shenzhen", "accessKeyId": "YOUR_KEY", "accessKeySecret": "YOUR_SECRET", "bucket": "BUCKET_NAME", "endpoint": "oss-cn-shenzhen.aliyuncs.com" }, "test": { "region": "oss-cn-beijing", "accessKeyId": "YOUR_KEY", "accessKeySecret": "YOUR_SECRET", "bucket": "BUCKET_NAME", "endpoint": "oss-cn-beijing.aliyuncs.com" } }'

Configuration Parameters

  • region: Alibaba Cloud OSS region
  • accessKeyId: Alibaba Cloud access key ID
  • accessKeySecret: Alibaba Cloud access key secret
  • bucket: OSS bucket name
  • endpoint: OSS endpoint

Usage

Command Line Options

Options:
  -s, --stdio    Start server using stdio transport
  -h, --http     Start server using HTTP transport
  -p, --port     HTTP server port (default: 3000)
  -i, --inspect  Start with Inspector tool
  -?, --help     Show help information

Start the Server

# Start directly (stdio mode)
oss-mcp --oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'

# Start with Inspector for debugging
oss-mcp --oss-config='{ "region": "oss-cn-shenzhen", "accessKeyId": "YOUR_KEY", "accessKeySecret": "YOUR_SECRET", "bucket": "BUCKET_NAME", "endpoint": "oss-cn-shenzhen.aliyuncs.com" }' --inspect

Starting from Source Code

# Development mode
pnpm dev

# Start service (stdio mode)
pnpm start

# Start HTTP service
pnpm start:http

# Debug with Inspector
pnpm inspect

Integration with Claude/Cursor

Cursor Configuration

  1. Open Settings in Cursor
  2. Go to MCP Servers section
  3. Add a new server configuration:
{
  "mcpServers": {
    "oss-mcp": {
      "command": "npx",
      "args": [
        "oss-mcp",
        "--oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'",
        "--stdio"
      ]
    }
  }
}

Configuring Multiple OSS Accounts

You can easily configure multiple OSS accounts using environment variables:

{
  "mcpServers": {
    "oss-mcp": {
      "command": "npx",
      "args": [
        "oss-mcp",
        "--oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}, \"test\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'",
        "--stdio"
      ]
    }
  }
}

Available Tools

The server provides the following tools:

1. Upload Files to OSS (upload_to_oss)

Parameters:

  • filePath: Local file path (required)
  • targetDir: Target directory path (optional)
  • fileName: File name (optional, uses original filename by default)
  • configName: OSS configuration name (optional, uses 'default' by default)

2. List Available OSS Configurations (list_oss_configs)

No parameters. Returns all available OSS configuration names.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "oss-mcp" '{"command":"npx","args":["oss-mcp","--oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'","--stdio"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "oss-mcp": {
            "command": "npx",
            "args": [
                "oss-mcp",
                "--oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'",
                "--stdio"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "oss-mcp": {
            "command": "npx",
            "args": [
                "oss-mcp",
                "--oss-config='{\"default\":{\"region\":\"oss-cn-shenzhen\",\"accessKeyId\":\"YOUR_KEY\",\"accessKeySecret\":\"YOUR_SECRET\",\"bucket\":\"YOUR_BUCKET\",\"endpoint\":\"oss-cn-shenzhen.aliyuncs.com\"}}'",
                "--stdio"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later