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

パッケージ

Package

Description

@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 に設定):

Variable

Default

Description

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

スクリーンとその Wiki リンクされた依存関係を 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 で動作し、次のものを提供します:

  • Métricas: 圧縮統計、トークン削減量、最近のイベント

  • 2º Cérebro: インデックス済みスクリーンとその Wiki リンクを閲覧

  • Config: ランタイム設定の表示と編集

pnpm --filter @cerebro/dashboard dev
# Open http://localhost:4321

プラグインフック

OpenCode プラグインには 3 つのフックがあります:

Hook

Description

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