WIP: Attempting to proxy streamable-http connections. Inspector still works fine with STDIO and SSE servers.

* In index.ts,
  - refactor transport webAppTransports to be a map with the session id as key and transport as value.

* Implement /mcp GET and POST endpoints using StreamableHTTPServerTransport and doing the new session in the POST (opposite from SSE) handler.

* In package.json
  - update the SDK to 1.10.2

* In useConnection.ts
  - import StreamableHTTPClientTransport
    - NOTE: while we NEED to do this, it causes useConnection.test.ts to fail with " ReferenceError: TransformStream is not defined"
  - in connect method
    - instantiate the appropriate transport
This commit is contained in:
cliffhall
2025-04-22 18:25:47 -04:00
parent 3a2e248527
commit 6e4dcd6120
4 changed files with 107 additions and 74 deletions

14
package-lock.json generated
View File

@@ -17,7 +17,7 @@
"@modelcontextprotocol/inspector-cli": "^0.10.2",
"@modelcontextprotocol/inspector-client": "^0.10.2",
"@modelcontextprotocol/inspector-server": "^0.10.2",
"@modelcontextprotocol/sdk": "^1.10.0",
"@modelcontextprotocol/sdk": "^1.10.2",
"concurrently": "^9.0.1",
"shell-quote": "^1.8.2",
"spawn-rx": "^5.1.2",
@@ -37,7 +37,7 @@
},
"cli": {
"name": "@modelcontextprotocol/inspector-cli",
"version": "0.10.1",
"version": "0.10.2",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.10.0",
@@ -58,7 +58,7 @@
},
"client": {
"name": "@modelcontextprotocol/inspector-client",
"version": "0.10.1",
"version": "0.10.2",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.10.0",
@@ -1399,9 +1399,9 @@
"link": true
},
"node_modules/@modelcontextprotocol/sdk": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.10.0.tgz",
"integrity": "sha512-wijOavYZfSOADbVM0LA7mrQ17N4IKNdFcfezknCCsZ1Y1KstVWlkDZ5ebcxuQJmqTTxsNjBHLc7it1SV0TBiPg==",
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.10.2.tgz",
"integrity": "sha512-rb6AMp2DR4SN+kc6L1ta2NCpApyA9WYNx3CrTSZvGxq9wH71bRur+zRqPfg0vQ9mjywR7qZdX2RGHOPq3ss+tA==",
"license": "MIT",
"dependencies": {
"content-type": "^1.0.5",
@@ -8550,7 +8550,7 @@
},
"server": {
"name": "@modelcontextprotocol/inspector-server",
"version": "0.10.1",
"version": "0.10.2",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.10.0",