fix(mcp-adapter): list lazy servers in proxy tool description - #1106
fix(mcp-adapter): list lazy servers in proxy tool description#1106thomasstrang-cast wants to merge 2 commits into
Conversation
Lazy MCP servers (configured but not yet connected, no cached tool
metadata) were silently skipped by buildProxyDescription(), making them
invisible to the agent. The agent had no way to know these servers
existed without being told externally.
Now lazy servers appear in the 'Servers:' line with a (lazy) marker,
e.g. 'Servers: mcp-atlassian (63 tools), castai (lazy)'. The agent
can then connect on demand via mcp({ connect: 'server' }) to discover
and use their tools.
Co-Authored-By: Kimchi <noreply@kimchi.dev>
|
Documentation Changes Added
Actions
If neither actions are selected, on PR close/merge the docs branch in ReadMe will remain open. |
Kimchi Code Review
Summary📊 Review Score: 88/100 (overall code quality — 0 lowest, 100 highest) 🧪 Tests: yes — A new 📝 Found 1 issue(s). See inline comments for details. What to expectKimchi will analyze the changes in this pull request and post:
The review typically completes within a few minutes. This comment will be updated once the review is ready. Interact with Kimchi
ConfigurationReviews are configured by your organization admin. Powered by Kimchi — AI-powered code review by CAST AI |
There was a problem hiding this comment.
📊 Review Score: 88/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 1/5 (1 = trivial, 5 = very complex)
🧪 Tests: yes — A new direct-tools.test.ts file covers lazy server visibility, multiple lazy servers, eager-only behaviour, and the no-servers case. It does not cover a cached server with zero tools/resources.
📝 Found 1 issue(s). See inline comments for details.
A cached server with zero discoverable tools (e.g. all excluded by filter) was incorrectly labelled (lazy). Now only servers with no cache entry get the (lazy) marker; cached-but-empty servers are skipped silently. Co-Authored-By: Kimchi <noreply@kimchi.dev>
Problem
Before:

After:

Context:
Lazy MCP servers (configured but not yet connected) were silently skipped when injecting mcp description into contet, making them invisible to the agent. i.e. the agent did not know what MCPs are configured and not yet loaded.
Solution
Modified
buildProxyDescription()insrc/extensions/mcp-adapter/direct-tools.tsto list lazy servers with a(lazy)marker in theServers:line instead of skipping them:The agent can then connect on demand via
mcp({ connect: "castai" })to discover and use their tools.Verification
pnpm run checkpasses (biome lint + tsc type check, 0 errors)Co-Authored-By: Kimchi noreply@kimchi.dev