Skip to main content
Glama
ucesys

MinIO Model-Context Protocol (MCP) Server

by ucesys

MinIO 模型上下文协议 (MCP)

该项目为 MinIO 对象存储实现了模型上下文协议 (MCP) 服务器和客户端。它提供了一种与 MinIO 交互的标准化方式。

特征

服务器

资源

通过Resources公开 MinIO 数据。服务器可以访问并提供:

  • 文本文件(根据文件扩展名自动检测)

  • 二进制文件(作为应用程序/八位字节流处理)

  • 存储桶内容(每个存储桶最多 1000 个对象)

工具

  • 列表桶

    • 返回经过身份验证的请求发送者所拥有的所有存储桶的列表

    • 可选参数: start_after (分页)、 max_buckets (限制结果)

  • 列表对象

    • 每次请求返回存储桶中的部分或全部对象(最多 1,000 个)

    • 必需参数: bucket_name

    • 可选参数: prefix (按前缀过滤)、 max_keys (限制结果)

  • 获取对象

    • 从 MinIO 中检索对象

    • 必需参数: bucket_nameobject_name

  • 放置对象

    • 使用 fput 方法将文件上传到 MinIO bucket

    • 必需参数: bucket_nameobject_namefile_path

客户

该项目包括多个客户端实现:

  1. 基本客户端- 用于与 MinIO MCP 服务器直接交互的简单客户端

  2. Anthropic Client - 与 Anthropic 的 Claude 模型集成,实现与 MinIO 的 AI 交互

Related MCP server: MCP File Server

安装

  1. 克隆存储库:

git clone https://github.com/yourusername/minio-mcp.git
cd minio-mcp
  1. 使用 pip 安装依赖项:

pip install -r requirements.txt

或者使用 uv:

uv pip install -r requirements.txt

环境配置

在根目录中创建一个.env文件,其配置如下:

# MinIO Configuration
MINIO_ENDPOINT=play.min.io
MINIO_ACCESS_KEY=your_access_key
MINIO_SECRET_KEY=your_secret_key
MINIO_SECURE=true
MINIO_MAX_BUCKETS=5

# Server Configuration
SERVER_HOST=0.0.0.0
SERVER_PORT=8000

# For Anthropic Client (if using)
ANTHROPIC_API_KEY=your_anthropic_api_key

用法

运行服务器

可以直接运行服务器:

python src/minio_mcp_server/server.py

使用基本客户端

from src.client import main
import asyncio

asyncio.run(main())

使用 Anthropic 客户端

  1. src/client/servers_config.json中配置服务器:

{
  "mcpServers": {
    "minio_service": {
      "command": "python",
      "args": ["path/to/minio_mcp_server/server.py"]
    }
  }
}
  1. 运行客户端:

python src/client/mcp_anthropic_client.py
  1. 与助手互动:

    • 助手将自动检测可用的工具

    • 您可以询问有关 MinIO 数据的问题

    • 助手将使用适当的工具来检索信息

  2. 退出会话:

    • 输入quitexit结束会话

与 Claude Desktop 集成

您可以将此 MCP 服务器与 Claude Desktop 集成:

配置

在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "minio-mcp": {
      "command": "python",
      "args": [
        "path/to/minio-mcp/src/minio_mcp_server/server.py"
      ]
    }
  }
}

发展

项目结构

minio-mcp/
├── src/
│   ├── client/                  # Client implementations
│   │   ├── mcp_anthropic_client.py  # Anthropic integration
│   │   └── servers_config.json  # Server configuration
│   ├── minio_mcp_server/        # MCP server implementation
│   │   ├── resources/           # Resource implementations
│   │   │   └── minio_resource.py  # MinIO resource
│   │   └── server.py            # Main server implementation
│   ├── __init__.py
│   └── client.py                # Basic client implementation
├── LICENSE
├── pyproject.toml
├── README.md
└── requirements.txt

运行测试

pytest

代码格式化

black src/
isort src/
flake8 src/

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们建议使用 MCP 检查器:

npx @modelcontextprotocol/inspector python path/to/minio-mcp/src/minio_mcp_server/server.py

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ucesys/minio-python-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server