feat(mcp): choose tool exposure automatically / 自动选择 MCP 工具暴露模式 - #7775
Draft
SivanCola wants to merge 2 commits into
Draft
feat(mcp): choose tool exposure automatically / 自动选择 MCP 工具暴露模式#7775SivanCola wants to merge 2 commits into
SivanCola wants to merge 2 commits into
Conversation
Large MCP catalogs can consume a substantial provider tool prefix, while cache-miss handshakes can change the visible schema after boot. The previous behavior had no automatic boundary between direct per-tool exposure and the existing use_capability proxy. Choose the exposure mode once per session from cached tool counts and estimated schema bytes. Keep small, cache-valid surfaces direct; route large or unknown surfaces through the stable use_capability proxy without adding a user setting. Cache-miss discovery still warms the cache and records failures through a private registry, so it cannot mutate the provider-visible registry. Add bounded diagnostics, bilingual documentation, and boot/integration coverage for small, large, stale, and cold MCP surfaces. Tests: go test ./... Tests: go test -race ./internal/boot Checks: go vet ./internal/boot ./internal/capability ./internal/plugin ./internal/agent Co-authored-by: bfxh <243242559+bfxh@users.noreply.github.com>
SivanCola
force-pushed
the
feature/auto-mcp-exposure
branch
from
August 6, 2026 14:13
0f49f9a to
9880a2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
use_capabilityproxy.mcp__*tools to the provider-visible registry.在会话启动时自动决定配置 MCP 使用直接工具还是
use_capability代理,不增加用户设置项;小型且缓存命中的工具面保持直连,大型、schema 过大或缓存未知的工具面自动使用稳定代理,并在整个会话内固定选择。Required impact declarations
Documentation-impact: updated - documented automatic MCP exposure selection in English and Chinese.
Cache-impact: medium - large or unknown MCP surfaces receive a one-time stable proxy prefix; the decision is fixed for the session.
Cache-guard: go test ./internal/boot -run 'TestChooseMCPExposure|TestBuildAutomaticallyUsesCapabilityForLargeMCPSurface|TestBuildKeepsSmallMCPSurfaceDirect'
System-prompt-review: Codex review completed - no system-prompt text changes; only boot-time provider tool selection changes.
Why
Large MCP catalogs can consume a substantial provider tool prefix. A cache miss can also complete its handshake after boot and mutate the visible tool list. The automatic boundary keeps the ordinary path zero-configuration while preserving direct calls where their schema cost is small.
This adapts the MCP surface-collapse direction proposed by @bfxh in #7743. It intentionally does not include the user-facing meta-tool toggle or the unrelated long-horizon/navigation changes from that PR.
Refs #7743
Compatibility and cache impact
mcp__*behavior.use_capabilityschema instead of many MCP schemas.Verification
go test ./...go test -race ./internal/bootgo vet ./internal/boot ./internal/capability ./internal/plugin ./internal/agentuse_capability, small surfaces retain direct tools, and cold/stale caches choose the stable proxy while preserving background discovery diagnostics.