Replies: 2 comments
|
Reproduced independently with a stdio MCP server (~96 tools) via the Python SDK: the first run() after construction gets a session whose request/header tool list contains only the fs/todo tools; inserting a ~5s delay between client.start() and the first run() reliably makes the MCP tools appear. Same blind-sleep workaround as OP, same discomfort with it. The interaction with #1241 is what makes this dangerous: with no stderr diagnostics in the jsonrpc composition, the failure is completely silent — an unattended embedder gets a healthy-looking session that simply lacks its tools. Of OP's three proposals, gating initialize (or session/new) on initial activation seems strictly better than a status query, since no client has to remember to poll. Details of my repro in #2273. |
|
An immediately usable alternative is now available through dsh plugin --profile web add pi2dsh
dsh plugin --profile web add pi-mcp-adapterThe stock-stack E2E creates startup Agent A and This does not claim to fix the readiness seam in the official https://github.com/weijiafu14/pi2dsh/tree/main/examples/tui-mcp |
Uh oh!
There was an error while loading. Please reload this page.
Summary
dsh-mcp-clientregisters its tools asynchronously after plugin activation, andneither
initializenor any notification on the SDK JSON-RPC wire reflects whenthat registration has settled. A
session/promptdispatched promptly after boottherefore assembles its request tool schemas before
tools/listcompletes: themodel's first turn sees only the built-in tools, with no error anywhere — it
simply behaves as if the MCP servers don't exist (in our case it started
exploring the environment with
bashinstead of calling the stock-data tool theuser expected).
Reproduction
Composition: the SDK server + agent spine +
llm-deepseek+ N@deepseek-ai/dsh-mcp-clientrows (streamable-http, local live servers thatanswer
initialize/tools/listnormally). All packages0.1.0-rc.6.packaged-bin.js(plain Node),initialize, thensession/promptimmediately — the standard SDK calling pattern.
request/headerevent lists onlybash edit read skill todo_write write. Nomcp__*tools. No error.mcp__<server>__<tool>set (33 tools in our composition).Timing-dependent: we first integrated via a source-mode launch (
tsxon a repocheckout) where ~8s of TypeScript compilation masked the race — MCP clients
always won. Moving to the packaged runtime (~1s to first prompt) made the first
turn lose the race deterministically.
Why a consumer can't fix this cleanly
There is nothing to await or observe:
initializeresolves before/independently of MCP discovery;Our current workaround is a blind, bounded sleep after spawn whenever the
composition carries MCP rows — it taxes every cold start and still guarantees
nothing under load.
Ask (any of these would do)
initialize(or a dedicated request) on the composed MCP clients'initial discovery settling — bounded by the total-timeout proposal in Proposal: bound MCP connection and tool discovery with one total timeout #247 so
an unresponsive server can't wedge boot; or
to codex's
mcpServer/startupStatus/updated), so clients can wait forterminal states; or
discovery state.
Related: #247 (bounding connection + discovery with one total timeout — the
readiness signal is the consumer-visible half of the same lifecycle) and #314
(silent
streamable-httpfailures — a readiness/status surface would have madethat diagnosable too).
Environment
@deepseek-ai/dsh-*0.1.0-rc.6(npm closure,packaged-bin.jsunder plainNode 22.19 / 25), macOS 15. MCP servers: local streamable-http, responsive.
All reactions