melisai 标志

melisai

社区
dmitriimaksimovdevelop

Single-binary Linux performance diagnostics via eBPF/BCC, built for humans and AI agents (MCP)

发布者dmitriimaksimovdevelop
代码仓库melisai
语言Go
复刻数
6
星标数
64
可用工具
0
传输类型stdio
分类
许可协议Apache-2.0
链接
  • 将工具接入 AI 工作流

    melisai 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 64 个星标和 6 个复刻。

melisai

[!WARNING] 🧊 Project frozen for an indefinite period. Development is paused — no new features, fixes, or releases are planned for the foreseeable future. The existing code remains available as-is.

🧊 Проект заморожен на неизвестный срок. Разработка приостановлена — новые функции, исправления и релизы в обозримом будущем не планируются. Существующий код остаётся доступным как есть.

melisai terminal demo

Your server is slow. You SSH in. Now what?

melisai answers that question in 10 seconds. Single Go binary — no agents, no daemons, no config files. It runs 67 BCC/eBPF tools + 8 procfs collectors, detects 37 anomalies, computes a health score, and tells you exactly what sysctl to change. Works standalone or as an MCP server for Claude/Cursor to diagnose servers interactively.

Go 1.23+ License BCC Coverage Tests Schema

$ sudo melisai collect --profile quick -o report.json

  melisai v0.4.1 | profile=quick | duration=10s

  Tier 1 (procfs)  ████████████████████████████████████████ 8/8   2.1s
  Tier 2 (BCC)     ████████████████████████████████████████ 4/4  10.3s

  Health Score:  68 / 100  ⚠️
  Anomalies:     cpu_utilization CRITICAL (98.7%)
                 load_average WARNING (3.2x CPUs)
  Recommendations: 2

  Report saved to report.json

Key Features

FeatureWhat it does
Health ScoreSingle 0-100 number. Green/yellow/red. AI agents use it to decide next steps
37 Anomaly RulesRate-based detection (not cumulative counters). Catches problems happening right now
35 RecommendationsCopy-paste sysctl commands with evidence. Each tagged as "fix" or "optimization"
67 BCC Tools~84% of Brendan Gregg's BPF toolkit. Histograms, events, stack traces
GPU/PCIe TopologyDetects NVIDIA GPUs, maps PCI→NUMA, flags cross-NUMA GPU-NIC pairs (30-50% DMA penalty)
Page Reclaim TrackingDirect reclaim rate, compaction stalls, THP splits — the invisible latency killers
NUMA AnalysisPer-node miss ratio, distance matrix, CPU mapping. Catches 30-50% latency penalties
Network Deep DiveConntrack, softnet, IRQ distribution, accept queue depth, 30+ TCP/UDP sysctls
MCP ServerClaude Desktop / Cursor connect over stdio. Interactive server diagnostics
Before/After DiffCompare two reports. See what improved, what regressed
Observer Effect MitigationTwo-phase collection: baselines first, then BCC tools. PID exclusion
22 Chapter DocumentationBook-level guide (EN + RU) covering CPU, memory, disk, network, GPU, NUMA, THP
Shareable Reportsmelisai share → one short URL with the diagnosis, rendered client-side. No agents to install for the reader

Real-World Diagnosis

One command. 60 seconds. Here's what melisai found on a production Docker host (8 CPUs, 32 GB RAM, HDD RAID):

Health Score: 46 / 100

Anomalies (6):
  [CRITICAL] tcp_retransmits          134/sec
  [WARNING]  disk_utilization          80.5%
  [WARNING]  cpu_psi_pressure          17.6%
  [WARNING]  io_psi_pressure           12.8%
  [WARNING]  disk_avg_latency          12.1ms
  [WARNING]  tcp_close_wait            1 socket

What melisai found that manual debugging wouldn't:

The root cause chain — HDD latency (p99=49ms) caused page reclaim pressure (PruneCalled=105), which made the kernel prune TCP buffers, triggering 31 retransmits/sec, and cascading into 226K dropped packets on the WireGuard tunnel. Four separate symptoms, one root cause.

WhatManualmelisai
Find the cascade: HDD → reclaim → tcp prune → retransmits → VPN dropsRequires years of kernel experienceAutomatic — 37 rules check it all
Know to check PruneCalled in /proc/net/netstatYou have to know it existsCollected and evaluated automatically
Identify the process eating 245% CPU + 8.6 GB RAMtop shows it, but not in contextCorrelated with health score and anomalies
Collect 17,330 stack traces for flame graphperf record + manual setupIncluded in one --profile deep run
Get copy-paste sysctl fixes with evidenceGoogle + trial and error7 recommendations with exact commands

The diagnosis: server outgrew its hardware. SSD would fix 80% of the problems. The other 20% is workload sizing.


Who Is This For?

  • SRE / DevOps — "server is slow, find out why" in one command
  • ML Engineers — GPU-NIC NUMA topology, PCIe bandwidth diagnostics
  • Database Admins — THP splits, page reclaim, dirty writeback, NUMA miss ratio
  • Platform Teams — container CPU throttling, cgroup memory pressure, K8s NUMA topology
  • AI Agents — structured JSON + MCP protocol = autonomous server diagnostics

Why Not prometheus/netdata/datadog?

melisaiMonitoring agents
DeploymentSingle binary, run onceDaemon + config + server
Time to answer10 secondsSet up dashboards, wait for data
BPF tools67 tools in one runSeparate setup per tool
RecommendationsExact sysctl commandsRaw metrics only
AI-nativeMCP server, structured JSON, AI promptRequires adapter/integration
GPU topologyCross-NUMA detectionNot typically covered
CostFree, Apache 2.0Free to $$$

melisai is not a replacement for monitoring — it's a diagnostic tool you run when something is already wrong (or to validate that everything is right).


Quick Start

bash
# Build (requires Go 1.23+, cross-compile from macOS/Linux)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o melisai ./cmd/melisai/

# Deploy and run
scp melisai root@server:/usr/local/bin/
ssh root@server "melisai collect --profile quick -o /tmp/report.json"

# Install BCC tools (first time only)
ssh root@server "melisai install"

No config files. No YAML. No environment variables.


Share a Report

melisai collect produces a 30–100 KB JSON file. melisai share turns it into one short URL you paste into Slack, an incident channel, or a Jira ticket — the recipient gets the full diagnosis rendered in their browser, no melisai install required.

bash
sudo melisai collect --profile quick -o report.json
melisai share report.json
# → https://melisai.dev/r/uJOzZUjb

Live demo (real run on a loaded server, health = 2/100): https://melisai.dev/r/uJOzZUjb

melisai share demo

Two flavours of URL, picked automatically:

ModeURL shapeWhen it's used
Short linkhttps://melisai.dev/r/Xa9bC3kpDefault. CLI POSTs the gzipped summary to melisai.dev/api/r; backend stores it in SQLite and returns the code
Fragment fallbackhttps://melisai.dev/r#H4sIAAAA...Auto-triggered when the upload fails (offline, airgapped, 5xx). The whole report rides in the URL fragment — nothing reaches a server. Force with --offline

The viewer page is static HTML+JS that decodes the payload client-side (atob + DecompressionStream); the backend is just a key→bytes store with no auth and rate-limited writes. See doc/en/16-sharing.md for the wire format and self-hosting notes.

Privacy: the payload carries hostname, kernel version, anomaly evidence and recommendation text. Treat the URL like the JSON report itself.


MCP Server — AI-Powered Diagnostics

melisai includes a built-in Model Context Protocol server. AI agents connect over stdio and interactively diagnose system performance.

Claude Desktop / Cursor config (claude_desktop_config.json):

json
{
  "mcpServers": {
    "melisai": {
      "command": "ssh",
      "args": ["root@your-server", "/usr/local/bin/melisai", "mcp"]
    }
  }
}

MCP Tools

ToolWhat it doesTime
get_healthQuick 0-100 score + anomalies. Tier 1 only~2s
collect_metricsFull profile with BCC/eBPF tools. Args: profile, focus, pid10-60s
explain_anomalyRoot causes + recommendations for any anomaly IDinstant
list_anomaliesAll 37 anomaly metric IDs with descriptionsinstant

Typical AI Workflow

Agent                              melisai
  │                                   │
  ├── get_health ──────────────────►  │  "score: 68, cpu_utilization CRITICAL"
  │                                   │
  ├── explain_anomaly ─────────────►  │  "Root causes, what to check, sysctl fixes..."
  │   anomaly_id: cpu_utilization     │
  │                                   │
  ├── collect_metrics ─────────────►  │  Full JSON: 67 BCC tools, histograms,
  │   profile: standard               │  events, stack traces, AI prompt
  │                                   │
  └── (agent analyzes & recommends)   │

How It Works

Three collection tiers with automatic fallback:

Tier 1: 8 collectors (/proc, /sys, ss, ethtool, nvidia-smi, dmesg)
        Network deep diagnostics, page reclaim & THP tracking,
        NUMA topology analysis, GPU/PCIe cross-NUMA detection
        Always works. No root needed.

Tier 2: 67 BCC tools — runqlat, biolatency, tcpconnlat, etc.
        Root + bcc-tools required. `melisai install` handles setup.

Tier 3: Native eBPF (cilium/ebpf) — tcpretrans kprobe
        Root + kernel ≥ 5.8 + BTF. Zero external dependencies.

Collection runs in two phases to eliminate observer effect:

  1. Phase 1 — Tier 1 collectors capture clean baselines
  2. Phase 2 — BCC/eBPF tools run without contaminating baselines

Report Structure

SectionContent
summary.health_scoreWeighted 0-100 score (CPU 1.5x, Memory 1.5x, Disk 1.0x, Network 1.0x)
summary.anomalies[]Detected issues with severity, metric, value, threshold
summary.resourcesUSE metrics per resource (utilization, saturation, errors)
summary.recommendations[]Exact commands with type (fix/optimization) and evidence
categories.*Raw data: histograms, events, stack traces per subsystem
ai_context.promptDynamic prompt with system context and 27 anti-patterns

Collection Profiles

ProfileDurationWhat runsBest for
quick10sTier 1 + biolatency, tcpretrans, opensnoop, oomkillHealth checks, CI gates
standard30sAll Tier 1 + all 67 BCC toolsRegular diagnostics
deep60sEverything + memleak, biostacks, wakeuptime, biotopRoot cause analysis
bash
# Quick health check
sudo melisai collect --profile quick -o report.json

# Full analysis with AI prompt
sudo melisai collect --profile standard --ai-prompt -o report.json

# Deep dive focused on disk
sudo melisai collect --profile deep --focus disk -o report.json

# Profile a specific process
sudo melisai collect --profile standard --pid 12345 -o app.json

# Profile a container
sudo melisai collect --profile standard --cgroup /sys/fs/cgroup/system.slice/nginx.service -o nginx.json

# Compare before/after a change
melisai diff before.json after.json -o diff.json

Anomaly Detection — 37 Rules

All rate-based rules use two-point sampling (delta over interval). No false positives from cumulative counters on long-uptime systems.

MetricWarningCriticalSource
cpu_utilization80%95%/proc/stat
cpu_iowait10%30%/proc/stat
load_average2x CPUs4x CPUs/proc/loadavg
memory_utilization85%95%/proc/meminfo
swap_usage10%50%/proc/meminfo
direct_reclaim_rate10/s1000/s/proc/vmstat (rate)
compaction_stall_rate1/s100/s/proc/vmstat (rate)
thp_split_rate1/s100/s/proc/vmstat (rate)
numa_miss_ratio5%20%/sys/devices/system/node
disk_utilization70%90%/proc/diskstats
disk_avg_latency5ms50ms/proc/diskstats
tcp_retransmits10/s50/s/proc/net/snmp (rate)
conntrack_usage_pct70%90%/proc/sys/net/netfilter
softnet_dropped1/s100/s/proc/net/softnet_stat (rate)
listen_overflows1/s100/s/proc/net/netstat (rate)
tcp_close_wait1100ss
tcp_rcvq_drop1/s100/s/proc/net/netstat (rate)
tcp_zero_window_drop1/s50/s/proc/net/netstat (rate)
listen_queue_saturation70%90%ss -tnl fill %
irq_imbalance5x20x/proc/softirqs (rate)
gpu_nic_cross_numa1 pair1 pairsysfs PCI NUMA
... and 16 more (BCC histograms, PSI, container, NIC, UDP)

BCC Tools — 67 Tools

~84% coverage of Brendan Gregg's BPF observability tools.

SubsystemCountTools
CPU10runqlat, runqlen, cpudist, hardirqs, softirqs, runqslower, cpufreq, cpuunclaimed, llcstat, funccount
Disk21biolatency, biosnoop, biotop, bitesize, ext4slower/dist, btrfsslower/dist, xfsslower/dist, nfsslower/dist, zfsslower/dist, fileslower, filelife, mountsnoop, mdflush, scsilatency, nvmelatency, vfsstat
Memory7cachestat, oomkill, drsnoop, shmsnoop, numamove, memleak, slabratetop
Network14tcpconnlat, tcpretrans, tcprtt, tcpdrop, tcpstates, tcpconnect, tcpaccept, tcplife, udpconnect, sofdsnoop, sockstat, skbdrop, tcpsynbl, gethostlatency
Process9execsnoop, opensnoop, killsnoop, threadsnoop, syncsnoop, exitsnoop, statsnoop, capable, syscount
Stacks6profile, offcputime, wakeuptime, offwaketime, biostacks, stackcount

24 tools support --pid filtering for per-process analysis.


Manual Usage (without AI)

bash
# Health score
jq '.summary.health_score' report.json

# All anomalies
jq '.summary.anomalies[]' report.json

# Copy-paste recommendations
jq '.summary.recommendations[] | {type, title, commands}' report.json

# Network sysctls
jq '.categories.network[0].data.sysctls' report.json

# Page reclaim pressure
jq '.categories.memory[0].data.reclaim' report.json

# NUMA miss ratio per node
jq '.categories.memory[0].data.numa_nodes[] | {node, miss_ratio, cpus}' report.json

# Top CPU processes
jq '.categories.process[0].data.top_by_cpu[:5]' report.json

# BCC histogram percentiles
jq '.categories.cpu[].histograms[]? | {name, p50, p99, max}' report.json

Documentation — 22 Chapters (EN + RU)

Comprehensive book-level guide covering Linux performance theory and melisai implementation:

ChaptersTopic
00-01Introduction, Linux fundamentals (/proc, /sys, cgroups, PSI)
02-07CPU, Memory, Disk, Network, Process, Container analysis
08-10System collector, BCC tools registry, Native eBPF
11-13Anomaly detection (37 rules), Recommendations engine, AI integration
14-17Report diffing, Orchestrator, Output formats, Appendix
18GPU & PCIe Topology — nvidia-smi, NUMA mapping, GPUDirect RDMA
19Page Reclaim & THP — watermarks, direct reclaim, compaction, THP defrag
20NUMA Optimization — distance matrix, numactl, K8s topology manager
21Production Tuning Checklist — all sysctls + one-liner tuning script

All chapters available in English and Russian: doc/en/ | doc/ru/


Architecture

cmd/melisai/           CLI (cobra) + MCP subcommand
internal/
  ├── collector/       8 Tier 1 collectors + BCC adapter + GPU/PCIe
  ├── executor/        BCC runner, security, 67 parsers, registry
  ├── ebpf/            Native eBPF loader (cilium/ebpf, CO-RE)
  ├── mcp/             MCP server (4 tools, stdio JSON-RPC)
  ├── model/           Types, USE metrics, 37 anomalies, health score
  ├── observer/        PID tracker, overhead measurement
  ├── orchestrator/    Two-phase execution, signal handling, profiles
  ├── output/          JSON, FlameGraph SVG, AI prompt generator
  ├── diff/            Report comparison engine
  └── installer/       Distro detection, package installation

Security: BCC binaries verified (root-owned, not world-writable, allowed paths only). No shell execution. Symlink resolution. Output capped at 50MB per tool.


Requirements

MinimumNotes
BuildGo 1.23+Cross-compile: GOOS=linux GOARCH=amd64
Tier 1Any Linux kernelNo root needed
Tier 2bcc-tools installedsudo melisai install handles this
Tier 3Kernel ≥ 5.8 with BTFFalls back to Tier 2 automatically

Tested Distros

Ubuntu 24.04 (full validation), Ubuntu 22.04, Debian 12, Fedora 39, CentOS Stream 9


Development

bash
go test ./... -v          # 458 tests
go test ./... -race       # with race detector
make lint                 # golangci-lint
make build                # cross-compile to linux/amd64
make test-validation      # Linux + root + stress-ng workload tests

Roadmap

  • Concurrent ethtool calls (parallel NIC enrichment)
  • --compact flag for 256+ CPU servers
  • Per-cgroup memory pressure tracking
  • AMD ROCm GPU support
  • OpenTelemetry export
  • Web UI for report visualization

Contributing

Contributions welcome! Areas where help is especially appreciated:

  • New BCC tool parsers — we're at 67/80 of Gregg's toolkit
  • AMD GPU support — ROCm equivalent of our nvidia-smi integration
  • Documentation — translations, tutorials, real-world case studies
  • Testing — malformed input edge cases, container-specific scenarios

Please open an issue first to discuss significant changes.


Troubleshooting

ProblemFix
tool "X" not foundsudo melisai install
binary "X" not owned by rootchown root:root /usr/sbin/X-bpfcc
Empty histogram dataNormal — no events during window
exit status 1 from BCC toolCheck dmesg for BPF errors

Limitations

Being honest about what melisai is not:

  • Not a monitoring system. It's a diagnostic tool — you run it when something is wrong (or to validate that everything is right). For continuous monitoring, use Prometheus/Grafana/Datadog alongside melisai.
  • No historical trends. melisai captures a point-in-time snapshot. It can't tell you "retransmits spiked yesterday at 3 PM."
  • No alerting. It doesn't run as a daemon or send notifications. Use it on-demand or via cron + MCP.
  • BCC tools need kernel headers. Some distros require linux-headers-$(uname -r) for Tier 2 tools. Tier 1 always works.
  • System-level only. melisai sees that a process uses 245% CPU, but not why inside the application. For app-level profiling, use pprof/async-profiler on the process melisai identified.
  • NVIDIA GPUs only. AMD ROCm support is on the roadmap but not implemented yet.

License

Apache License 2.0


Built on the shoulders of Brendan Gregg's BPF ecosystem, the USE Method, and cilium/ebpf.

安装

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "dmitriimaksimovdevelop-melisai": {
      "command": "",
      "args": []
    }
  }
}

将 melisai MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 melisai 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 melisai 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 melisai MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "dmitriimaksimovdevelop-melisai": {
      "command": "npx",
      "args": [
        "-y",
        "melisai"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 melisai MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 melisai MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 melisai 帮我完成这项任务吗?
melisai
当然,我看过了。
以下是我使用 melisai 得到的结果。

常见问题

melisai MCP 服务器有什么用途?

melisai 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 melisai MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 melisai。

为什么在 TypingMind 中使用 melisai MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 melisai 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 melisai MCP 连接到 TypingMind?

melisai 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

melisai MCP 在 TypingMind 中提供哪些工具?

melisai 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 melisai MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 melisai 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇