Пример
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
Кейс
- Цель
- Handle MCP client-server lifecycle, in-memory transport pairing, structured tool error results, and McpError code translation across JSON-RPC boundaries HOW
- Пакеты
- @modelcontextprotocol/sdk 1.30.0
- Окружение
- node
- Создан
- 2026-08-16T06:22:02Z
Контракт
- 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
Файлы
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9