file-store-mcp

file-store-mcp

4

File Store MCP Server is a versatile file storage solution that supports multiple cloud storage providers and offers features like unified API for uploads, presigned URLs, and easy configuration. It is designed for direct integration with applications and HTTP-based integration using SSE server mode.

File Store MCP Server

File Store MCP

A file storage service supporting multiple cloud providers

Go Report Card GoDoc GitHub release GitHub license

Features

  • Multi-cloud storage provider support
  • Unified API for file uploads
  • Presigned URL generation for secure access
  • Support for AWS S3, Alibaba Cloud OSS, Tencent Cloud COS, Qiniu Cloud, and GitHub
  • Easy configuration via environment variables
  • Customizable URL expiration times
  • Support for custom domains and CDNs
  • Dual operation modes: stdio for direct integration and SSE for server mode

Quick Start

Installation

go install github.com/sjzar/file-store-mcp@latest

Basic Usage

  1. Set the required environment variables for your chosen storage provider
  2. Run in stdio mode (default) for direct integration with other applications:
    file-store-mcp
    
  3. Or run in SSE server mode for HTTP-based integration:
    file-store-mcp --sse-port 8080
    

MCP Tools

File Store MCP provides three tools for uploading files to cloud storage:

1. Upload Files Tool (upload_files)

Uploads local files to cloud storage and returns HTTP URLs.

When to use: When users mention local file paths or need online access to their files. Ideal for analyzing PDF content, referencing local images for drawing tasks, or processing any local files.

Parameters:

  • paths: Array of absolute local file paths to upload (required)

Example:

{
  "tool": "upload_files",
  "params": {
    "paths": ["/path/to/file1.pdf", "C:/Users/user/Documents/file2.jpg"]
  }
}

2. Upload Clipboard Files Tool (upload_clipboard_files)

Uploads files from the clipboard to cloud storage and returns HTTP URLs.

When to use: Only when users explicitly request to upload files from their clipboard. Useful when users want to share or process clipboard content without saving it locally first.

Parameters: None required

Example:

{
  "tool": "upload_clipboard_files"
}

3. Upload URL Files Tool (upload_url_files)

Downloads files from provided URLs and uploads them to cloud storage, returning new HTTP URLs.

When to use: When users provide web links to files they want to process or analyze. Ideal for situations where users reference external files that need to be incorporated into the current workflow.

Parameters:

  • urls: Array of URLs pointing to files to download and upload (required)

Example:

{
  "tool": "upload_url_files",
  "params": {
    "urls": ["https://example.com/file1.pdf", "https://another-site.org/image.jpg"]
  }
}

Storage Providers

File Store MCP supports the following storage providers:

  • AWS S3 (and compatible services like Cloudflare R2)
  • Alibaba Cloud OSS
  • Tencent Cloud COS
  • Qiniu Cloud Storage
  • GitHub Repository

Configuration

Common Configuration

Environment VariableDescriptionDefault
FSM_STORAGE_TYPEStorage provider type (s3, oss, cos, qiniu, github)empty

AWS S3 Configuration

Set FSM_STORAGE_TYPE=s3 to use AWS S3 or compatible services.

Environment VariableDescriptionRequiredDefault
FSM_S3_BUCKETS3 bucket nameYes-
FSM_S3_REGIONAWS regionYes-
FSM_S3_ENDPOINTCustom endpoint for S3-compatible servicesNoAWS S3 endpoint
FSM_S3_ACCESS_KEYAWS access key IDYes-
FSM_S3_SECRET_KEYAWS secret access keyYes-
FSM_S3_SESSIONAWS session tokenNo-
FSM_S3_URL_EXPIRATIONPresigned URL expiration time in secondsNo604800 (7 days)

Notes for S3-compatible services:

  • For Cloudflare R2: Set FSM_S3_ENDPOINT to your R2 endpoint URL
  • For other S3-compatible services: Configure the appropriate endpoint URL

Alibaba Cloud OSS Configuration

Set FSM_STORAGE_TYPE=oss to use Alibaba Cloud OSS.

Environment VariableDescriptionRequiredDefault
FSM_OSS_ENDPOINTOSS endpointYes-
FSM_OSS_ACCESS_KEYOSS access key IDYes-
FSM_OSS_SECRET_KEYOSS access key secretYes-
FSM_OSS_BUCKETOSS bucket nameYes-
FSM_OSS_DOMAINCustom domain for OSS bucketNo-
FSM_OSS_URL_EXPIRATIONSigned URL expiration time in secondsNo604800 (7 days)

Tencent Cloud COS Configuration

Set FSM_STORAGE_TYPE=cos to use Tencent Cloud COS.

Environment VariableDescriptionRequiredDefault
FSM_COS_BUCKETCOS bucket nameYes-
FSM_COS_REGIONCOS regionYes-
FSM_COS_APP_IDTencent Cloud App IDYes-
FSM_COS_ACCESS_KEYSecret IDYes-
FSM_COS_SECRET_KEYSecret KeyYes-
FSM_COS_DOMAINCustom domain for COS bucketNo-
FSM_COS_USE_HTTPSWhether to use HTTPSNotrue
FSM_COS_USE_ACCELERATEWhether to use global accelerationNofalse
FSM_COS_URL_EXPIRATIONPresigned URL expiration time in secondsNo604800 (7 days)

Qiniu Cloud Storage Configuration

Set FSM_STORAGE_TYPE=qiniu to use Qiniu Cloud Storage.

Environment VariableDescriptionRequiredDefault
FSM_QINIU_ACCESS_KEYQiniu access keyYes-
FSM_QINIU_SECRET_KEYQiniu secret keyYes-
FSM_QINIU_BUCKETQiniu bucket nameYes-
FSM_QINIU_DOMAINCustom domain for Qiniu bucket (required)Yes-
FSM_QINIU_REGIONStorage regionNoz0 (East China)
FSM_QINIU_URL_EXPIRATIONSigned URL expiration time in secondsNo604800 (7 days)

Available Qiniu regions:

  • z0: East China
  • z1: North China
  • z2: South China
  • na0: North America
  • as0: Southeast Asia

GitHub Repository Configuration

Set FSM_STORAGE_TYPE=github to use GitHub as a storage provider.

Environment VariableDescriptionRequiredDefault
FSM_GITHUB_TOKENGitHub personal access tokenYes-
FSM_GITHUB_OWNERRepository ownerYes-
FSM_GITHUB_REPORepository nameYes-
FSM_GITHUB_BRANCHBranch nameNomain
FSM_GITHUB_PATHFile storage path within the repositoryNo-
FSM_GITHUB_DOMAINCustom domain for GitHub contentNo-

GitHub token permissions:

  • The token must have repo scope for private repositories
  • For public repositories, public_repo scope is sufficient

Advanced Usage

Using Custom Domains

For all storage providers, you can configure custom domains to serve your files. This is particularly useful when you have CDN services in front of your storage.

Example for Alibaba Cloud OSS with custom domain:

FSM_STORAGE_TYPE=oss
FSM_OSS_BUCKET=my-bucket
FSM_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
FSM_OSS_ACCESS_KEY=your-access-key
FSM_OSS_SECRET_KEY=your-secret-key
FSM_OSS_DOMAIN=cdn.example.com

Debug Mode

Enable debug mode for more verbose logging:

file-store-mcp --debug

Development

Building from Source

git clone https://github.com/sjzar/file-store-mcp.git
cd file-store-mcp
go build

License

This project is licensed under the Apache License 2.0 - see the file for details.