Borrowing it
Nothing to install: this file belongs to TadMSTR/pm2-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/TadMSTR/pm2-mcp/main/AGENTS.mdgit clone --depth 1 https://github.com/TadMSTR/pm2-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/tadmstr/pm2-mcp/agents-md)<a href="https://agentmods.dev/instructions/tadmstr/pm2-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/tadmstr/pm2-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/tadmstr/pm2-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/tadmstr/pm2-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.01374 | $0.01374 |
| Opus 5.5 | $0.00550 | $0.00550 |
| Sonnet 5.5 | $0.00275 | $0.00275 |
| Haiku 4.5 | $0.00137 | $0.00137 |
Grade A, and why
pm2-mcp AGENTS.md scanned grade A with 1 finding 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 10d 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
tests/test_pm2.py Unit tests; _run_pm2 / subprocess.run mocked How it starts
The opening of the file, as written. The whole thing — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.
pm2-mcp
FastMCP server wrapping the PM2 CLI via subprocess. Provides structured read and limited write access to PM2 processes.
What it does
Exposes PM2 process management as MCP tools — list, inspect, control lifecycle, and fetch recent logs for any PM2-managed service on the host.
Tools
list_services(status_filter)— All PM2 processes as summary dicts (name, pm_id, status, pid, uptime_ms, restarts, cpu_pct, memory_mb, exec_mode). Optional filter:online,stopped,errored.get_service(name)— Full detail for a named service.get_logs(name, lines, include_errors)— Recent log lines.linesdefaults to 50, clamped to 1..500.restart_service(name)— Restart a service.stop_service(name)— Stop a service. Does not deregister it.start_service(name)— Resume a service already registered with PM2. Does not register a new process.reload_service(name)— Graceful zero-downtime reload.save()— Persist the current PM2 process list to disk.flush_logs(name)— Clear a service's log files.get_status()— Server metadata and PM2 health summary.
There is no delete_service, deliberately — recovering from a bad PM2 registration is an
operator task. This list said otherwise until 2026-09-09, along with naming get_service_logs
(the tool is get_logs) and describing reload as cluster-mode-only.
Structure
src/pm2_mcp/server.py The FastMCP server: all tools, _run_pm2(), _find_service(),
_clean_env(), _resolve_bind(), _configure_logging(),
HostOriginGuard, main() (the `pm2-mcp` entry point)
tests/test_pm2.py Unit tests; _run_pm2 / subprocess.run mocked
tests/test_host_origin.py Host/Origin check against the real Starlette app
tests/test_integration_pm2.py Write verbs against a real pm2 and a private daemon
uv.lock The dependency set CI tests, audits and the deploy installs
Key architecture decisions
_run_pm2(*args)— all PM2 invocations go through this helper, which raisesRuntimeErroron non-zero exit. Do not shell out to PM2 directly in tool handlers._find_service(name)— validates the service exists before any write operation (restart/stop/start/reload/flush) and beforeget_logs(since v0.5.0:pm2 logstakes ids, namespaces,alland options in the same position). Returns structured data frompm2 jlist. This is an allowlist: the name must already be a registered PM2 app._clean_env()— the trust boundary. Strips PM2's IPC variables and anything matching theCLAUDEprefix from the environment handed to thepm2child.pm2 start/restart --update-envcopy the caller's whole environment into the target app andpm2 savewrites it to disk, so a regression here persists credentials silently (vikunja#767). Changes to this function or_run_pm2must passscripts/mutation-gate.sh._is_loopback(host)/_resolve_bind(argv, env)— the network trust boundary (vikunja#770)._resolve_bindresolves the bind with precedence argv > env >127.0.0.1:8486, per field, and refuses any non-loopback result by exiting non-zero._is_loopbackis in the mutation gate's function set;_resolve_binddeliberately is not, and the script says why. Do not add an override flag — the refusal is the mitigation thatdocs/threat-model.md§1 leans on, and an escape hatch removes it._configure_logging()— must stay a function called frommain(), never module-level or import-time code.pyproject.tomlsetsfail_under = 100and excludes the__main__block from coverage, so startup logic written there is untestable, invisible to coverage, and unreachable from a regression test. That is exactly how vikunja#772 shipped: the shadow log had no level and no handler for its entire life, and every test that "covered" it forced the level viacaplog.at_level(...), which production never has. If you add startup behaviour, extract it the same way and test it without forcing a level.HostOriginGuard— the DNS-rebinding check (v0.5.0). LoopbackHostnames and the bound address on any port (mcp's prefix wildcard), plus exactPM2_MCP_ALLOWED_HOSTSentries (*refuses to start); any non-emptyOriginrefused. It is handed tomcp.runbymain(), and a test pins that it is. Never log the header values.PM2_MCP_ENV_MODE—shadow(default) orenforce; anything else makesmain()refuse to start. Do not flip it as part of other work: that is Ted's decision on vikunja#771.- Dependencies — fastmcp, and minimum versions on mcp and several transitives, each carrying the advisory it closes.
uv.lockis the source of truth; CI installs from it and audits it. PM2 must already be installed on the host. No auth — this server is intended for localhost use only, and the loopback bind is enforced. Seedocs/threat-model.md.
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.
- 10d ago Changed · +12 lines · +400 tokens per session b3b38f909b69
- 1mo ago Changed · +3 lines · +302 tokens per session f1722ff76c54
- 1mo ago Changed · +7 lines · +258 tokens per session 09fad00b831f
- 2mo ago First seen · 42 lines · 414 tokens per session scan A 106e85c7c67c
pm2-mcp AGENTS.md is an instructions file published in the GitHub repository TadMSTR/pm2-mcp (0 stars, last pushed 4d ago), licensed MIT. It adds 1,374 tokens to every session, about $0.0055 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
pm2-mcp AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| pm2-mcp AGENTS.mdTadMSTR/pm2-mcp | Instructions file | 0 | 4d ago | MIT | A | 1,374 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |