要約機能
モデルコンテキストプロトコルのためのインテリジェントなテキスト要約
機能• AIエージェントの統合•インストール•使用方法
概要
クリーンで拡張性の高いアーキテクチャを通じて、インテリジェントな要約機能を提供する強力なMCPサーバー。最新のTypeScriptで構築され、AIワークフローとのシームレスな統合を実現するように設計されています。
インストール
Smithery経由でインストール
Smithery経由で Claude Desktop の要約関数を自動的にインストールするには:
npx -y @smithery/cli install mcp-summarization-functions --client claude
npm i mcp-summarization-functions
AIエージェント統合
このMCPサーバーは、Roo ClineやClineといったAIエージェントのパフォーマンスと信頼性を向上させるために開発されました。AIエージェントの運用における重要な課題であるコンテキストウィンドウ管理に対処します。
コンテキストウィンドウの最適化
AI エージェントは、次のような大量の出力でコンテキスト ウィンドウが急速にいっぱいになる状況に頻繁に遭遇します。
- コマンド実行結果
- ファイル内容の読み取り
- ディレクトリリスト
- APIレスポンス
- エラーメッセージとスタックトレース
このサーバーは、次の方法で効率的なコンテキストの使用を維持するのに役立ちます。
- 完全な内容ではなく、簡潔で関連性のある要約を提供する
- 必要なときに参照できるように完全なコンテンツを保存する
- 特定のニーズ (セキュリティ、API サーフェスなど) に基づいた集中的な分析を提供します。
- 最適なコンテキスト利用のために複数の出力形式をサポート
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
}
ライセンス
マサチューセッツ工科大学