Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/x0c/arthas-mcp/agents-mdgit clone --depth 1 https://github.com/x0c/arthas-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/x0c/arthas-mcp/agents-md)<a href="https://agentmods.dev/instructions/x0c/arthas-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/x0c/arthas-mcp/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00960 | $0.00960 |
| Opus 5 | $0.00480 | $0.00480 |
| Sonnet 5 | $0.00192 | $0.00192 |
| Haiku 4.5 | $0.00096 | $0.00096 |
Grade B, and why
arthas-mcp AGENTS.md scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Sends data to an external URLmediumData exfiltration
A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.
涉及发现/attach 逻辑的改动,再起一个带包名的长驻 JVM(如 `com.example.demo.SleeperApp`)实跑一轮:日志应出现「发现新 Java 服务」与「就绪 (port=…)」,`curl -X POST http://127.0.0.1:<port>/api -d '{"action":"exec","command":"version"}'` 应返回 `SUCCEEDED`。 Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
涉及发现/attach 逻辑的改动,再起一个带包名的长驻 JVM(如 `com.example.demo.SleeperApp`)实跑一轮:日志应出现「发现新 Java 服务」与「就绪 (port=…)」,`curl -X POST http://127.0.0.1:<port>/api -d '{"action":"exec","command":"version"}'` 应返回 `SUCCEEDED`。 What it actually says
arthas-mcp
把阿里 Arthas Java 诊断能力通过 MCP 暴露给 AI 助手的 Node 服务(stdio / HTTP 双模式)。公开镜像 github.com/x0c/arthas-mcp;与官方 arthas-mcp-server 的关系(独立实现,非封装)见 README.md。
硬约束
- stdio 模式必须监听 stdin 关闭并退出(
cli/arthas-mcp.mjs的exitWhenClientGone,2026-08-25 修复)。删掉它会复发孤儿泄漏事故:客户端退出后扫描定时器吊住 Node 事件循环,进程永不退出,堆积吃内存,且每个实例持续空转探测。回归命令:npm test(stdin 关闭 5 秒内必须自行退出,挂死即回归)。 - 扫描定时器默认 15 秒一轮
jps,每次探测都是一个完整 JVM 启动(约 0.3-0.5s CPU)。调整间隔或新增轮询类逻辑前先算清楚成本;活跃 agent 会话多时实例数 = 会话数,成本按实例数翻倍。 - 进程参数读取按平台分支(lib/discovery.mjs
_getProcessArgs):Linux 读/proc/<pid>/cmdline、macOS 用ps、Windows 走 PowerShell CIM。改这段时三端语义要对齐:返回值都是完整命令行字符串;java 启动器判定用跨平台正则(容忍引号与反斜杠路径),不要退回^\S*java\s这种 Unix 假设。
结构
| 路径 | 职责 |
|---|---|
cli/arthas-mcp.mjs |
入口:参数解析、stdio/HTTP 双模式、优雅关闭 |
lib/discovery.mjs |
JVM 自动发现(jps + 黑名单)+ Arthas 生命周期与端口管理 + 服务名提取(跨平台正则) |
lib/mcp.mjs |
MCP Server 工厂:list_agents / exec / async_exec / pull_results / interrupt_job |
lib/config.mjs |
配置解析(CLI > 环境变量 > config.json > 默认值)、arthas-boot 自动探测、stripPrefixes |
lib/log.mjs |
日志 |
scripts/smoke.mjs |
孤儿泄漏回归测试(CI 与本地共用) |
注意:入口目录刻意叫 cli/ 不叫 bin/(沿用本工作区约定),不要改回 bin/。
本地配置与运行数据
~/.config/arthas-mcp/ 与仓库分离、已 gitignore:config.json(含 stripPrefixes 服务名前缀剥离)、aliases.json(服务名别名)、state.json(Agent 运行状态)。仓库默认值不含任何用户特定前缀。
改动验证
npm run check # 全部 mjs 语法检查
node cli/arthas-mcp.mjs --version
npm test # 孤儿回归:stdin 关闭 5 秒内自行退出
涉及发现/attach 逻辑的改动,再起一个带包名的长驻 JVM(如 com.example.demo.SleeperApp)实跑一轮:日志应出现「发现新 Java 服务」与「就绪 (port=…)」,curl -X POST http://127.0.0.1:<port>/api -d '{"action":"exec","command":"version"}' 应返回 SUCCEEDED。
发布
公开远端 github.com/x0c/arthas-mcp(main 分支)。改动合并后同推两处远端;GitHub 侧更新 Description / Topics 用 gh repo edit。npm 包 arthas-mcp 名字已留空可发布(未登录时用 npx -y github:x0c/arthas-mcp 作为安装口径,README 中已注明缩短形式的过渡说明)。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 41 lines · 960 tokens per session scan B 5c3bbfaec873
arthas-mcp AGENTS.md is an instructions file published in the GitHub repository x0c/arthas-mcp (0 stars, last pushed 9d ago), licensed MIT. It adds 960 tokens to every session, about $0.0048 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
tda copilot-instructions.md
Copilot instructions for irockel/tda, covering copilot review instructions: tda - thread dump analyzer, core technical principles, 1. concurrency & swing (edt), 2. memory & performance and 3. parsing logic (the core).
mcp-annotated-java-sdk AGENTS.md
AGENTS.md instructions for thought2code/mcp-annotated-java-sdk, covering git commit rules and commit message format.
blockrun-mcp AGENTS.md
AGENTS.md instructions for BlockRunAI/blockrun-mcp, covering blockrun mcp, commands, project structure, key dependencies and install in codex.
openrouter-mcp-multimodal AGENTS.md
AGENTS.md instructions for stabgan/openrouter-mcp-multimodal, covering agent instructions, before you ship, releasing (read this before publishing), short version and version files (must all match package.json).
intervals-icu-mcp CLAUDE.md
Instructions for hhopke/intervals-icu-mcp, covering claude.md, project overview, development commands, architecture (quick reference) and tool categories.
ai-toolkit AGENTS.md
AGENTS.md instructions for pipefy/ai-toolkit, covering repository guidelines, documentation map, project structure, import namespace migration: pipefysdk → pipefy and src/pipefysdk/init.py (transitional shim).