{"_id":"@aidex/mcp","_rev":"8-960f2f789babea931ce41d8b65bac33b","name":"@aidex/mcp","dist-tags":{"latest":"1.2.0"},"versions":{"0.1.0-alpha":{"name":"@aidex/mcp","version":"0.1.0-alpha","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@0.1.0-alpha","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"c9fe1026b30364ac4a79e2c2ea9a49d165d62ad2","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-0.1.0-alpha.tgz","fileCount":103,"integrity":"sha512-aM2Bvp+CGSxJhBQeZg9wVjCYL62iGCzVMwsYtfKGklUI5MkP5wJX5SF7Cic/97WgtbJkZnXwjYs+z0BOtPg7WA==","signatures":[{"sig":"MEQCIFtJ7zHVLNZ8IQAty//uaJnoXPT7UiUQmM8QPUwNrNJNAiBoY0lJi6sN2y4pFM0u3K85ButS+VNVFRdbhzMLFvuKgw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95612},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -b","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"0.1.0-alpha"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.0-alpha_1785768576110_0.3402468058094863","host":"s3://npm-registry-packages-npm-production"}},"0.2.0-alpha":{"name":"@aidex/mcp","version":"0.2.0-alpha","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@0.2.0-alpha","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"1ed809596948a730a5ad7e6cffde0d4f40ef476b","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-0.2.0-alpha.tgz","fileCount":57,"integrity":"sha512-iebiriQn0kMajmCoSfeijrTa4lTETsBn8tFLD4g+mmjA+JZwWJDaPDwAL1p5IKsnRLi+BjfE5cEsGr+6wXmpGQ==","signatures":[{"sig":"MEQCIBVDu+LFZ0wIHFCfmlk4f1hpniiaWAa+nFqvnsJwuzdNAiB1E0x6+wFvkfkp8pcJOWDhqYwG1hrcjvbD1VBwaf1xBQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":161018},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"0.2.0-alpha"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_0.2.0-alpha_1785772022150_0.5380793438896017","host":"s3://npm-registry-packages-npm-production"}},"0.2.1-alpha":{"name":"@aidex/mcp","version":"0.2.1-alpha","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@0.2.1-alpha","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"82024b4c3da23049de9d3932a8d194707dce31b8","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-0.2.1-alpha.tgz","fileCount":58,"integrity":"sha512-R+66qbHSJiMAO2fdhh1tjJXG8ClYbLUxlweRvzsVFl+346PSrI3BxrK6Tk/3odNgtWyyYLUWeONvwWbfILwZLg==","signatures":[{"sig":"MEUCICRDm1j0+KqAl8y9kIHuQDPjWVXEafUgH/0Nmnt7LcykAiEA/BJ6oNGYjuq6JpazYTtIY5Qob0JI/MQMSopd4Jk4yhY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":192655},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"0.2.1-alpha"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_0.2.1-alpha_1785778132144_0.10098913477730131","host":"s3://npm-registry-packages-npm-production"}},"0.3.0-alpha":{"name":"@aidex/mcp","version":"0.3.0-alpha","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@0.3.0-alpha","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"40a17352c6e3a3442dd20298b1bc435020c72c53","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-0.3.0-alpha.tgz","fileCount":9,"integrity":"sha512-1Bp+dLwdM0X4aUajcIwHhsw8T/QQ3odW8xjUocsyIP3ThJjFJpRwPmfwytUq1YfO8v1BjQtdZXrQH8PD9YFXpA==","signatures":[{"sig":"MEYCIQDvXZfaK3NwrQeAN7lV18yNBCB0r8UJtJdp6lETuDsfOAIhAM5XiGiJz0uxB4xxlzdU0++7wqhXaJHCB0PhYF8RUcM2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160442},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.19.0","pnpm":">=9"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"0.3.0-alpha"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_0.3.0-alpha_1786213582766_0.09832953679133749","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@aidex/mcp","version":"1.0.0","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@1.0.0","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"511067c1ac89ea51008cca6cdd0c8151b3dd3c22","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-1.0.0.tgz","fileCount":9,"integrity":"sha512-jQq90LwVVLOHXnlhlUuqC35EnaL0CEwfmkgzuT2yvT5qP0g3lY/ZQVMHdHRGCQSmf5fq/4nL4Yv1/F7L+312Vw==","signatures":[{"sig":"MEQCICb67k23YBMs8sodnY7JXq3RwmrE3rmpE/gs66OsTUIFAiAvZXecDr37n4ZoP9n994duixh4RqAcpkl9Fr6DDlGJkw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160430},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.19.0","pnpm":">=9"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_1.0.0_1786431552328_0.0008503747178107979","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@aidex/mcp","version":"1.0.1","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","_id":"@aidex/mcp@1.0.1","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"8e2cf62cb051cb0cd2954710082ed21fdcf03d79","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-1.0.1.tgz","fileCount":9,"integrity":"sha512-Vuu9hfwWuLJU064Z1nRt3mEzdmM9pZSXxckjagmHpJRE7qQxssiF+dQQ0DDQUMABF6qLUDjoHgbkDeu375Rb8w==","signatures":[{"sig":"MEQCIGyN5dMjmXJwoSfK7lI9zTITs/4R7YrhhhaJSakKqZWYAiAk0ZiszWfNd9oCOJLS0BdVc6G9L1BoOGLmhsVVDkKD6Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160430},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.19.0","pnpm":">=9"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"@aidex/core":"1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_1.0.1_1786432191998_0.0484901767383592","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@aidex/mcp","version":"1.1.0","keywords":["ai","mcp","model-context-protocol","server","transport"],"author":{"name":"Sudheer Babu","email":"isudheerbabu.dev@gmail.com"},"license":"MIT","_id":"@aidex/mcp@1.1.0","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","bugs":{"url":"https://github.com/getaidex/aidex/issues"},"dist":{"shasum":"33400abb9acc546ba0f201cf34ab9b6eeaeb75ad","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-1.1.0.tgz","fileCount":58,"integrity":"sha512-9oA5I8XxlI9Xf7ROPvL5Mf+aRJVC9W3VsdhBPpijvtNTYacfScnR0SbOc6JtiWsAEhq/MpfMNjqq2RmttbfwrA==","signatures":[{"sig":"MEQCIFga8PiYZkN6xYJyYCbZwSssNBWIPxLGPty59qtWgFw5AiAXGGHy/ox4wB5uW5xbw+1n9kgFyUXWlNFZeykWIngB5Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":192682},"main":"./dist/index.cjs","type":"module","_from":"file:aidex-mcp-1.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.19.0","pnpm":">=9"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"_resolved":"/tmp/274dfcbe2e1fda8952e4d1498b21acb7/aidex-mcp-1.1.0.tgz","_integrity":"sha512-9oA5I8XxlI9Xf7ROPvL5Mf+aRJVC9W3VsdhBPpijvtNTYacfScnR0SbOc6JtiWsAEhq/MpfMNjqq2RmttbfwrA==","repository":{"url":"git+https://github.com/getaidex/aidex.git","type":"git","directory":"packages/mcp"},"_npmVersion":"10.9.8","description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@aidex/core":"1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp_1.1.0_1787417509129_0.11522339026559769","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@aidex/mcp","version":"1.2.0","description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","keywords":["ai","mcp","model-context-protocol","server","transport"],"license":"MIT","author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","repository":{"type":"git","url":"git+https://github.com/getaidex/aidex.git","directory":"packages/mcp"},"bugs":{"url":"https://github.com/getaidex/aidex/issues"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"publishConfig":{"access":"public"},"dependencies":{"@aidex/core":"1.2.0"},"engines":{"node":">=20.19.0","pnpm":">=9"},"scripts":{"build":"tsc -b && tsup","typecheck":"tsc -b --noEmit"},"_nodeVersion":"24.13.0","_id":"@aidex/mcp@1.2.0","dist":{"integrity":"sha512-xS7OOCw3bPZjUvNmWIBxVkfBJ8vnl6PT7Gg0Res72tiYoVvljFLT8qmxpLRGSlyst1vJPVpagcaaDLrUcytyHQ==","shasum":"c22cfbf15fb32c61c415ce130645c739b7794b30","tarball":"https://registry.npmjs.org/@aidex/mcp/-/mcp-1.2.0.tgz","fileCount":58,"unpackedSize":192682,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCB3I5RfZ0TS0Uoo5M6+AW5GaAE2dE19y0WptIoEhrxsQIgZLu6L+FcDaGonmx4HB7sEhoX+3yElMn6OoLUDDLOFeA="}]},"_npmUser":{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"},"directories":{},"maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp_1.2.0_1787491700232_0.5636897416053193"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T14:49:35.934Z","modified":"2026-08-23T13:28:20.510Z","0.1.0-alpha":"2026-08-03T14:49:36.394Z","0.2.0-alpha":"2026-08-03T15:47:02.290Z","0.2.1-alpha":"2026-08-03T17:28:52.303Z","0.3.0-alpha":"2026-08-08T18:26:22.921Z","1.0.0":"2026-08-11T06:59:12.470Z","1.0.1":"2026-08-11T07:09:52.132Z","1.1.0":"2026-08-22T16:51:49.265Z","1.2.0":"2026-08-23T13:28:20.372Z"},"bugs":{"url":"https://github.com/getaidex/aidex/issues"},"author":"Sudheer Babu <isudheerbabu.dev@gmail.com>","license":"MIT","homepage":"https://github.com/getaidex/aidex/tree/main/packages/mcp#readme","keywords":["ai","mcp","model-context-protocol","server","transport"],"repository":{"type":"git","url":"git+https://github.com/getaidex/aidex.git","directory":"packages/mcp"},"description":"Aidex MCP — a reusable Model Context Protocol server foundation: transport, and Tool/Resource/Prompt registries. No engine execution, no providers, no workflows.","maintainers":[{"name":"sudheerbabu","email":"isudheerbabu.dev@gmail.com"}],"readme":"# @aidex/mcp\n\n## Installation\n\n```sh\npnpm add @aidex/mcp\n```\n\n```sh\nnpm install @aidex/mcp\n```\n\nA reusable **Model Context Protocol (MCP) server** — a real JSON-RPC 2.0\nmessage handler over Tool/Resource/Prompt registries, plus one transport.\nNot tied to Aidex Engines, Providers, Workflows, or any external MCP SDK.\n\n## What this is\n\nMCP is a protocol for exposing capabilities — tools a client can call,\nresources it can read, prompts it can request — to an AI client (an IDE,\nan agent host, a chat client) over a transport. `@aidex/mcp` is a working\nMCP server foundation: three registries (one per registerable category),\na transport contract with one concrete implementation (`StdioTransport`),\nand — as of Phase 2 — `MCPProtocolHandler`, which turns inbound JSON-RPC\n2.0 payloads into responses by dispatching to those registries. It does\nnot itself decide what any tool/resource/prompt *does* — that's always\nthe registered object's own `execute`/`read`/`get`.\n\n## What this is not\n\n- **Not engine execution.** Nothing here calls `@aidex/engines`'\n  `EngineRegistry`, and no `Engine` is registered as a tool. A future\n  package can adapt an `Engine` into an `MCPTool` without this package\n  changing — that's the whole point of `MCPTool` being a plain interface.\n- **Not a Provider caller.** No AI calls, no vendor SDK, nothing\n  network-facing beyond the transport's own I/O.\n- **Not a Workflow runner.** `@aidex/workflow` is not a dependency.\n- **Not a WebSocket/HTTP server.** `StdioTransport` remains the one\n  concrete transport; `MCPTransport` stays the abstraction a future one\n  would implement.\n- **No external MCP library.** Every type and every JSON-RPC handler in\n  this package is hand-written to this platform's own conventions, not\n  imported from an MCP SDK.\n- **Not Aidex's own SDK.** `@aidex/sdk`'s `AIBuilder` is unrelated; this\n  package doesn't depend on it and isn't a dependency of it (yet).\n\n## Public API\n\n```ts\nclass MCPServer {\n  readonly tools: MCPToolRegistry;\n  readonly resources: MCPResourceRegistry;\n  readonly prompts: MCPPromptRegistry;\n\n  constructor(config: MCPServerConfig);\n  getMetadata(): MCPServerMetadata;\n  isStarted(): boolean;\n  start(): Promise<void>;\n  stop(): Promise<void>;\n}\n\nclass MCPProtocolHandler {\n  constructor(deps: MCPProtocolHandlerDeps);\n  handleMessage(payload: unknown): Promise<JsonRpcResponse | JsonRpcResponse[] | undefined>;\n}\n\nclass MCPToolRegistry {\n  register(tool: MCPTool): void;\n  unregister(name: string): boolean;\n  has(name: string): boolean;\n  get(name: string): MCPTool | undefined;\n  list(): MCPTool[];\n  call<TInput = unknown>(name: string, input: TInput): Promise<MCPToolResult>;\n}\n\nclass MCPResourceRegistry {\n  register(resource: MCPResource): void;\n  unregister(uri: string): boolean;\n  has(uri: string): boolean;\n  get(uri: string): MCPResource | undefined;\n  list(): MCPResource[];\n  read(uri: string): Promise<MCPResourceContent>;\n}\n\nclass MCPPromptRegistry {\n  register(prompt: MCPPrompt): void;\n  unregister(name: string): boolean;\n  has(name: string): boolean;\n  get(name: string): MCPPrompt | undefined;\n  list(): MCPPrompt[];\n  getMessages(name: string, args?: Record<string, string>): Promise<readonly MCPPromptMessage[]>;\n}\n\nclass StdioTransport implements MCPTransport {\n  readonly name: 'stdio';\n  constructor(config?: StdioTransportConfig);\n  start(onMessage: (message: unknown) => void | Promise<void>, onError?: (error: Error) => void): void;\n  send(message: unknown): void;\n  close(): void;\n}\n```\n\n## JSON-RPC 2.0 message handling (Phase 2)\n\n`MCPServer` wires every inbound transport payload through one\n`MCPProtocolHandler`, and sends back whatever it returns (skipping\n`send()` entirely when the result is `undefined`):\n\n```ts\nawait this.config.transport.start(\n  async (message) => {\n    const response = await this.handler.handleMessage(message);\n    if (response !== undefined) await this.config.transport.send(response);\n  },\n  async (error) => {\n    this.config.logger?.error('MCP transport error', error);\n    await this.config.transport.send(buildParseErrorResponse(error.message));\n  }\n);\n```\n\n`MCPProtocolHandler.handleMessage()` supports everything JSON-RPC 2.0\nrequires:\n\n- **Single requests and notifications.** A message with an `id` property\n  gets a response; a message with no `id` property (a notification) never\n  does, even if the method throws — the server just never replies.\n- **Batches.** An array of messages is processed in order; the response\n  is an array containing only the non-notification results, or\n  `undefined` if the batch was all notifications. An **empty** batch\n  array is itself invalid — per the JSON-RPC 2.0 spec's own example, that\n  returns one Invalid Request error object, not an empty or one-element\n  array.\n- **Id correlation.** Every response's `id` is exactly the request's own\n  `id` (`string | number | null`) — `null` is a valid, real id (a request\n  that explicitly used it), distinct from a notification's *absent* `id`.\n- **The 7 standard methods:** `initialize`, `tools/list`, `tools/call`,\n  `resources/list`, `resources/read`, `prompts/list`, `prompts/get`.\n\nEvery handler delegates to exactly one registry method and reshapes its\nresult into the wire format — it never contains capability logic itself:\n\n| Method | Delegates to | Wire result |\n| --- | --- | --- |\n| `initialize` | `getMetadata()` | `{ protocolVersion, capabilities, serverInfo }` |\n| `tools/list` | `tools.list()` | `{ tools: [{name, description?, inputSchema?}] }` |\n| `tools/call` | `tools.call(name, arguments)` | the tool's own `MCPToolResult` |\n| `resources/list` | `resources.list()` | `{ resources: [{uri, name, description?, mimeType?}] }` |\n| `resources/read` | `resources.read(uri)` | `{ contents: [resourceContent] }` |\n| `prompts/list` | `prompts.list()` | `{ prompts: [{name, description?, arguments?}] }` |\n| `prompts/get` | `prompts.getMessages(name, args)` + `prompts.get(name)` | `{ description?, messages }` |\n\n## JSON-RPC errors\n\nFive standard, reserved error codes — no application-defined codes:\n\n| Code | Name | When |\n| --- | --- | --- |\n| `-32700` | Parse error | The transport failed to parse a payload as JSON at all (`id` is always `null`) |\n| `-32600` | Invalid Request | Not a JSON object; wrong/missing `jsonrpc`; missing/non-string `method`; empty batch |\n| `-32601` | Method not found | A syntactically valid `method` that isn't one of the 7 supported |\n| `-32602` | Invalid params | Missing/wrong-typed required params, or a `name`/`uri` that isn't registered (`MCPToolNotFoundError`/`MCPResourceNotFoundError`/`MCPPromptNotFoundError`, caught and re-mapped) |\n| `-32603` | Internal error | Anything else a handler or a registered tool/resource/prompt throws |\n\n**No stack trace ever reaches a response.** A deliberate\n`JsonRpcProtocolError` carries its own `code`/`message`/`data`, used\nas-is; anything else — a real bug, a tool implementation throwing — is\nreported as the fixed, generic message `\"Internal error\"`, never the\noriginal error's own message or `.stack`.\n\n## The three contracts\n\nEach is a plain interface — nothing this package ships implements one.\nAn application (or a future adapter package) provides real\nimplementations and registers them.\n\n```ts\ninterface MCPTool<TInput = unknown> {\n  name: string;\n  description?: string;\n  inputSchema?: Record<string, unknown>;\n  execute(input: TInput): Promise<MCPToolResult>;\n}\n\ninterface MCPResource {\n  uri: string;\n  name: string;\n  description?: string;\n  mimeType?: string;\n  read(): Promise<MCPResourceContent>;\n}\n\ninterface MCPPrompt {\n  name: string;\n  description?: string;\n  arguments?: readonly MCPPromptArgument[];\n  get(args?: Record<string, string>): Promise<readonly MCPPromptMessage[]>;\n}\n```\n\n`MCPPrompt` is deliberately named to avoid colliding with `@aidex/prompts`'\n`PromptTemplate`: that package's prompts are this platform's own internal\nLLM-prompt templating, rendered server-side before a Provider call.\n`MCPPrompt` is a *protocol-level* prompt a client requests directly —\nsame word, different layer, no relationship between the two.\n\n## Example usage\n\n```ts\nimport { MCPServer, StdioTransport } from '@aidex/mcp';\n\nconst server = new MCPServer({\n  name: 'my-aidex-mcp-server',\n  version: '0.1.0',\n  transport: new StdioTransport(),\n});\n\nserver.tools.register({\n  name: 'echo',\n  description: 'Echoes the input back',\n  async execute(input: { text: string }) {\n    return { content: [{ type: 'text', text: input.text }] };\n  },\n});\n\nawait server.start();\n// A client sending {\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"echo\",\"arguments\":{\"text\":\"hi\"}}}\n// over stdio now gets back {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"hi\"}]}}.\n\nawait server.stop();\n```\n\n## Dependencies\n\n`@aidex/core` only — for `DuplicateRegistrationError` (reused rather than\ninventing a bespoke duplicate error, the same class every other registry\nin this platform throws) and `ILogger` (the optional `MCPServerConfig.logger`\nfield). Nothing else: no `@aidex/engines`, no `@aidex/providers`, no\n`@aidex/workflow`, no `@aidex/prompts`, no `@aidex/sdk`, no external MCP SDK.\n\n## Design decisions\n\n**Three registries, not one.** Tools, resources, and prompts are\ndistinct MCP capability categories with different keys (`name` for tools\nand prompts, `uri` for resources) and different dispatch semantics\n(`call`/`read`/`getMessages`) — one generic registry would have to erase\nthose differences. Each mirrors `@aidex/engines`' `EngineRegistry` shape\nexactly: `register`/`unregister`/`has`/`get`/`list`, plus one\ncategory-specific dispatch method.\n\n**Protocol logic lives in `MCPProtocolHandler`, not in `MCPServer` or the\nregistries.** `MCPServer` only wires transport in/out to the handler; the\nregistries only register/dispatch by key. Envelope validation, batch/\nnotification semantics, method routing, and JSON-RPC error-code mapping\nare `MCPProtocolHandler`'s job exclusively — \"do not expose protocol\nlogic inside the registries; registries remain transport-agnostic\" holds\nexactly as it did in Phase 1, now with a real dispatcher sitting between\nthe transport and the registries instead of a stub.\n\n**`buildServerMetadata()` is the one source of truth for `initialize`.**\n`MCPProtocolHandler`'s `initialize` handler never hardcodes `name`,\n`version`, `protocolVersion`, or `capabilities` — it reads all four from\n`getMetadata()` (backed by `buildServerMetadata()`), the same values\n`MCPServer.getMetadata()` returns directly. `MCP_PROTOCOL_VERSION` is\ndefined in exactly one file and imported everywhere it's needed.\n\n**A `JsonRpcProtocolError` boundary, not ad hoc error objects.** Every\nmethod handler throws this one error type (or lets an unexpected error\npropagate) rather than building a JSON-RPC error object inline — the\ndispatcher's single `errorResponseFrom()` is the only place a `code`/\n`message`/`data` ever becomes part of a response, which is also the only\nplace that has to remember \"never read `.stack`.\"\n\n**`MCPToolNotFoundError`/`MCPResourceNotFoundError`/`MCPPromptNotFoundError`\nmap to Invalid params, not Internal error.** The request was well-formed;\na `name`/`uri` value just didn't correspond to anything registered — the\nsame category as any other invalid parameter value, not a server bug.\n\n**`StdioTransport` takes injectable streams, not just `process.stdin`/\n`process.stdout`.** The same \"accept a config object, default the real\nthing\" shape every Provider/Engine config in this platform uses — makes\nit testable with a `PassThrough` pair instead of the real process streams.\n\n**`onMessage`/`send` are typed `unknown`, not a fixed object shape.** A\nJSON-RPC payload may be a single object *or* a batch array; the transport\nlayer has no opinion on which. Interpreting the shape is\n`MCPProtocolHandler`'s job.\n\n**No external MCP SDK.** Every type and handler here is hand-written to\nexactly the shape this phase needs, not imported from\n`@modelcontextprotocol/sdk` or similar — consistent with every other\npackage in this platform staying free of vendor lock-in at the type\nlevel.\n","readmeFilename":""}