# Skill Cerberus MCP

> Cerberus MCP Skill

- Skill: `undermybelt/skill-cerberus-mcp` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add undermybelt/skill-cerberus-mcp`
- Raw SKILL.md: https://api.skillmd.com/api/skills/undermybelt/skill-cerberus-mcp/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: undermybelt (https://skillmd.com/u/undermybelt)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/undermybelt/skill-cerberus-mcp

---

# Cerberus MCP Skill

> AST-based code exploration with 90%+ token reduction

## 功能
Cerberus MCP 是一个模型上下文协议（MCP）服务器，通过抽象语法树（AST）分析提供高效的代码探索能力，可将 token 使用量减少 90% 以上。它实时生成调用图、依赖分析和代码结构概览，让 AI 代理能以极低成本理解大型代码库。

## 核心特性
- ✅ **90%+ Token 减少** - AST 压缩大幅降低 LLM 上下文负担
- ✅ **调用图生成** - 自动构建函数调用关系图
- ✅ **实时代码探索** - 毫秒级响应，支持超大型仓库
- ✅ **MCP 原生** - 标准 Model Context Protocol，与所有 MCP 客户端兼容
- ✅ **多语言支持** - 支持 Python、TypeScript/JavaScript、Go、Rust
- ✅ **增量更新** - 仅分析变更部分，性能更优

## 使用场景
- **代码审查助手** - 快速理解 PR 影响范围
- **架构分析** - 生成系统依赖图谱
- **调试辅助** - 追踪复杂调用链
- **文档生成** - 基于 AST 自动生成 API 文档
- **迁移规划** - 评估重构影响范围

## 命令
```bash
# 启动 Cerberus MCP 服务器
/cerberus-mcp start --repo /path/to/codebase --language python

# 查询调用图
/cerberus-mcp callgraph --function "main" --depth 3

# 查找依赖
/cerberus-mcp deps --module "utils" --include-transitive

# 分析影响
/cerberus-mcp impact --files changed.ts --max-hops 5

# 性能统计
/cerberus-mcp stats --format json
```

## 配置
`cerberus-mcp.yaml`:
```yaml
mcp:
  server:
    port: 8080
    transport: stdio  # stdio|sse

analysis:
  languages:
    - python
    - typescript
    - go
    - rust
  max_files: 10000
  cache:
    enabled: true
    ttl: 1h
    path: ~/.cache/cerberus

reduction:
  ast_compression: true
  deduplicate_imports: true
  inline_small_functions: true
  threshold_lines: 3

output:
  format: mcp  # mcp|json|dot
  include_comments: false
  max_depth: 10
```

## 性能指标
| 指标 | 数值 |
|------|------|
| Token 减少率 | 90-95% |
| 1000 文件分析时间 | <2s |
| 内存占用 | ~100MB |
| 调用图生成 | <100ms |
| 首次启动 | <10s |

## Integration
与 `smartcat-mcp` 配合使用可实现跨仓库代码导航：
```bash
# Cerberus 负责本地 AST 分析
cerberus-mcp start --repo . --language typescript

# Smartcat 提供云端语义搜索
smartcat-mcp start --api-key YOUR_KEY
```

## 技术栈
- Model Context Protocol (MCP)
- Tree-sitter (多语言 AST 解析)
- Node.js (MCP 服务器)
- LRU Cache (增量分析)
- Graphviz (可选可视化)

## 架构
```
Input: Codebase
    ↓
Tree-sitter Parser (按语言解析)
    ↓
AST Node Graph (抽象语法树)
    ↓
Compression Engine
  - 内联小函数
  - 去重导入
  - 抽象模板
    ↓
Call Graph Builder (调用图)
    ↓
MCP Transport → AI Agent
```

## 示例
```bash
# 分析 React 项目
cerberus-mcp start --repo ~/projects/myapp --language typescript --cache ~/.cache/cerberus

# 在 Claude Desktop 中添加
{
  "mcpServers": {
    "cerberus": {
      "command": "cerberus-mcp",
      "args": ["start", "--repo", "/path/to/repo", "--language", "typescript"]
    }
  }
}
```

## 安全
- 仅读取，不修改源代码
- 缓存数据本地存储（可选加密）
- 无网络外连（除非配置远程仓库）

---

*Skill: cerberus-mcp*
*Source: proxikal/cerberus-mcp*
*Stars: Expected 100+ (based on impact)*
*License: MIT (assumed)*
*Category: code-analysis*

