Skip to content

feat: mcp-search tool for lazy loading mcp#12520

Open
TheOutdoorProgrammer wants to merge 1 commit intoanomalyco:devfrom
TheOutdoorProgrammer:dev
Open

feat: mcp-search tool for lazy loading mcp#12520
TheOutdoorProgrammer wants to merge 1 commit intoanomalyco:devfrom
TheOutdoorProgrammer:dev

Conversation

@TheOutdoorProgrammer
Copy link

rebased #8771 onto the head of dev.

Closes #8625.

What does this PR do?

Adds a new experimental.mcp_lazy config option that prevents MCP tools from being loaded into context automatically. Instead, a new mcp_search tool is provided to discover and call MCP tools on-demand.

This reduces context usage for users with many MCP servers configured. When enabled:

  • MCP tools are excluded from the tool list sent to the model

    • Instead, available MCP servers are injected into the system prompt in a compact format.
  • The mcp_search tool allows listing, searching, describing, and calling MCP tools

  • MCP servers show "Lazy" status in the /mcp dialog

The injected prompt:

<mcp_servers>
Available MCP servers: context7, firecrawl, playwright
Use mcp_search tool to discover and call tools from these servers.
</mcp_servers>

How did you verify your code works?

  • Tested with experimental.mcp_lazy: true in config
  • Verified MCP tools are not in context and mcp_search appears instead
  • Tested all operations: list, search, describe, call
  • Confirmed servers connect on-demand when calling tools

The tests were manual, there are no actual tests included here.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found:

PR #8771 - "feat: add mcp_lazy mode for on-demand MCP tool loading"
#8771

Why it's related: This is the original PR that the current PR #12520 is based on. According to the PR description, PR #12520 is a rebase of PR #8771 onto the head of dev. Both PRs address the same feature: implementing lazy loading for MCP tools with the mcp_search tool to discover and call tools on-demand instead of loading them automatically.

Since PR #12520 is explicitly stated to be a rebase of PR #8771, you should verify whether #8771 is still open or if it should be closed in favor of #12520.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]:Add mcp search tool, reduce mcp tool occupying a lot of context

1 participant