Skip to content

fix(mcp): keep facade tools available after late connections - #4

Draft
luoye520ww wants to merge 6 commits into
developfrom
fix/mcp-facade-search-late-registration
Draft

fix(mcp): keep facade tools available after late connections#4
luoye520ww wants to merge 6 commits into
developfrom
fix/mcp-facade-search-late-registration

Conversation

@luoye520ww

@luoye520ww luoye520ww commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Partial implementation for the rejected KunAgent#697 replacement.

Problem

In MCP search mode, late-connected servers from OAuth/background reconnect can gain resources/prompts capabilities after startup. A startup-only provider registration path can miss those capabilities.

Changes implemented

  • Extended McpClientLike with optional resources/prompts methods:
    • listResources
    • readResource
    • listResourceTemplates
    • listPrompts
    • getPrompt
  • Added conservative resource/template/prompt descriptor types.
  • Updated the SDK transport wrapper to forward those optional SDK methods when present.
  • Added kun/src/adapters/tool/mcp-facade-provider.ts, a stable facade provider that exposes:
    • mcp_list_resources
    • mcp_read_resource
    • mcp_list_resource_templates
    • mcp_list_prompts
    • mcp_get_prompt
  • Removed the non-code .kun/review-plans file from this PR scope.

Still required before this PR is reviewable

  • Wire createMcpFacadeProvider(connected) into mcp-tool-provider.ts regardless of searchActive.
  • Ensure advertisedToolCount is computed after adding the facade provider.
  • Add tests for search-mode startup, OAuth late connect, background reconnect, and no direct-provider duplication.

Validation to run locally

npm --prefix kun run typecheck
npm --prefix kun test

I could not run local commands from this environment, so this remains draft.

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.

1 participant