Skip to main content
Glama

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 │
    └────────────────────────────────────┘

패키지

패키지

설명

@cerebro/core

압축 엔진, 작업 주입기, 브레인 엔진, 메트릭스

@cerebro/mcp-server

MCP stdio 서버 + 대시보드용 HTTP API

@cerebro/plugin

OpenCode 플러그인(메시지 압축 + 작업 주입)

@cerebro/dashboard

Vite + React + Tailwind 대시보드 UI

Related MCP server: ContextStream MCP Server

빠른 시작

# 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.jsonenvironment 아래에 설정):

변수

기본값

설명

COMPRESSION_RATE

0.4

압축 비율(0.05–1.0, 낮을수록 더 압축)

BRAIN_PATH

.context-brain

2nd Brain 지식 베이스 경로

DASHBOARD_PORT

4321

대시보드 HTTP API 포트

ENABLE_TASK_INJECTION

true

작업 프로토콜 주입 활성화

PROTECTED_PATTERNS

code,json,errors,system

쉼표로 구분된 보호 블록 패턴

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 플러그인은 세 가지 훅을 제공합니다:

설명

experimental.chat.messages.transform

LLM에 보내기 전 이전 메시지를 압축합니다.

experimental.chat.system.transform

시스템 프롬프트에 작업 프로토콜 + 자체 점검을 주입합니다.

tool.execute.after

대시보드 표시를 위해 도구 실행을 기록합니다.

개발

# 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

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Provides 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.
    6
    12
    3
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Provides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.
    5
    32
    MIT

View all related MCP servers

Related MCP Connectors

  • The project brain for AI coding agents — memory, decisions, sprints, knowledge base via MCP.

  • Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Wendell-A/cerebro2.0-lowvram'

If you have feedback or need assistance with the MCP directory API, please join our Discord server