cerebro
Cérebro 2.0
OpenCode용 컨텍스트 최적화 서버. LLMLingua-2로 LLM 프롬프트를 압축하고 작업 프로토콜을 주입하며 2nd Brain 지식 그래프를 제공합니다.
아키텍처
┌─────────────────────────────────────────────────┐
│ OpenCode │
│ ┌──────────────┐ ┌──────────────────────────┐ │
│ │ Plugin │ │ MCP Client │ │
│ │ (hooks) │ │ (tools) │ │
│ └──────┬───────┘ └────────────┬─────────────┘ │
│ │ │ │
└─────────┼───────────────────────┼────────────────┘
│ │
┌─────▼─────┐ ┌──────▼──────┐
│ Compressor │ │ MCP Server │
│ LLMLingua-2│ │ + HTTP API │
└─────┬─────┘ └──────┬──────┘
│ │
┌─────▼───────────────────────▼──────┐
│ @cerebro/core │
│ compressor · task-injector · brain │
└────────────────────────────────────┘패키지
패키지 | 설명 |
| 압축 엔진, 작업 주입기, 브레인 엔진, 메트릭스 |
| MCP stdio 서버 + 대시보드용 HTTP API |
| OpenCode 플러그인(메시지 압축 + 작업 주입) |
| Vite + React + Tailwind 대시보드 UI |
Related MCP server: repocontext
빠른 시작
# Install dependencies
pnpm install
# Approve native builds (onnxruntime-node)
pnpm approve-builds
# Run tests
pnpm test
# Build all packages
pnpm -r build
# Start MCP server (stdio for OpenCode)
node packages/mcp-server/dist/index.js
# Start dashboard dev server
pnpm --filter @cerebro/dashboard dev구성
환경 변수(opencode.json의 environment 아래에 설정):
변수 | 기본값 | 설명 |
|
| 압축 비율(0.05–1.0, 낮을수록 더 압축) |
|
| 2nd Brain 지식 베이스 경로 |
|
| 대시보드 HTTP API 포트 |
|
| 작업 프로토콜 주입 활성화 |
|
| 쉼표로 구분된 보호 블록 패턴 |
OpenCode 연동
프로젝트 루트의 opencode.json에 추가하세요:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"cerebro": {
"type": "local",
"command": ["node", "caminho/para/cerebro/packages/mcp-server/dist/index.js"],
"environment": {
"COMPRESSION_RATE": "0.4",
"BRAIN_PATH": ".context-brain",
"DASHBOARD_PORT": "4321",
"ENABLE_TASK_INJECTION": "true"
},
"enabled": true
}
}
}MCP 도구
compress_prompt
LLMLingua-2 ONNX를 사용해 텍스트를 압축합니다.
{ "text": "Your long prompt...", "rate": 0.4 }brain_resolve
2nd Brain에서 화면과 해당 위키 연결 의존성을 조회합니다.
{ "screen": "dashboard-vendas", "depth": 1 }brain_index
지식 그래프의 화면을 인덱싱하거나 업데이트합니다.
{
"id": "dashboard-vendas",
"content": "---\ntitle: Dashboard Vendas\n---\n\n# Dashboard Vendas\n\nMetrics for the sales dashboard."
}brain_screens
인덱스된 모든 화면을 나열합니다. 매개변수는 없습니다.
cerebro_metrics
압축 메트릭스와 토큰 절감량을 가져옵니다. 매개변수는 없습니다.
cerebro_config
런타임 구성을 가져오거나 설정합니다.
{ "key": "compressionRate", "value": 0.3 }대시보드
대시보드는 포트 4321에서 실행되며 다음을 제공합니다:
메트릭스: 압축 통계, 토큰 절감, 최근 이벤트
2nd Brain: 인덱스된 화면과 위키 링크 탐색
구성: 런타임 구성 보기 및 편집
pnpm --filter @cerebro/dashboard dev
# Open http://localhost:4321플러그인 훅
OpenCode 플러그인은 세 가지 훅을 제공합니다:
훅 | 설명 |
| LLM에 보내기 전 이전 메시지를 압축합니다. |
| 시스템 프롬프트에 작업 프로토콜 + 자체 점검을 주입합니다. |
| 대시보드 표시를 위해 도구 실행을 기록합니다. |
개발
# Type check all packages
pnpm -r typecheck
# Run tests
pnpm test
# Watch mode
npx vitest
# Build dashboard
pnpm --filter @cerebro/dashboard build테스트
6개 스위트에 걸친 66개 테스트:
packages/core/src/ task-injector.test.ts (18) · metrics.test.ts (5)
packages/mcp-server/src/ errors.test.ts (9) · rate-limiter.test.ts (7) · e2e.test.ts (10)
packages/plugin/src/ plugin.test.ts (8)pnpm test 또는 npx vitest run으로 실행합니다.
라이선스
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Intelligent context infrastructure for AI teams: knowledge graph, sessions, tasks, documents.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Shared memory and context across ChatGPT, Claude, Claude Code, Codex, Cursor and 20+ AI tools
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
Related MCP Servers
- AlicenseAqualityCmaintenanceProvides intelligent code context and analysis through semantic compression, AST parsing, and multi-language support. Offers 60-80% token reduction while enabling AI assistants to understand codebases through local analysis, OpenAI-enhanced insights, and GitHub repository integration.6229 npm3MIT
- AlicenseAqualityBmaintenanceNext-gen AST codebase map, token compression (70%~85% savings), and context packaging engine for AI coding agents & IDEs.43MIT
- AlicenseNot gradedqualityCmaintenanceEnables autonomous context window management, prompt caching, token optimization, and real-time observability for AI coding agents across multiple IDEs, reducing token costs and improving performance.Apache 2.0
- AlicenseBqualityBmaintenanceEnables AI coding agents and local LLMs to store and recall project memory, compact verbose logs, look up code symbols, create and rewind workspace snapshots, detect risky commands and loops, pack context optimally, and draft tokens through MCP tools.102Apache 2.0