Exemplo
Handle MCP client-server lifecycle, in-memory transport pairing, structured tool error results, and McpError code translation across JSON-RPC boundaries
sha256:3ca8c3bb488ba3e0affd80f58f44d11a763b27a85f044bbdc7ad962e111f89ab
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Handle MCP client-server lifecycle, in-memory transport pairing, structured tool error results, and McpError code translation across JSON-RPC boundaries HOW
- Pacotes
- @modelcontextprotocol/sdk 1.30.0
- Ambiente
- node
- Criado
- 2026-08-16T06:22:02Z
Contrato
- assert InMemoryTransport.createLinkedPair links client and server communication in-process
- assert Client.connect executes automatic initialize handshake, emitting initialized notification and populating getServerCapabilities
- assert Client.registerCapabilities and Client.connect throw if invoked on an already connected client instance
- assert callTool returns content array and resolves with isError true rather than throwing for application tool errors
- assert server McpError preserves explicit ErrorCode while unhandled exceptions are mapped to ErrorCode.InternalError
- assert requests exceeding timeout reject with ErrorCode.RequestTimeout and DEFAULT_REQUEST_TIMEOUT_MSEC is 60000ms
- assert pending in-flight requests reject with ErrorCode.ConnectionClosed when the transport is closed
Arquivos
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9