pm2-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pm2-mcplist my PM2 services"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pm2-mcp
An MCP server that gives agents structured read and limited write access to PM2 services. Built with FastMCP, transport is streamable-http bound to localhost.
I built this because every other approach to PM2 inspection from an agent involves either raw shell access (homelab-ops run_command) or scraping human-readable pm2 status output. This server speaks directly to pm2 jlist, returns typed fields, and validates service names before issuing any write operations.
flowchart LR
subgraph shell["Shell access"]
direction LR
s1["agent"] -->|"run_command\npm2 jlist"| s2["unparsed\nJSON string"]
end
subgraph mcp["pm2-mcp"]
direction LR
m1["agent"] -->|"list_services"| m2["typed fields\nstatus · uptime_ms\ncpu_pct · memory_mb"]
endTools
Read
Tool | Description |
| List all PM2 services. Optional |
| Full detail for one service by name — script path, cwd, args, log file paths, created_at, plus all summary fields. |
| Tail recent log output. |
| Server metadata and PM2 health summary — configured host/port, PM2 version, service counts by status. |
Write
Tool | Description |
| Restart a service. Validates the name first — returns |
| Stop a service. Does not remove it from the PM2 process list. |
| Resume a stopped service already registered in PM2. Does not register new processes. |
| Gracefully reload a service (zero-downtime). Preferred over |
| Persist the current PM2 process list to disk. Call after write operations to survive reboots. |
| Clear log files for a service. |
Response shape — list_services
[
{
"name": "my-service",
"pm_id": 12,
"status": "online",
"pid": 18432,
"uptime_ms": 3720000,
"restarts": 0,
"cpu_pct": 0.2,
"memory_mb": 48.5,
"exec_mode": "fork_mode"
}
]get_service extends this with script, cwd, args, log_file, error_file, and created_at.
Related MCP server: Coding MCP Server
Setup
Requirements
Python 3.11+
PM2 installed and in PATH for the user running the server
fastmcp>=3.2.4(seerequirements.txt)
pip install -r requirements.txtRun as a PM2 process (recommended)
Using ecosystem.config.js (recommended — add to your existing config):
{
name: 'pm2-mcp',
script: 'server.py',
interpreter: 'python3',
env: {
PYTHONUNBUFFERED: '1',
MCP_HOST: '127.0.0.1',
MCP_PORT: '8486',
}
}pm2 start ecosystem.config.js --only pm2-mcp
pm2 saveOr inline with env vars:
MCP_HOST=127.0.0.1 MCP_PORT=8486 pm2 start server.py --interpreter python3 --name pm2-mcp
pm2 saveThe server manages itself like any other PM2 service — it will appear in its own list_services output.
Run directly
python server.pyEnvironment Variables
Variable | Default | Description |
|
| Bind address for the MCP server |
|
| Port for the MCP server |
Copy .env.example to .env and fill in the values you need. Blank values use the defaults shown above.
Wiring to Claude Code
Add to ~/.claude/settings.json under mcpServers:
{
"mcpServers": {
"pm2": {
"type": "streamable-http",
"url": "http://127.0.0.1:8486/mcp"
}
}
}Security
The server binds to 127.0.0.1 by default. Any client that can reach port 8486 can restart or stop services — there is no authentication. This is intentional for local agent use: keep it localhost-only and don't proxy it externally.
The write tools (restart_service, stop_service, start_service, reload_service, flush_logs) validate service names against the live PM2 process list before acting. An unrecognized name returns {ok: false, error: "service '...' not found"} without touching PM2.
Testing
pip install -r requirements.txt -r requirements-dev.txt
pytest -vAll tests mock _run_pm2 — no PM2 installation required.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceAn MCP server implementation that enables interaction with the Letta API for managing agents, memory blocks, and tools in the Letta system.3611377MIT
- Alicense-qualityCmaintenanceA production-oriented MCP server for coding agents that enables multi-project management through secure file operations, Git integration, and safe command execution. It supports project discovery across multiple root directories and provides robust audit logging with both STDIO and HTTP transport options.142MIT

AgentsID Guardofficial
AlicenseAqualityDmaintenanceMCP server that protects shell, file, database, git, and HTTP operations with per-agent permission rules5010MIT- Alicense-qualityDmaintenanceAn agent-capable MCP server with terminal access, filesystem control, and persistent memory. It includes sandboxing, access control, activity logging, and a file-backed memory store for context across conversations.MIT
Related MCP Connectors
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
MCP server for AgentDocs (agentdocs.eu): read, search, write, comment on & share Markdown docs.
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TadMSTR/pm2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server