Content
# Qiniu MCP Server
## Overview
Model Context Protocol (MCP) Server based on Qiniu Cloud products, supports users to access Qiniu Cloud storage, intelligent multimedia, live streaming services, etc. through this MCP Server in the context of AI large model clients.
Capabilities:
- Storage
- Get Bucket list
- Get the list of files in the Bucket
- Upload local files and upload with file content
- Read file content
- Get file download link
- For details on accessing Qiniu Cloud storage, please refer to [Accessing Qiniu Cloud Storage with Large Models Based on MCP](https://developer.qiniu.com/kodo/12914/mcp-aimodel-kodo).
- Intelligent Multimedia
- Image scaling
- Image rounded corners
- CDN
- Refresh files by link
- Prefetch files by link
- Live Streaming
- Create live streaming bucket
- Create live stream
- Get live streaming space list
- Get stream list
- Bind push/pull stream domain name
- Get push/pull stream live address
- Get live streaming usage
## Environment Requirements
- Python 3.12 or higher
- uv package manager
If uv is not installed yet, you can use the following command to install it:
```bash
# Mac, it is recommended to use brew to install
brew install uv
# Linux & Mac
# 1. Install
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. After the installation is complete, make sure to add the package installation path (the directory containing the uv and uvx executable files) to the system's PATH environment variable.
# Assuming the installation package path is /Users/xxx/.local/bin (see the installation execution output)
### Temporary effect (current session), execute the following command in the current terminal:
export PATH="/Users/xxx/.local/bin:$PATH"
### Permanent effect (recommended), execute the following command in the current terminal:
echo 'export PATH="/Users/xxx/.local/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
For specific installation methods, refer to [uv Installation](https://docs.astral.sh/uv/getting-started/installation/#pypi)
## Usage in Cline:
Steps:
1. Download the Cline plugin in vscode (after downloading the Cline plugin, a Cline icon will be added to the sidebar)
2. Configure the large model
3. Configure qiniu MCP
1. Click the Cline icon to enter the Cline plugin, select the MCP Server module
2. Select installed, click Advanced MCP Settings to configure the MCP Server, refer to the configuration information below
```
{
"mcpServers": {
"qiniu": {
"command": "uvx",
"args": [
"qiniu-mcp-server"
],
"env": {
"QINIU_ACCESS_KEY": "YOUR_ACCESS_KEY",
"QINIU_SECRET_KEY": "YOUR_SECRET_KEY",
"QINIU_REGION_NAME": "YOUR_REGION_NAME",
"QINIU_ENDPOINT_URL": "YOUR_ENDPOINT_URL",
"QINIU_BUCKETS": "YOUR_BUCKET_A,YOUR_BUCKET_B"
},
"disabled": false
}
}
}
```
```
If only the live streaming function is used, two authentication modes are supported
1 Configure QINIU_ACCESS_KEY/QINIU_SECRET_KEY
{
"mcpServers": {
"qiniu": {
"command": "uvx",
"args": [
"qiniu-mcp-server"
],
"env": {
"QINIU_ACCESS_KEY": "YOUR_ACCESS_KEY",
"QINIU_SECRET_KEY": "YOUR_SECRET_KEY"
},
"disabled": false
}
}
}
2 You can obtain the apikey from the Qiniu Live Streaming console and configure QINIU_LIVE_API_KEY
{
"mcpServers": {
"qiniu": {
"command": "uvx",
"args": [
"qiniu-mcp-server"
],
"env": {
"QINIU_LIVE_API_KEY": "YOUR_LIVE_API_KEY"
},
"disabled": false
}
}
}
```
3. Click the link switch of qiniu MCP Server to connect
4. Create a chat window in Cline, and now we can interact with AI to use qiniu-mcp-server. Here are a few examples of object storage:
- List qiniu's resource information
- List all Buckets in qiniu
- List the files in qiniu's xxx Bucket
- Read the file content of yyy in qiniu's xxx Bucket
- Cut a rounded corner with a width of 200 pixels for the image of yyy in qiniu's xxx Bucket
- Refresh this CDN link of qiniu: https://developer.qiniu.com/test.txt
5. Create a chat window in Cline, and now we can interact with AI to use qiniu-mcp-server. Here are a few examples of the live streaming system:
- List all live streaming spaces
- Create a new live streaming space named mcptest1123
- Create a new stream named stream1 for mcptest1123
- List all streams in the live streaming space mcptest1123
- Bind the push stream domain name <your-push-domain> and the pull stream domain name <your-play-domain> for mcptest1123
- Get the push stream address and pull stream address corresponding to the live stream stream1 under mcptest1123
- Get the live streaming usage for the last 1 hour
Note:
You can directly use the above configuration to create an MCP Server in cursor.
When using it in claude, you may encounter: Error: spawn uvx ENOENT error, solution: fill in the absolute path of uvx in the command parameter, eg: /usr/local/bin/uvx
## Development
1. Clone the repository:
```bash
# Clone the project and enter the directory
git clone git@github.com:qiniu/qiniu-mcp-server.git
cd qiniu-mcp-server
```
2. Create and activate the virtual environment:
```bash
uv venv
source .venv/bin/activate # Linux/macOS
# Or
.venv\Scripts\activate # Windows
```
3. Install dependencies:
```bash
uv pip install -e .
```
4. Configuration
Copy the environment variable template:
```bash
cp .env.example .env
```
Edit the `.env` file and configure the following parameters:
```bash
# S3/Kodo authentication information
QINIU_ACCESS_KEY=your_access_key
QINIU_SECRET_KEY=your_secret_key
# Region information
QINIU_REGION_NAME=your_region
QINIU_ENDPOINT_URL=endpoint_url # eg:https://s3.your_region.qiniucs.com
# Configure bucket, multiple buckets are separated by commas, it is recommended to configure up to 20 buckets
QINIU_BUCKETS=bucket1,bucket2,bucket3
```
For extended functions, first add a business package directory under the core directory (eg: storage -> storage), and complete the function extension in this business package directory.
Define the load function in the `__init__.py` file under the business package directory to register business tools or resources, and finally call this load function in the `__init__.py` under the `core` directory to complete the registration of tools or resources.
```shell
core
├── __init__.py # Load various business tools or resources
└── storage # Storage business directory
├── __init__.py # Load storage tools or resources
├── resource.py # Storage resource extension
├── storage.py # Storage tool class
└── tools.py # Storage tool extension
```
## Testing
### Testing with Model Control Protocol Inspector
It is highly recommended to use [Model Control Protocol Inspector](https://github.com/modelcontextprotocol/inspector) for testing.
```shell
# node version is: v22.4.0
npx @modelcontextprotocol/inspector uv --directory . run qiniu-mcp-server
```
### Locally start MCP Server example
1. Start in standard input/output (stdio) mode (default):
```bash
uv --directory . run qiniu-mcp-server
```
2. Start in SSE mode (for Web applications):
```bash
uv --directory . run qiniu-mcp-server --transport sse --port 8000
```
Connection Info
You Might Also Like
firecrawl
Firecrawl MCP Server enables web scraping, crawling, and content extraction.
markitdown
Python tool for converting files and office documents to Markdown.
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.