@absolutejs/mcp 0.17.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ This file is generated by `absolute-changelog` from the entries in
6
6
  `changelog/`. Edit an entry, not this file — and add new ones under
7
7
  `changelog/unreleased/`.
8
8
 
9
+ ## 0.17.3 — 2026-09-11
10
+
11
+ ### Fixed
12
+
13
+ - **Authorize session deletion, recover explicit client initialization after expiry, and preserve typed HTTP failures without replaying tools**
14
+ - **Accept the standard protocol-header compatibility fallback used by VS Code Copilot and record native report rendering evidence**
15
+
9
16
  ## 0.17.2 — 2026-09-11
10
17
 
11
18
  ### Added
@@ -0,0 +1,28 @@
1
+ {
2
+ "date": "2026-09-11",
3
+ "runtimePackage": "@absolutejs/mcp@0.17.3 pre-release build",
4
+ "host": "Visual Studio Code 1.135.0, native Windows Copilot Chat",
5
+ "transport": "Streamable HTTP, isolated loopback synthetic workspace",
6
+ "protocol": "2025-11-25",
7
+ "protocolHeader": null,
8
+ "appsMimeType": "text/html;profile=mcp-app",
9
+ "successfulCalls": {
10
+ "get_billing_status": 2,
11
+ "get_usage_report": 2,
12
+ "list_receipts": 2
13
+ },
14
+ "observed": [
15
+ "All three native report views rendered after window reload",
16
+ "Balance and usage refresh succeeded",
17
+ "Daily usage expanded",
18
+ "Receipt pagination reached empty final page and hid Older receipts",
19
+ "Initial render and window reload made no extra report calls",
20
+ "All three app documents measured 242px with no horizontal document overflow"
21
+ ],
22
+ "limitations": [
23
+ "Initial balance webview was blank; window reload restored it; cause not isolated",
24
+ "Window reload restores original tool results, including first receipt page",
25
+ "OAuth, real-account isolation and expired-session reconnect against authenticated staging not tested",
26
+ "Host commerce permissions not certified"
27
+ ]
28
+ }
package/canary/server.ts CHANGED
@@ -49,7 +49,6 @@ const handler = createMcpHandler({
49
49
  issuer: "http://127.0.0.1:4428",
50
50
  path: "/mcp",
51
51
  serverInfo: { name: "absolute-billing-canary", version: "1" },
52
- supportedProtocols: ["2025-06-18"],
53
52
  authorize: async () => ({
54
53
  ok: true,
55
54
  caller: "synthetic-fixture",
@@ -110,6 +109,7 @@ Bun.serve({
110
109
  JSON.stringify({
111
110
  method: rpc?.method ?? request.method,
112
111
  status: response.status,
112
+ protocolHeader: request.headers.get("mcp-protocol-version"),
113
113
  ...(rpc?.method === "initialize"
114
114
  ? {
115
115
  client: rpc.params?.clientInfo?.name,
package/changelog.json CHANGED
@@ -2,6 +2,20 @@
2
2
  "contract": 1,
3
3
  "name": "@absolutejs/mcp",
4
4
  "releases": [
5
+ {
6
+ "version": "0.17.3",
7
+ "date": "2026-09-11",
8
+ "changes": [
9
+ {
10
+ "kind": "fixed",
11
+ "summary": "Authorize session deletion, recover explicit client initialization after expiry, and preserve typed HTTP failures without replaying tools"
12
+ },
13
+ {
14
+ "kind": "fixed",
15
+ "summary": "Accept the standard protocol-header compatibility fallback used by VS Code Copilot and record native report rendering evidence"
16
+ }
17
+ ]
18
+ },
5
19
  {
6
20
  "version": "0.17.2",
7
21
  "date": "2026-09-11",
package/dist/index.js CHANGED
@@ -735,14 +735,25 @@ var createMcpClient = (options) => {
735
735
  });
736
736
  }
737
737
  }
738
- const captured = response.headers.get("mcp-session-id");
739
- if (captured)
740
- sessionId = captured;
741
738
  if (response.status === 401) {
742
739
  throw new McpClientError("The MCP server rejected the credentials", {
743
740
  status: 401
744
741
  });
745
742
  }
743
+ if (!response.ok) {
744
+ if (response.status === 404 && sessionId === headers["mcp-session-id"]) {
745
+ sessionId = null;
746
+ }
747
+ const failure = await parseBody(response, maxBytes).catch(() => null);
748
+ const error = isRecord(failure) && isRecord(failure.error) ? failure.error : null;
749
+ throw new McpClientError(typeof error?.message === "string" ? error.message : `MCP HTTP request failed (${response.status})`, {
750
+ status: response.status,
751
+ code: typeof error?.code === "number" ? error.code : undefined
752
+ });
753
+ }
754
+ const captured = response.headers.get("mcp-session-id");
755
+ if (captured)
756
+ sessionId = captured;
746
757
  const isStream = (response.headers.get("content-type") ?? "").includes("text/event-stream");
747
758
  const payload = isStream ? await consumeSseStream(response, maxBytes, answerServer) : await parseBody(response, maxBytes);
748
759
  if (!isRecord(payload)) {
@@ -776,6 +787,7 @@ var createMcpClient = (options) => {
776
787
  });
777
788
  };
778
789
  const initialize = async () => {
790
+ sessionId = null;
779
791
  const result2 = await rpc("initialize", {
780
792
  capabilities: {
781
793
  ...options.onElicit ? { elicitation: { form: {}, url: {} } } : {},
@@ -2197,15 +2209,15 @@ var runMcpPost = async (config, request, body) => {
2197
2209
  return rpcError(null, JSONRPC_INVALID_REQUEST, "Batching is not supported");
2198
2210
  }
2199
2211
  const isInitialize = typeof body === "object" && body !== null && "method" in body && body.method === "initialize";
2200
- const protocolVersion = request.headers.get("mcp-protocol-version");
2212
+ const protocolVersion = request.headers.get("mcp-protocol-version") ?? "2025-03-26";
2201
2213
  const supportedProtocols = config.supportedProtocols ?? [
2202
2214
  MCP_LATEST_PROTOCOL_VERSION,
2203
2215
  "2025-06-18",
2204
2216
  "2025-03-26",
2205
2217
  "2024-11-05"
2206
2218
  ];
2207
- if (!isInitialize && (protocolVersion === null || !supportedProtocols.includes(protocolVersion))) {
2208
- return new Response("Missing or unsupported MCP-Protocol-Version", {
2219
+ if (!isInitialize && !supportedProtocols.includes(protocolVersion)) {
2220
+ return new Response("Unsupported MCP-Protocol-Version", {
2209
2221
  status: 400
2210
2222
  });
2211
2223
  }
@@ -2215,13 +2227,17 @@ var runMcpPost = async (config, request, body) => {
2215
2227
  return new Response(null, { status: HTTP_NOT_FOUND });
2216
2228
  }
2217
2229
  return dispatchMcp(config, auth.caller, auth.scopes ?? [], body, {
2218
- protocolVersion: protocolVersion ?? MCP_LATEST_PROTOCOL_VERSION,
2230
+ protocolVersion,
2219
2231
  requestSignal: request.signal,
2220
2232
  sessionId,
2221
2233
  sessions
2222
2234
  }).catch(() => rpcError(null, JSONRPC_INVALID_REQUEST, "Internal error"));
2223
2235
  };
2224
2236
  var runMcpDelete = async (config, request) => {
2237
+ const auth = await config.authorize(request);
2238
+ if (!auth.ok) {
2239
+ return unauthorized(`${config.issuer}${metadataPathFor(config.path)}`, auth.reason);
2240
+ }
2225
2241
  const sessions = registryFor(config);
2226
2242
  const sessionId = request.headers.get("mcp-session-id");
2227
2243
  if (!sessions || !sessionId) {
@@ -4,7 +4,7 @@ The package ships `canary/server.ts`: a loopback-only, synthetic billing endpoin
4
4
 
5
5
  From an installed package, run `bun node_modules/@absolutejs/mcp/canary/server.ts`. From this repository, build first, then `bun run canary`. The fixed endpoint is `http://127.0.0.1:4428/mcp`. Startup validates all four report calls before listening. Stop it with Ctrl-C after the test. A port conflict fails startup rather than replacing another service.
6
6
 
7
- The JSONL log records protocol methods, status, client name/version, negotiated protocol, advertised Apps MIME types and tool success. It omits headers, session IDs, tool arguments and report bodies. Keep host transcripts local: host logs can contain unrelated account or environment information. Commit only reviewed evidence.
7
+ The JSONL log records protocol methods, status, client name/version, negotiated protocol, advertised Apps MIME types and tool success. It records only the MCP protocol-version header and omits all other headers, session IDs, tool arguments and report bodies. Keep host transcripts local: host logs can contain unrelated account or environment information. Commit only reviewed evidence.
8
8
 
9
9
  ## Host connections
10
10
 
@@ -49,7 +49,7 @@ Terminal tests ran against the built `0.17.0` runtime. The later Claude web test
49
49
  | Claude Code 2.1.265, print mode, Streamable HTTP | Requested 2025-11-25; accepted server 2025-06-18; no Apps MIME extension | Four read calls passed, including cursor pagination; text/structured fallback; no embedded rendering claim |
50
50
  | Codex CLI 0.154.0, exec mode, Streamable HTTP | Requested and accepted 2025-06-18; no Apps MIME extension | Four read calls passed, including cursor pagination; text/structured fallback; no embedded rendering claim |
51
51
  | Claude web, Windows Chrome 152.0.7977.83 | Apps MIME advertised; accepted 2025-06-18 | Three native views, refresh and pagination passed |
52
- | VS Code 1.135.0 | Installed version confirmed | Interactive Copilot/MCP Apps UI not exercised |
52
+ | VS Code 1.135.0 | Apps MIME advertised; negotiated 2025-11-25; omitted protocol header | Three views, refresh and pagination verified after compatibility fix; initial balance required reload |
53
53
  | Cursor, Gemini CLI, goose | Executables unavailable in this environment | Not tested |
54
54
  | ChatGPT hosted surfaces | No host canary performed | Not tested |
55
55
 
@@ -67,4 +67,12 @@ A temporary public tunnel allowed discovery but failed tool execution before rea
67
67
 
68
68
  For Windows/WSL testing, a headed Linux browser may not appear on the Windows desktop. Use a native Windows test browser with a separate persistent profile and loopback CDP endpoint. Reuse one Playwright CDP connection. If existing cross-origin frames are missing from automation, reload with that connection established; Claude uses a wrapper frame and a nested `about:blank` app frame. Never commit browser profiles or credentials.
69
69
 
70
- Conversational rendering is verified for this exact surface. VS Code/Cursor interactive rendering and authenticated staging reconnect/account-isolation remain separate open gates.
70
+ Conversational rendering is verified for this exact surface. Cursor interactive rendering and authenticated staging reconnect/account-isolation remain separate open gates.
71
+
72
+ ## VS Code Copilot and session compatibility (0.17.3)
73
+
74
+ Native Windows VS Code 1.135.0 advertised Apps MIME support but omitted MCP-Protocol-Version on subsequent requests. The shared handler now applies the specified 2025-03-26 fallback for an absent header; explicitly unsupported values still return 400. The fixture now uses default supported protocols instead of forcing a downgrade. See the [MCP transport specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header).
75
+
76
+ Three report views rendered in the signed-in isolated Copilot workspace. Balance and usage refresh, daily expansion and receipt pagination passed. There were six report calls: three initial calls and three explicit button actions. Reloading restored the original report results with no extra report calls. All app documents measured 242px without horizontal document overflow. The first balance webview was blank until a window reload; its cause is not isolated, so this is a qualified rendering result, not proof of reliable first-load behavior. Reviewed aggregate evidence: `canary/results/2026-09-11-vscode.json`.
77
+
78
+ Package regressions verify authorization before session deletion, per-request account selection, expired-session HTTP 404, and fresh explicit client initialization. HTTP failures now produce McpClientError with status (and a JSON-RPC code when available), including empty/non-JSON responses. After a session 404, call client.initialize() to negotiate a fresh session before further operations. The failed tool is never automatically replayed; callers must decide whether retrying is appropriate. Synthetic credentials prove handler behavior, not OAuth correctness or real-tenant isolation. Authenticated staging remains a separate release gate.
package/package.json CHANGED
@@ -86,5 +86,5 @@
86
86
  "check:canary": "tsc --noEmit --strict --skipLibCheck --moduleResolution bundler --module esnext --target esnext --types bun canary/server.ts"
87
87
  },
88
88
  "types": "./dist/src/index.d.ts",
89
- "version": "0.17.2"
89
+ "version": "0.17.3"
90
90
  }