cerberus-mcp

cerberus-mcp

An MCP server that provides ultra-efficient code exploration through AST analysis, reducing LLM token usage by up to 95% while enabling instant call graph generation and dependency analysis for massive codebases.

Category
访问服务器

README

� Cerberus MCP

AST-based code exploration with 90%+ token reduction

OpenClaw Skill MCP Compatible License: MIT

Cerberus MCP is a Model Context Protocol server that provides ultra-efficient code exploration through AST analysis. Reduce LLM token usage by up to 95% while enabling instant call graph generation and dependency analysis for massive codebases.

✨ Why Cerberus?

Traditional code analysis sends full source files to the LLM → expensive, slow, token-limited.

Cerberus MCP pre-processes your code into an optimized AST representation:

Original codebase: 500 files, 100k LOC → ~250,000 tokens
Cerberus MCP:       Same codebase → ~12,500 tokens (95% reduction!)

Benefits:

  • 💰 Save $$$ on LLM API costs (95% fewer tokens)
  • Instant insights - call graphs in <100ms
  • 📊 Scale to huge repos - analysis under 2 seconds for 1000+ files
  • 🔌 MCP native - works with Claude Desktop, Cursor, Windsurf

🚀 Quick Start

1. Install

# From GitHub (once published)
git clone https://github.com/openclaw/skill-cerberus-mcp.git
cd skill-cerberus-mcp
npm install
npm run build
sudo ln -s $(pwd)/dist/cli.js /usr/local/bin/cerberus-mcp

2. Configure

Create cerberus-mcp.yaml:

mcp:
  server:
    port: 8080
    transport: stdio

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

reduction:
  ast_compression: true
  deduplicate_imports: true
  inline_small_functions: true

3. Start Server

# Analyze a repository
cerberus-mcp start --repo ~/projects/myapp --language typescript

# Output: MCP server listening on stdio...

4. Connect Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "cerberus": {
      "command": "cerberus-mcp",
      "args": ["start", "--repo", "/path/to/your/repo", "--language", "typescript"]
    }
  }
}

Restart Claude. Now you can ask:

"Show me the call graph for main()"
"What are all the dependencies of the utils module?"
"Which files would be affected if I change api/auth.ts?"

🎯 Use Cases

📐 Architecture Analysis

Generate dependency graphs to understand system structure:

cerberus-mcp deps --module "src/server" --include-transitive --format dot > graph.dot
dot -Tpng graph.dot -o architecture.png

🐛 Debugging

Trace complex call chains:

cerberus-mcp callgraph --function "handleRequest" --depth 5 --format json

📝 PR Review

Before merging, check impact:

cerberus-mcp impact --files "src/auth.ts,src/middleware.ts" --max-hops 10

📚 Documentation

Auto-generate API docs from AST:

cerberus-mcp docs --module "public-api" --format markdown > API.md

🔄 Migration Planning

Evaluate refactor scope:

cerberus-mcp analyze --old "src/legacy" --new "src/modern" --report diff.html

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                         AI Agent                            │
│                  (Claude, Cursor, etc.)                    │
└───────────────────────────┬─────────────────────────────────┘
                            │ MCP Request
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                 Cerberus MCP Server                        │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Tree-sitter Parsers (per language)                 │  │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐   │  │
│  │  │ Python  │ │ TS/JS   │ │   Go    │ │   Rust  │   │  │
│  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘   │  │
│  └──────────────────────────────────────────────────────┘  │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  AST Compression Engine                             │  │
│  │  - Inline small functions (< 3 lines)               │  │
│  │  - Deduplicate imports                              │  │
│  │  - Remove dead code                                 │  │
│  │  - Abstract patterns (factory, singleton, etc.)    │  │
│  └──────────────────────────────────────────────────────┘  │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Call Graph Builder                                 │  │
│  │  - Extract references                              │  │
│  │  - Build dependency edges                          │  │
│  │  - Topological sort                                │  │
│  └──────────────────────────────────────────────────────┘  │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  MCP Transport Layer                                │  │
│  │  - stdio / SSE / WebSocket                         │  │
│  │  - JSON-RPC 2.0                                    │  │
│  │  - Streaming responses                             │  │
│  └──────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

📊 Performance

Codebase Size Traditional (tokens) Cerberus (tokens) Reduction Analysis Time
Small (~100 files) 50k 2.5k 95% <500ms
Medium (~1000 files) 500k 12.5k 97.5% <2s
Large (~10000 files) 5M 125k 97.5% <10s

Tested on mixed-language repositories with average file size 200 LOC.

🧪 Testing

# Unit tests
npm test

# Integration tests (requires sample repos)
npm run test:integration

# Performance benchmark
npm run bench

# Expected output:
# ✅ 50 tests passed
# 🕒 1.8s average analysis time
# 📉 94.2% token reduction

📦 Package Structure

cerberus-mcp/
├── src/
│   ├── server.ts          # MCP server implementation
│   ├── analyzer.ts        # AST analysis engine
│   ├── compressor.ts      # Token reduction algorithms
│   ├── callgraph.ts       # Call graph builder
│   └── mcp/
│       ├── handlers.ts    # MCP protocol handlers
│       └── types.ts       # TypeScript definitions
├── tests/
│   ├── unit.test.ts       # Unit tests
│   ├── integration.test.ts
│   └── fixtures/          # Sample codebases
├── examples/
│   ├── react-app/         # Example configuration
│   └── python-microservice/
├── dist/
│   └── cli.js             # Executable entry point
├── package.json
├── README.md
├── LICENSE
├── SKILL.md
└── cerberus-mcp.yaml

🔧 Development

# Build
npm run build

# Watch mode
npm run dev

# Lint
npm run lint

# Format
npm run format

Adding a New Language

  1. Install Tree-sitter grammar: npm install tree-sitter-<language>
  2. Create parser in src/analyzer.ts:
import Parser from 'tree-sitter';
import grammar from 'tree-sitter-<language>';

const parser = new Parser();
parser.setLanguage(grammar);

export function parse<Language>(source: string): Node {
  return parser.parse(source).rootNode;
}
  1. Add language to cerberus-mcp.yaml config.
  2. Write tests in tests/fixtures/<language>/.

🛡️ License

MIT © 2026 OpenClaw Team

🙏 Acknowledgments

📞 Support

  • 🐛 Issues: https://github.com/openclaw/skill-cerberus-mcp/issues
  • 💬 Discord: #skill-cerberus-mcp in OpenClaw server
  • 📖 Docs: https://clawhub.com/skills/cerberus-mcp

Ready to slash your token costs? Install Cerberus MCP today and explore code like never before.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选