@acid-cat/mcp-handshake 0.17.0 → 0.19.0

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @acid-cat/mcp-handshake
2
2
 
3
- `@acid-cat/mcp-handshake` lets an MCP server that speaks only revision `2026-07-28` also serve clients that open with the [`initialize` handshake of earlier revisions](../../spec/bindings/mcp.md#earlier-revisions-through-http) (`2025-11-25` and `2025-06-18`). Many MCP clients still use that handshake.
3
+ `@acid-cat/mcp-handshake` lets an MCP server that speaks only revision `2026-07-28` also serve clients that open with the [`initialize` handshake of earlier revisions](../../spec/surfaces/mcp.md#earlier-revisions-through-http) (`2025-11-25` and `2025-06-18`). Many MCP clients still use that handshake.
4
4
 
5
- `mcpHandshake(handler)` wraps a web handler of the [MCP binding through HTTP](../../spec/bindings/mcp.md#http) and returns a new web handler. The wrapper keeps no state. It works in front of any web handler that serves revision `2026-07-28`.
5
+ `mcpHandshake(handler)` wraps a web handler of the [MCP surface through HTTP](../../spec/surfaces/mcp.md#http) and returns a new web handler. The wrapper keeps no state. It works in front of any web handler that serves revision `2026-07-28`.
6
6
 
7
7
  The package is part of the TypeScript reference implementation. You usually get it through a core: [`@acid-cat/core-ts`](../core-ts) re-exports it as `mcpHandshake`, and [`@acid-cat/core-effect`](../core-effect) as `Mcp.withHandshake`.
8
8
 
@@ -36,9 +36,9 @@ const mcp = Mcp.withHandshake(Mcp.toWebHandler(app, layer, options));
36
36
 
37
37
  - A request of revision `2026-07-28`, and any other request that is not `POST`, goes to the handler unchanged.
38
38
  - The wrapper turns each handshake request into a revision `2026-07-28` request for the handler: `tools/list` and `tools/call` pass as they are, and every other method becomes `server/discover`. The handler therefore still screens each request's origin, media type and size.
39
- - Each request gets the [headers](../../spec/bindings/mcp.md#headers) that the handler checks: `Mcp-Method`, and for `tools/call` `Mcp-Name` and one `Mcp-Param-*` header for each argument whose property has `x-mcp-header`. To find these properties, the wrapper first asks the handler for `tools/list`, because it keeps no state.
39
+ - Each request gets the [headers](../../spec/surfaces/mcp.md#headers) that the handler checks: `Mcp-Method`, and for `tools/call` `Mcp-Name` and one `Mcp-Param-*` header for each argument whose property has `x-mcp-header`. To find these properties, the wrapper first asks the handler for `tools/list`, because it keeps no state.
40
40
  - A response that is not 2xx comes back unchanged.
41
- - A `GET` request of the [Server Card](../../spec/bindings/mcp.md#server-card) (`<MCP URL>/server-card`) goes to the handler. The wrapper adds `2025-11-25` and `2025-06-18` to the `supportedProtocolVersions` of each remote of the card, gives the card a new `ETag`, and answers `If-None-Match` itself.
41
+ - A `GET` request of the [Server Card](../../spec/surfaces/mcp.md#server-card) (`<MCP URL>/server-card`) goes to the handler. The wrapper adds `2025-11-25` and `2025-06-18` to the `supportedProtocolVersions` of each remote of the card, gives the card a new `ETag`, and answers `If-None-Match` itself.
42
42
  - `initialize` returns the result of `server/discover` in the handshake's shape. `ping` returns an empty result. A notification gets 202. Any other method gets the JSON-RPC error `-32601`.
43
43
  - Results carry no `_meta`, `resultType`, `ttlMs` or `cacheScope` member. A JSON-RPC error has HTTP status 200.
44
44
 
package/dist/index.d.ts CHANGED
@@ -6,6 +6,6 @@ export interface McpHandshakeOptions {
6
6
  /**
7
7
  * A web handler that serves the `initialize` handshake of revisions 2025-11-25 and 2025-06-18, and gives all other
8
8
  * requests to `handler`. It adds these revisions to the `supportedProtocolVersions` of the Server Card of `handler`
9
- * (spec/bindings/mcp.md#server-card).
9
+ * (spec/surfaces/mcp.md#server-card).
10
10
  */
11
11
  export declare function mcpHandshake(handler: WebHandler, options?: McpHandshakeOptions): WebHandler;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MCP_EVENTS_EXTENSION, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_KEY, MCP_SERVER_CARD_MEDIA_TYPE, isJsonObject, mcpDiscovered, mcpParamHeaders, mcpServerCardResponse, mcpServerUrlOfCardRequest, mcpWrappedRequest, readBounded } from "@acid-cat/spec-ts";
2
2
  // src/index.ts
3
- /** The `initialize` handshake of earlier MCP revisions through HTTP (spec/bindings/mcp.md#earlier-revisions-through-http). */
3
+ /** The `initialize` handshake of earlier MCP revisions through HTTP (spec/surfaces/mcp.md#earlier-revisions-through-http). */
4
4
  const HANDSHAKE_VERSIONS = ["2025-11-25", "2025-06-18"];
5
5
  const [LATEST_HANDSHAKE_VERSION] = HANDSHAKE_VERSIONS;
6
6
  const CURRENT_ONLY_MEMBERS = /* @__PURE__ */ new Set([
@@ -12,7 +12,7 @@ const CURRENT_ONLY_MEMBERS = /* @__PURE__ */ new Set([
12
12
  /**
13
13
  * A web handler that serves the `initialize` handshake of revisions 2025-11-25 and 2025-06-18, and gives all other
14
14
  * requests to `handler`. It adds these revisions to the `supportedProtocolVersions` of the Server Card of `handler`
15
- * (spec/bindings/mcp.md#server-card).
15
+ * (spec/surfaces/mcp.md#server-card).
16
16
  */
17
17
  function mcpHandshake(handler, options = {}) {
18
18
  const maximumBytes = options.maximumBytes ?? 1048576;
@@ -120,7 +120,7 @@ function asCurrentRevisionRequest(request, method, params, paramHeaders = {}) {
120
120
  /**
121
121
  * The result of `initialize`, from the result of `server/discover`. The wrapper keeps no session, so it cannot send
122
122
  * `notifications/tools/list_changed`. The events extension is only for revision 2026-07-28, so the capabilities do not
123
- * have it (spec/bindings/mcp.md#events).
123
+ * have it (spec/surfaces/mcp.md#events).
124
124
  */
125
125
  function initializeResult(offered, discovered) {
126
126
  const { name = "", version = "", instructions, capabilities = {} } = mcpDiscovered(discovered);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acid-cat/mcp-handshake",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Serve MCP clients of the revisions with an initialize handshake from an AcidCat MCP server through HTTP, with no state. Part of the TypeScript reference implementation.",
5
5
  "keywords": [
6
6
  "acidcat",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@acid-cat/spec-ts": "0.17.0"
34
+ "@acid-cat/spec-ts": "0.19.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "26.6.6",