MCP ConfigsMar 24, 2026·1 min read

Chrome MCP

安全清理 Chrome MCP 旧进程脚本,自动保留最新进程只杀旧的

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 19/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Verified publisher
Entrypoint
Chrome MCP 进程安全清理脚本
Safe staging command
npx -y tokrepo@latest install efa81b93-4e34-4c7e-ad44-9972f454cfab --target codex

Stages files first; activation requires review of the staged README and plan.

#!/bin/bash

kill-old-chrome-mcp.sh

只杀旧的 Chrome MCP 进程,保留最新的(当前 Claude Code session 的)

用法:bash ~/scripts/kill-old-chrome-mcp.sh

PIDS=$(ps aux | grep "[c]hrome-devtools-mcp" | grep -v watchdog | grep -v "npm exec" | awk '{print $2}')

if [ -z "$PIDS" ]; then echo "没有找到 chrome-devtools-mcp 进程" exit 0 fi

COUNT=$(echo "$PIDS" | wc -l | tr -d ' ')

if [ "$COUNT" -le 1 ]; then echo "只有 1 个 Chrome MCP 进程 (PID: $PIDS),无需清理" exit 0 fi

保留最新的(PID最大的),杀掉其他所有

NEWEST=$(echo "$PIDS" | sort -n | tail -1) OLD_PIDS=$(echo "$PIDS" | sort -n | head -n -1)

echo "发现 $COUNT 个 Chrome MCP 进程" echo "保留最新: PID $NEWEST" echo "杀掉旧的: $OLD_PIDS"

for pid in $OLD_PIDS; do # 同时杀掉关联的 npm exec 和 watchdog 进程 PARENT_PIDS=$(ps aux | grep -E "npm exec.*chrome-devtools|watchdog.*parent-pid=$pid" | grep -v grep | awk '{print $2}') kill $pid $PARENT_PIDS 2>/dev/null echo " 已杀: PID $pid (及关联进程)" done

echo "✅ 清理完成,保留 PID $NEWEST"

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets