Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`McpServer.toolkit` should not hoist tool dependencies into the registration step

Chiusa
#9,114 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@effect-bot ci sta già lavorando.

Dal 13/10/2026.

  • #9154 di @effect-bot — integrata

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement
What is the problem this feature would solve?

The fix made in https://github.com/Effect-TS/effect/pull/8842 exposes a problem with the design of McpServer.toolkit that went previously unnoticed in our usage of the function: That we must provide all tool dependencies during layer construction.

Our tools have runtime dependencies that are supplied by the request (a user session, etc) and cannot be met earlier. Previously, these requirements went unmet during layer construction, and were then met without problem during tool execution.

Now, no mechanism exists to mark dependencies as execution dependencies, and so we cannot construct our McpServer layer any more.

What is the feature you are proposing to solve the problem?

MCP registration needs a way to defer dependencies to invocation time. Either through router-style markers such as Request<"Requires", Session>, or an option passed during construction of the toolkit registration layer: McpServer.toolkit(MyToolkit, { executionDependencies: [Session] }). Those dependencies should remain requirements of the request handler rather than of server construction.

What alternatives have you considered?
  • Optional service lookup: hides a mandatory dependency and replaces compile-time safety with a runtime failure.
  • Custom toHttpEffect adapter: works in a prototype, but this needs a type assertion, and relies on registration not actually reading the dependency during construction.
  • Request-local server construction: satisfies dependencies honestly, but requires changing our sessionful protocol choice (McpProtocol.v2025_11_25) and legacy elicitation flow. Generally, constructing a whole MCP server on every request seems like a bad idea, but it's the only non-hacky solution that the current API design pushes us to.
  • Custom RPC/Toolkit integration: preserves explicit execution requirements, but means taking over substantial MCP transport and lifecycle handling.
Lingua principale
TypeScript
Stelle
16.7k
Fork
808
Merge medio
10h 14m
PR unite (30g)
625

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Effect-TS/effect

Tutte le issue di Effect-TS/effect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.