mcpField
S
Summarization Functions

Summarization Functions

ローカル
github.com/BraffolkAI・エージェント3771 週間前に更新

Summarization Functions について

Summarization Functions は、コマンド出力、ファイル内容、ディレクトリ構造、任意のテキストを要約する MCP サーバーで、AI エージェントのコンテキストウィンドウ消費を抑えます。Cline や Roo Cline などのコーディングエージェントを主な対象とし、複数のモデルプロバイダーに対応しています。

主な機能

  1. 01コマンド出力の要約
  2. 02単一および複数ファイルの内容分析
  3. 03ディレクトリ構造の概要表示
  4. 04任意テキストの要約と全文の取得
  5. 05プロバイダーとキャッシュ期間の設定

活用シーン

  1. 01エージェントが大きなファイルを読む際のコンテキスト使用量の削減
  2. 02長いログやコマンド出力、API レスポンスの圧縮
  3. 03未知のプロジェクトのディレクトリ構成の把握

MCP 対応

本プロジェクトは MCP サーバーとして、summarize_command、summarize_files、summarize_directory、summarize_text、get_full_content などのツールを MCP クライアントに提供します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

Summarization Functions

Model Context Protocol 向けのインテリジェントなテキスト要約

機能 • AI エージェントとの統合 • インストール • 使い方

smithery badge npm version


概要

すっきりとした拡張可能なアーキテクチャを通じて、インテリジェントな要約機能を提供する強力な MCP サーバーです。モダンな TypeScript で構築され、AI ワークフローにシームレスに統合できるよう設計されています。

インストール

Smithery 経由でのインストール

Smithery 経由で、Claude Desktop 用の Summarization Functions を自動的にインストールするには:

npx -y @smithery/cli install mcp-summarization-functions --client claude
npm i mcp-summarization-functions

AI エージェントとの統合

この MCP サーバーは主に、Roo Cline や Cline などの AI エージェントのパフォーマンスと信頼性を高めるために開発されました。AI エージェントの運用における重要な課題である、コンテキストウィンドウの管理に対処します。

コンテキストウィンドウの最適化

AI エージェントでは、次のような大きな出力によってコンテキストウィンドウがすぐに埋まってしまうことがよくあります。

  • コマンド実行結果
  • ファイル内容の読み取り結果
  • ディレクトリ一覧
  • API の応答
  • エラーメッセージとスタックトレース

このサーバーは、次の方法で効率的なコンテキストの使用を維持します。

  1. 全文の代わりに、簡潔で関連性の高い要約を提供する
  2. 必要に応じて参照できるよう、全文を保存する
  3. 特定のニーズ(セキュリティ、API サーフェスなど)に基づいた、焦点を絞った分析を提供する
  4. コンテキストを最適に活用できるよう、複数の出力形式に対応する
AI エージェントにとってのメリット
  • 失敗率の低減:コンテキストウィンドウのあふれを防止します
  • 応答品質の向上:焦点を絞った、関連性の高い要約を提供します
  • 効率の向上:ノイズを減らしながら、重要なコンテキストを維持します
  • リソース管理の改善:インテリジェントなコンテンツのキャッシュと取得を行います
  • 柔軟な統合:複数の AI プロバイダーと設定オプションに対応します
推奨される AI エージェント向けプロンプト

AI エージェントと統合する際は、エージェントへの指示に次の内容を含めてください。

# CONTEXT MANAGEMENT

You have access to summarization functions through the MCP server. These functions are NOT optional - you MUST use them for ALL potentially large outputs to prevent context overflow:

MANDATORY SUMMARIZATION:
- You MUST ALWAYS use summarization functions for:
    - ANY first time file reading operations (unless you are CERTAIN its small and you are going to edit it)
    - ALL command execution outputs
    - EVERY directory analysis
    - ANY API responses or error logs
    - ANY output that could be large

NEVER attempt to process raw output directly - ALWAYS use the appropriate summarization function:
• For commands: summarize_command
• For files: summarize_files
• For directories: summarize_directory
• For other text: summarize_text

ALWAYS utilize available features:
• Specify hints for focused analysis
• Choose appropriate output formats
• Use content IDs to access full details only when absolutely necessary

There is NO NEED to process perfect or complete output. Summarized content is ALWAYS preferred over raw data. When in doubt, use summarization.

Ollama リポジトリでの要約の動作例(Gemini 2.0 Flash による要約、Claude 3.5 エージェント)

代替テキスト

機能

  • コマンド出力の要約
    コマンドを実行し、その出力の簡潔な要約を取得します

  • ファイル内容の分析
    技術的な正確さを保ちながら、単一または複数のファイルを要約します

  • ディレクトリ構造の理解
    複雑なディレクトリ構造のわかりやすい概要を取得します

  • 柔軟なモデル対応 さまざまなプロバイダーのモデルを使用できます

  • AI エージェント向けコンテキスト最適化 インテリジェントな要約により、コンテキストウィンドウのあふれを防ぎ、AI エージェントのパフォーマンスを高めます

設定

このサーバーは環境変数を通じて、複数の AI プロバイダーに対応しています。

必須の環境変数
  • PROVIDER:使用する AI プロバイダー。次の値に対応しています。 - ANTHROPIC - Anthropic の Claude モデル - OPENAI - OpenAI の GPT モデル - OPENAI-COMPATIBLE - OpenAI 互換 API(例:Azure) - GOOGLE - Google の Gemini モデル
  • API_KEY:選択したプロバイダーの API キー
任意の環境変数
  • MODEL_ID:使用する特定のモデル(既定値はプロバイダーの標準モデル)
  • PROVIDER_BASE_URL:OpenAI 互換プロバイダー用のカスタム API エンドポイント
  • MAX_TOKENS:モデルの応答に使用する最大トークン数(既定値:1024)
  • SUMMARIZATION_CHAR_THRESHOLD:要約を行う文字数のしきい値(既定値:512)
  • SUMMARIZATION_CACHE_MAX_AGE:キャッシュの有効期間(ミリ秒)(既定値:3600000 - 1 時間)
  • MCP_WORKING_DIR - 相対パスでファイルを検索する際のフォールバックディレクトリ
設定例
# Anthropic Configuration
PROVIDER=ANTHROPIC
API_KEY=your-anthropic-key
MODEL_ID=claude-3-5-sonnet-20241022

# OpenAI Configuration
PROVIDER=OPENAI
API_KEY=your-openai-key
MODEL_ID=gpt-4-turbo-preview

# Azure OpenAI Configuration
PROVIDER=OPENAI-COMPATIBLE
API_KEY=your-azure-key
PROVIDER_BASE_URL=https://your-resource.openai.azure.com
MODEL_ID=your-deployment-name

# Google Configuration
PROVIDER=GOOGLE
API_KEY=your-google-key
MODEL_ID=gemini-2.0-flash-exp

使い方

MCP 設定ファイルにサーバーを追加します。

{
		"mcpServers": {
				"MUST_USE_summarization": {
						"command": "node",
						"args": ["path/to/summarization-functions/build/index.js"],
						"env": {
								"PROVIDER": "ANTHROPIC",
								"API_KEY": "your-api-key",
								"MODEL_ID": "claude-3-5-sonnet-20241022",
                "MCP_WORKING_DIR": "default_working_directory"
						}
				}
		}
}
利用可能な関数

サーバーは、次の要約ツールを提供します。

summarize_command

コマンドを実行し、出力を要約します。

{
  // Required
  command: string,    // Command to execute
  cwd: string,       // Working directory for command execution
  
  // Optional
  hint?: string,      // Focus area: "security_analysis" | "api_surface" | "error_handling" | "dependencies" | "type_definitions"
  output_format?: string  // Format: "text" | "json" | "markdown" | "outline" (default: "text")
}
summarize_files

ファイルの内容を要約します。

{
  // Required
  paths: string[],    // Array of file paths to summarize (relative to cwd)
  cwd: string,       // Working directory for resolving file paths
  
  // Optional
  hint?: string,      // Focus area: "security_analysis" | "api_surface" | "error_handling" | "dependencies" | "type_definitions"
  output_format?: string  // Format: "text" | "json" | "markdown" | "outline" (default: "text")
}
summarize_directory

ディレクトリ構造の概要を取得します。

{
  // Required
  path: string,       // Directory path to summarize (relative to cwd)
  cwd: string,       // Working directory for resolving directory path
  
  // Optional
  recursive?: boolean,  // Whether to include subdirectories. Safe for deep directories
  hint?: string,       // Focus area: "security_analysis" | "api_surface" | "error_handling" | "dependencies" | "type_definitions"
  output_format?: string   // Format: "text" | "json" | "markdown" | "outline" (default: "text")
}
summarize_text

任意のテキストコンテンツを要約します。

{
  // Required
  content: string,    // Text content to summarize
  type: string,       // Type of content (e.g., "log output", "API response")
  
  // Optional
  hint?: string,      // Focus area: "security_analysis" | "api_surface" | "error_handling" | "dependencies" | "type_definitions"
  output_format?: string  // Format: "text" | "json" | "markdown" | "outline" (default: "text")
}
get_full_content

指定された要約 ID の全文を取得します。

{
  // Required
  id: string         // ID of the stored content
}

評価の実行

evals パッケージは MCP クライアントを読み込み、その後 index.ts ファイルを実行するため、テストのたびに再ビルドする必要はありません。npx コマンドの前に環境変数を指定して読み込むことができます。詳しいドキュメントはこちらをご覧ください。

OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/server/mcp-server.ts

ライセンス

MIT

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。