io.github.croit/mcp-croit-ceph

平台与服务

by croit

MCP server for Croit Ceph cluster management with dynamic OpenAPI tool generation

什么是 io.github.croit/mcp-croit-ceph

MCP server for Croit Ceph cluster management with dynamic OpenAPI tool generation

README

MCP Croit Ceph

AI-powered management for Croit Ceph clusters via the Model Context Protocol (MCP)

Connect your AI assistant (like Claude) directly to your Croit Ceph cluster for intelligent cluster management, troubleshooting, and monitoring.

What is this?

An MCP server that gives AI assistants access to your Croit Ceph cluster's REST API. Ask your AI to:

  • "Show me all pools with errors"
  • "List OSDs on server node-5"
  • "Search logs for slow requests in the last hour"
  • "What's the cluster health status?"

The AI can then interact with your cluster through natural language.

Key Features

🚀 Smart & Efficient

  • Automatic token optimization - Responses optimized to save 80-95% on AI token costs
  • Field selection - Request only the data you need (e.g., just id + name)
  • Built-in filtering - grep-like search without multiple API calls
  • Intelligent summaries - Large datasets get smart summaries with drill-down capability

🔍 Advanced Log Search

  • Native VictoriaLogs integration for powerful log analysis
  • Natural language queries: "Find OSD failures in the last 24 hours"
  • Pattern detection and anomaly identification
  • Pre-built debug templates for common issues

🛡️ Production Ready

  • Role-based access control (ADMIN vs VIEWER)
  • Automatic API discovery from your cluster
  • Docker support with included OpenAPI spec
  • Comprehensive error handling

Quick Start

Using Docker (Recommended)

bash
docker run --rm -i \
  -e CROIT_HOST="https://your-cluster.com" \
  -e CROIT_API_TOKEN="your-api-token" \
  croit/mcp-croit-ceph:latest

With Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json:

Basic configuration (fetches OpenAPI spec on startup):

json
{
  "mcpServers": {
    "croit-ceph": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "CROIT_HOST=http://your-cluster.croit.io:8080",
        "-e", "CROIT_API_TOKEN=your-api-token-here",
        "croit/mcp-croit-ceph:latest"
      ]
    }
  }
}

Optimized configuration (recommended - 2s startup instead of 5s):

json
{
  "mcpServers": {
    "croit-ceph": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-v", "/absolute/path/to/openapi.json:/config/openapi.json:ro",
        "-e", "CROIT_HOST=http://your-cluster.croit.io:8080",
        "-e", "CROIT_API_TOKEN=your-api-token-here",
        "-e", "OPENAPI_FILE=/config/openapi.json",
        "croit/mcp-croit-ceph:latest"
      ]
    }
  }
}

With debug logging:

json
{
  "mcpServers": {
    "croit-ceph": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "CROIT_HOST=http://your-cluster.croit.io:8080",
        "-e", "CROIT_API_TOKEN=your-api-token-here",
        "-e", "LOG_LEVEL=DEBUG",
        "croit/mcp-croit-ceph:latest"
      ]
    }
  }
}

Note: Volume mounts require absolute paths (not ~/). To download the OpenAPI spec:

bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
     http://your-cluster.croit.io:8080/api/swagger.json > openapi.json

Restart Claude Desktop after changing the configuration.

Configuration

Required Environment Variables

bash
CROIT_HOST="https://your-cluster.com"      # Your Croit cluster URL
CROIT_API_TOKEN="your-api-token"           # API token from Croit

Optional Environment Variables

bash
# Use local OpenAPI spec for faster startup (2s vs 5s)
OPENAPI_FILE="/config/openapi.json"

# Use bundled spec (no external fetch, for offline/dev)
USE_INCLUDED_API_SPEC="true"

# Logging verbosity: DEBUG, INFO, WARNING, ERROR
LOG_LEVEL="INFO"

# Pass additional CLI arguments
MCP_ARGS="--no-permission-check --max-category-tools 5"

See .env.example for docker usage template.

Getting an API Token

  1. Log into your Croit cluster web interface
  2. Go to SettingsAPI Tokens
  3. Create a new token with appropriate permissions
  4. Copy the token and use it in your configuration

Example AI Conversations

Check cluster health:

code
You: "What's the current cluster status?"
AI: Calls list_endpoints → Finds status endpoint → Returns health summary

Find problems:

code
You: "Show me all pools with errors"
AI: Calls /pools with fields=["id","name","status"] and filter for errors
    Returns only the 3 pools with issues (instead of all 100 pools)

Debug issues:

code
You: "Search logs for OSD failures in the last hour"
AI: Uses croit_log_search with smart query parsing
    Returns summary + drill-down capability for details

Capacity planning:

code
You: "Which pools are over 80% full?"
AI: Gets pools → Filters by usage → Returns list with recommendations

Features in Detail

Token Optimization

The server automatically reduces AI token consumption:

Without OptimizationWith OptimizationSavings
100 pools, all fields → 4,000 tokens100 pools, id+name → 300 tokens92%
500 OSDs, full data → 15,000 tokensSmart summary → 1,000 tokens93%

How it works:

  1. Field Selection: Request only needed fields
  2. Smart Summaries: Large datasets get summaries with drill-down
  3. Caching: Repeated requests use cached data
  4. Auto-limiting: Sensible defaults prevent token explosions

Available Tools

The AI has access to these tools:

Core Tools:

  • list_endpoints - Discover available API endpoints
  • call_endpoint - Make API calls with optimization
  • search_last_result - Drill down into large responses

Category Tools (auto-generated):

  • manage_services - Ceph services
  • manage_pools - Storage pools
  • manage_servers - Cluster servers
  • manage_s3 - S3 buckets
  • And more...

Log Search:

  • croit_log_search - Advanced log analysis
  • croit_log_check - Quick log condition checks

Advanced Usage

Local Development

bash
# Clone repository
git clone https://github.com/croit/mcp-croit-ceph.git
cd mcp-croit-ceph

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run directly
export CROIT_HOST="https://your-cluster.com"
export CROIT_API_TOKEN="your-token"
python mcp-croit-ceph.py

Using Local OpenAPI Spec

For faster startup or offline development:

bash
# Download spec from your cluster
curl -H "Authorization: Bearer $CROIT_API_TOKEN" \
     https://your-cluster/api/swagger.json > openapi.json

# Use local spec
python mcp-croit-ceph.py --openapi-file openapi.json

Command Line Options

bash
python mcp-croit-ceph.py \
  --openapi-file openapi.json \      # Use local OpenAPI spec
  --no-permission-check \            # Skip role check (faster)
  --max-category-tools 5             # Limit category tools

Permissions & Security

The server respects your API token's role:

  • ADMIN: Full access to all operations
  • VIEWER: Read-only access (no create/delete/update)
  • Invalid token: Server exits with error

Admin-only categories: maintenance, servers, config, hooks

Troubleshooting

Token not working:

  • Verify token in Croit web interface
  • Check token hasn't expired
  • Ensure token has correct permissions

Connection issues:

  • Verify CROIT_HOST is correct (include https://)
  • Check network connectivity to cluster
  • Verify firewall allows connection

No tools showing:

  • Check Docker logs for errors
  • Verify OpenAPI spec is valid
  • Try --no-permission-check to test

Enable debug logging:

bash
export LOG_LEVEL=DEBUG
python mcp-croit-ceph.py

Documentation

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run black formatter on Python files
  5. Submit a pull request

License

See LICENSE for details

Support


Made with ❤️ for the Ceph community

常见问题

io.github.croit/mcp-croit-ceph 是什么?

MCP server for Croit Ceph cluster management with dynamic OpenAPI tool generation

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描114.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描114.1k

MCP服务构建器

by alirezarezvani

Universal
热门

从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。

帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。

平台与服务
未扫描10.2k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.4k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.4k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
35.4k

评论