github / github/app

Dynamic MCP Tool Loading to Reduce Context Window Consumption

オープン
#1,398 コメント 3 件 リアクション 4 件 担当者 0 名 GitHub で見る
Requests and ideas
主要言語
言語のデータがありません
スター
2.1k
フォーク
153
PR マージ指標
30日以内にマージされた PR はありません

説明

### Feature summary

Currently, all MCP tool definitions from all connected servers are included in the context window on every turn, regardless of whether they are relevant to the current task

### What problem are you trying to solve?

---

### Problem

All MCP tool definitions from all connected servers are included in the context window on every turn, regardless of whether they are relevant to the current task. In environments with multiple MCP servers, this can result in **hundreds of tool schemas consuming tens of thousands of tokens** before any conversation content is processed.

This means:
- Significantly reduced capacity for actual code, diffs, file content, and conversation history
- Earlier context truncation in long sessions
- Wasted tokens on tools that will never be invoked in a given session
- Degraded quality on complex tasks that need deep context

---

### Proposed solution

### Proposed Solution

Provide mechanisms to selectively load/unload MCP tools to minimize context window usage:

1. **Per-session tool profiles** — Allow users to define named profiles (e.g., "code-review", "incident-triage", "deployment") that only load relevant MCP servers/tools.

2. **Lazy/on-demand tool loading** — Only include a tool's full schema in context when it's first needed. Use a lightweight tool registry (name + one-line description) for discovery, expanding the full schema only when invoked.

3. **Session-scoped enable/disable** — A command to toggle MCP servers on/off mid-session without restarting.

4. **Task-based auto-selection** — Intelligently infer which MCP servers are relevant based on the user's first message and only load those.

5. **Tool grouping within servers** — Allow disabling subsets of a server's tools rather than all-or-nothing per server.

### Impact

- Frees significant context capacity for actual work content
- Improves response quality on context-heavy tasks (large code reviews, multi-file changes)
- Reduces latency (fewer tokens to process per turn)
- Better user control over their tool environment

### Workflow impact

_No response_

### Installation context

_No response_

### Additional context

_No response_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

The issue names no files, tests, or entry points. Start by locating the existing MCP tool registration and context assembly, then narrow the proposal to one mechanism with explicit acceptance criteria for context-window usage and session behavior.

索引モデルが issue の本文から書いたものです。

評価

領域
ai, desktop
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。