Skip to main content
Glama
openEuler MCP Toolkit

openEuler MCP Toolkit

by Logic-ze

openEuler MCP Toolkit

面向 openEuler/Linux 的只读系统观测与操作系统算法实验 MCP Server。它把内存、文件系统、进程与 CPU 信息封装为类型化工具,让支持 MCP 的大模型客户端能够调用可靠、可测试、结果规模受控的系统能力。

这个仓库是 MCP Server,不内置大模型。工具选择和自然语言解释由连接它的 MCP 客户端完成。

项目特点

  • 12 个正式工具,覆盖内存、文件系统、进程和 CPU 调度。

  • 实时系统观测与算法仿真采用独立模块和输出类型。

  • Pydantic 输入输出模型,由 MCP 自动生成并校验 Schema。

  • 文件工具受允许目录限制;不提供删除文件、结束进程等写操作。

  • 长时间采样支持取消和进度通知。

  • 纯算法测试、系统服务测试和真实 stdio MCP 协议测试。

  • 20 条自然语言评测任务,不绑定模型厂商或 API Key。

Related MCP server: MCP ProcFS Server

工具列表

模块

工具

类型

说明

内存

get_memory_info

实时观测

RAM、Swap 和 /proc/meminfo

内存

get_process_memory

实时观测

进程 RSS、VMS 和前 N 项内存映射

内存

sample_memory_trend

实时观测

有界时间窗口内的内存趋势

内存

simulate_page_replacement

算法仿真

FIFO、LRU、CLOCK、OPT

文件系统

get_filesystem_info

实时观测

分区、容量和 inode

文件系统

analyze_file_distribution

实时观测

受控目录内的文件分布

文件系统

monitor_file_metadata

实时观测

轮询文件大小和时间戳变化

文件系统

simulate_disk_allocation

算法仿真

连续、链式、索引分配

调度

get_process_tree

实时观测

有深度和节点上限的进程树

调度

monitor_context_switches

实时观测

系统或单进程上下文切换增量

调度

simulate_cpu_scheduling

算法仿真

FCFS、SJF、RR、Priority

调度

sample_cpu_time_ratios

实时观测

CPU 各状态时间占比

快速开始

需要 Python 3.11 或 3.12。推荐在 openEuler/Linux 上运行;macOS 可运行算法和多数 psutil 工具,但没有 /proc 数据。

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

启动 stdio Server:

openeuler-mcp

stdio 是协议通道,直接运行后没有交互式提示属于正常现象。可以运行协议示例:

python examples/smoke_client.py

使用 MCP Inspector:

mcp dev src/openeuler_mcp/server.py

通用客户端配置见 examples/mcp-config.json。请把命令改为虚拟环境中 openeuler-mcp 的绝对路径,并替换允许访问的目录。

文件访问安全

文件分析默认只能访问 Server 的启动目录。通过系统路径分隔符配置多个允许目录:

export OPENEULER_MCP_ALLOWED_ROOTS="/var/log:/home/user/safe-data"
  • 工具拒绝允许目录以外的路径。

  • 扫描时跳过符号链接。

  • 不要授权包含私钥、浏览器配置、Cookie 或其他敏感数据的目录。

  • MCP 客户端可能将工具结果发送给所配置的模型服务,请同时检查客户端的数据策略。

三条演示链路

1. 系统内存检查

查看当前内存和交换区使用情况,并说明数据来源。

客户端应调用 get_memory_info,然后区分 psutil 数据与 Linux /proc/meminfo 数据。

2. 进程内存分析

分析 PID 1234 的内存占用,只列出 RSS 最大的 10 项映射。

客户端应调用 get_process_memory(pid=1234, mapping_limit=10)。进程不存在或无权限时,调用应明确失败而不是返回伪造结果。

3. 调度算法对比

对任务 A(到达0、运行4) 和 B(到达0、运行2) 使用时间片1的 RR 调度,解释等待时间。

客户端应调用 simulate_cpu_scheduling。正确结果中 A、B 的累计等待时间都为 2。

更多示例见 docs/demo.md。

测试

ruff check .
pytest --cov=openeuler_mcp --cov-report=term-missing

测试覆盖页面置换、RR 累计等待时间、磁盘分配回滚、路径边界、当前系统服务,以及 MCP Server 的 12 个工具注册、Schema 和结构化调用。

评测

evaluation/cases.jsonl 包含 20 条任务,其中两条用于验证模型不会选择不存在的危险写工具。把客户端调用轨迹整理为 result.example.jsonl 的格式后运行:

python evaluation/evaluate_results.py evaluation/result.example.jsonl

输出工具选择正确率、参数有效率、调用成功率和任务完成率;各项指标根据输入的客户端调用轨迹计算。

文档

已知限制

  • 仅提供本地 stdio transport,不包含远程 HTTP 和认证。

  • 文件变化通过元数据轮询观察,快速发生并恢复的变化可能被漏掉。

  • 进程和系统状态具有瞬时性,采集期间进程可能退出或权限可能变化。

  • 磁盘分配和 CPU/页面调度仅计算模拟结果,不会修改真实操作系统状态。

License

MIT

Available Tools

12 tools
analyze_file_distributionC

Summarize file counts, sizes, extensions, and largest paths in a directory.

Inputs: path, top_n, max_depth, max_files. Returns: root, max_depth, extensions, largest_files, +3 more

get_filesystem_infoB

Read mounted filesystems, space usage, and inode counts when available.

Inputs: no named parameters. Returns: partitions, captured_at

get_memory_infoA

Read current system RAM, swap, and Linux /proc/meminfo values.

Inputs: no named parameters. Returns: swap, memory, source, captured_at, +1 more

get_process_memoryA

Read RSS, VMS, and the largest memory mappings for one process.

Inputs: pid (required), mapping_limit. Returns: pid, name, source, mappings, +5 more

get_process_treeB

Read a bounded parent-child process tree from a selected root PID.

Inputs: root_pid, max_depth, max_nodes. Returns: tree, root_pid, max_depth, truncated, +2 more

monitor_context_switchesB

Sample system-wide or per-process context-switch deltas.

Inputs: pid, duration_seconds, interval_seconds. Returns: pid, scope, samples, duration_seconds, +1 more

monitor_file_metadataB

Poll file size and timestamps; this is metadata polling, not access tracing.

Inputs: path (required), duration_seconds, interval_seconds. Returns: path, events, method, duration_seconds, +1 more

sample_cpu_time_ratiosB

Sample CPU time deltas and normalize them into per-state ratios.

Inputs: duration_seconds, interval_seconds. Returns: samples, duration_seconds, interval_seconds

sample_memory_trendC

Sample system memory usage and classify its short-term direction.

Inputs: duration_seconds, interval_seconds. Returns: trend, samples, change_ratio, duration_seconds, +1 more

simulate_cpu_schedulingC

Simulate CPU scheduling and report waiting, turnaround, and response metrics.

Inputs: jobs (required), algorithm, time_slice. Returns: jobs, metrics, timeline, algorithm, +1 more

simulate_disk_allocationB

Simulate transactional contiguous, linked, or indexed block allocation.

Inputs: scenario (required), strategy, block_size_bytes. Returns: strategy, allocations, free_blocks, total_blocks, +5 more

simulate_page_replacementC

Simulate FIFO, LRU, CLOCK, or optimal page replacement.

Inputs: reference_string (required), algorithm, frame_count. Returns: hits, steps, faults, hit_rate, +4 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 12 tools

    Disambiguation4/5

    Tools cover distinct areas like memory, filesystem, processes, and CPU scheduling, but some memory-related tools (get_memory_info, sample_memory_trend, get_process_memory) could be confused. Overall, each tool has a specific purpose with limited overlap.

    Naming Consistency3/5

    Names use mixed verb patterns (get_, monitor_, sample_, simulate_, analyze_) rather than a consistent verb_noun structure. While readable, the lack of pattern may cause hesitation in selecting the correct tool.

    Tool Count5/5

    With 12 tools, the count falls well within the ideal 3-15 range for a system toolkit. Each tool serves a clear function without unnecessary bloat or sparseness.

    Completeness3/5

    The toolkit covers memory, filesystem, process, and CPU scheduling domains, but lacks basic tools like listing all processes, CPU info, or network stats. Notable gaps exist for a comprehensive system toolkit.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A read-only MCP server for Linux and macOS system administration, diagnostics, and troubleshooting, supporting remote SSH execution and multi-host management.
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      A powerful MCP server for reading and modifying Linux /proc filesystem values, providing system monitoring, process management, and sysctl operations via JSON-RPC and SSE.
      14
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      A Linux system monitoring MCP server that provides real-time information on CPU, memory, disk, network, processes, Docker, security, and more via MCP tools.
      10
      65
      3
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A read-only system observability and OS algorithm lab MCP server for openEuler/Linux, encapsulating memory, filesystem, process, and CPU info into typed tools for reliable LLM client use.
      -