Skip to main content
Glama
README.md
# js-reverse-evolver

> 自进化 JS 逆向工作流 · MCP Server
> 集成 MemOS / GitNexus / Stagehand / js-reverse-mcp / Evolver,可在 Claude Code、Codex 等平台直接调用。

## 架构总览

```
js-reverse-mcp → SeedAdapter(获取初始种子代码)
        ↓
   EvolverEngine(核心进化引擎)
      ↙        ↘
GitNexusAdapter  StagehandAdapter(分支管理 / 浏览器验证)
      ↘        ↙
   MemOSAdapter(历史记忆读写)
        ↓
SelfLearner / StrategyEvolver(自学习 / 自扩展)
```

---

## 快速开始

### 1. 安装依赖

```bash
cd /path/to/js-reverse-evolver
npm install
npx playwright install chromium
```

### 2. 配置环境变量

```bash
cp .env.example .env
# 编辑 .env,填入 MemOS / js-reverse-mcp 等服务地址
```

### 3. 构建 & 启动

```bash
npm run build
npm start
```

---

## 接入 MCP 平台

### Claude Code

将以下内容添加到 Claude Code 的 MCP 配置文件(`~/.claude/mcp_settings.json`):

```json
{
  "mcpServers": {
    "js-reverse-evolver": {
      "command": "node",
      "args": ["/path/to/js-reverse-evolver/dist/index.js"]
    }
  }
}
```

### OpenAI Codex / 其他 MCP 平台

将 `.mcp/config.json` 内容复制到对应平台的 MCP Server 配置中即可。

---

## 四个工具接口

| 工具名 | 功能 |
|--------|------|
| `evolve_js` | 输入目标 URL,自动进化输出反混淆代码 |
| `query_knowledge` | 查询知识库中积累的模式与策略 |
| `inject_knowledge` | 人工注入混淆模式,增强进化能力 |
| `get_evolution_status` | 查询引擎当前状态与统计信息 |

---

## 自学习机制

每次进化成功后系统会自动:

1. 提取本次成功的混淆特征 → 写入 `knowledge/patterns.json`
2. 高频模式(命中 ≥3 次)自动晋升为新策略 → 写入 `knowledge/strategy_candidates.json`
3. 下次启动自动加载新策略,越用越聪明

---

## 项目结构

```
js-reverse-evolver/
├── src/
│   ├── index.ts              # MCP Server 入口
│   ├── utils/
│   │   ├── config.ts         # 环境变量配置
│   │   └── logger.ts         # 日志工具
│   ├── evolver/
│   │   ├── types.ts          # 全局类型定义
│   │   ├── EvolverEngine.ts  # 核心进化引擎
│   │   └── strategies/
│   │       ├── BaseStrategy.ts
│   │       ├── MutateStrategy.ts
│   │       └── CrossStrategy.ts
│   ├── adapters/
│   │   ├── MemOSAdapter.ts
│   │   ├── GitNexusAdapter.ts
│   │   ├── StagehandAdapter.ts
│   │   └── SeedAdapter.ts
│   └── learning/
│       ├── KnowledgeStore.ts
│       ├── SelfLearner.ts
│       └── StrategyEvolver.ts
├── knowledge/
│   ├── patterns.json            # 混淆模式库(自动维护)
│   ├── strategy_candidates.json # 策略候选库(自动维护)
│   ├── success_history.json     # 成功历史
│   └── failed_paths.json        # 失败路径
├── .mcp/
│   └── config.json              # MCP 平台接入配置
├── .env.example
├── package.json
└── tsconfig.json
```

---

## License

MIT

TDQS

A3.9/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct operation: injecting knowledge, querying knowledge, running the evolution workflow, and viewing history. There is no overlap in purpose, so an agent can easily select the right tool.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with lowercase and underscores: inject_knowledge, get_evolution_history, evolve_js, query_knowledge. The naming is uniform and predictable.

Tool Count5/5

Four tools is well-suited for the specialized domain of JS reverse evolution. Each tool serves a necessary function without redundancy or bloat, making the set compact and focused.

Completeness5/5

The tool set covers the full workflow: evolving a target (evolve_js), injecting expert knowledge to guide evolution (inject_knowledge), retrieving learned knowledge (query_knowledge), and tracking evolution history (get_evolution_history). No obvious gaps exist for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues