Created
January 6, 2025 22:18
-
-
Save okooo5km/1b5e03a6cb2b1f6da3c903b44290a499 to your computer and use it in GitHub Desktop.
查找使用 npx 启动的 @modelcontextprotocol/server-memory MCP 服务的本地数据文件。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Colors | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
NC='\033[0m' | |
PROCESS_INFO=$(ps aux | grep "[n]ode" | grep "mcp-server-memory" | head -n 1) | |
if [ -z "$PROCESS_INFO" ]; then | |
echo -e "${RED}Error: MCP Memory server not running${NC}" | |
exit 1 | |
fi | |
SCRIPT_PATH=$(echo "$PROCESS_INFO" | awk '{for(i=1;i<=NF;i++) if($i~/mcp-server-memory$/) print $i}') | |
BASE_DIR=$(dirname "$SCRIPT_PATH") | |
MEMORY_DIR="$BASE_DIR/../@modelcontextprotocol/server-memory/dist" | |
ABSOLUTE_PATH=$(cd "$(dirname "$MEMORY_DIR")" && pwd)/$(basename "$MEMORY_DIR") | |
if [ -f "$ABSOLUTE_PATH/memory.json" ]; then | |
echo -e "${GREEN}Found memory.json at:${NC}" | |
echo -e "${GREEN}$ABSOLUTE_PATH/memory.json${NC}" | |
else | |
echo -e "${RED}Error: memory.json not found at $ABSOLUTE_PATH/memory.json${NC}" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment