@modelcontextprotocol/server-everything 2.1.0 → 2.2.1

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.
Files changed (39) hide show
  1. package/README.md +30 -0
  2. package/dist/docs/features.md +7 -2
  3. package/dist/docs/structure.md +6 -0
  4. package/dist/prompts/args.js +2 -0
  5. package/dist/prompts/completions.js +2 -0
  6. package/dist/prompts/resource.js +2 -0
  7. package/dist/prompts/simple.js +2 -0
  8. package/dist/resources/collections.js +108 -0
  9. package/dist/resources/files.js +7 -1
  10. package/dist/resources/index.js +2 -0
  11. package/dist/resources/minted.js +4 -0
  12. package/dist/resources/templates.js +12 -2
  13. package/dist/server/icons.js +51 -0
  14. package/dist/server/index.js +2 -0
  15. package/dist/tools/echo.js +2 -0
  16. package/dist/tools/get-annotated-message.js +2 -0
  17. package/dist/tools/get-env.js +2 -0
  18. package/dist/tools/get-header-params.js +2 -0
  19. package/dist/tools/get-resource-links.js +2 -0
  20. package/dist/tools/get-resource-reference.js +2 -0
  21. package/dist/tools/get-roots-list.js +2 -0
  22. package/dist/tools/get-structured-content.js +2 -0
  23. package/dist/tools/get-sum.js +2 -0
  24. package/dist/tools/get-tiny-image.js +2 -0
  25. package/dist/tools/gzip-file-as-resource.js +5 -1
  26. package/dist/tools/simulate-research-query.js +2 -0
  27. package/dist/tools/toggle-simulated-logging.js +2 -0
  28. package/dist/tools/toggle-subscriber-updates.js +2 -0
  29. package/dist/tools/trigger-elicitation-request-async.js +2 -0
  30. package/dist/tools/trigger-elicitation-request.js +2 -0
  31. package/dist/tools/trigger-list-changed.js +2 -0
  32. package/dist/tools/trigger-log-messages.js +2 -0
  33. package/dist/tools/trigger-long-running-operation.js +25 -1
  34. package/dist/tools/trigger-multi-step-elicitation.js +2 -0
  35. package/dist/tools/trigger-resource-update.js +2 -0
  36. package/dist/tools/trigger-sampling-request-async.js +2 -0
  37. package/dist/tools/trigger-sampling-request.js +2 -0
  38. package/dist/tools/trigger-url-elicitation.js +2 -0
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -13,6 +13,10 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
13
13
 
14
14
  A complete list of the registered MCP primitives and other protocol features demonstrated can be found in the [Server Features](docs/features.md) document.
15
15
 
16
+ The resource collections (`demo://resource/collection/summer-specials`, and the `by-category/{category}` and `item/{itemId}` templates beside it) show a single `resources/read` returning several contents, each under its own URI: reading a collection returns one content per item, and each item's URI can be read on its own.
17
+
18
+ The server info and every tool, prompt, resource and resource template carry a pair of [icons](docs/features.md#icons), one for a light theme and one for a dark theme, so a client can show the variant that suits its own background.
19
+
16
20
  The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment, such as `OPENAI_API_KEY`) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
17
21
 
18
22
  ## Protocol versions
@@ -167,6 +171,32 @@ npx @modelcontextprotocol/server-everything streamableHttp
167
171
  npx @modelcontextprotocol/server-everything sse
168
172
  ```
169
173
 
174
+ ## Running with Docker
175
+
176
+ This repository publishes no image; build one from the repository root (the build context):
177
+
178
+ ```shell
179
+ docker build -f src/everything/Dockerfile -t mcp/everything .
180
+ ```
181
+
182
+ The `mcp/everything` image on Docker Hub is built by Docker, not by this repository, and can lag behind it.
183
+
184
+ ### Run over stdio (the default)
185
+
186
+ ```shell
187
+ docker run -i --rm mcp/everything
188
+ ```
189
+
190
+ `-i` keeps stdin open, which the stdio transport reads. This is the command an MCP client configuration launches.
191
+
192
+ ### Run the Streamable HTTP server
193
+
194
+ ```shell
195
+ docker run --rm -p 127.0.0.1:3001:3001 mcp/everything streamableHttp
196
+ ```
197
+
198
+ The endpoint is `http://localhost:3001/mcp`. The server listens on port 3001 on every interface inside the container; `127.0.0.1:` publishes it on the host's loopback only. To use another port, set `PORT` and publish that one (`-e PORT=8080 -p 127.0.0.1:8080:8080`). The localhost-only `Origin` check described above applies inside the container too. `docker stop` ends the server cleanly.
199
+
170
200
  ## License
171
201
 
172
202
  This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
@@ -47,7 +47,7 @@ Each feature below is marked **both**, **2026-07-28** or **2025-era**. Roots, sa
47
47
  - `trigger-elicitation-request-async` (tools/trigger-elicitation-request-async.ts), **2026-07-28**: Runs as a task whose `input_required` status carries a form elicitation; the client answers with `tasks/update` and the task completes with a summary. Needs a client that declares the tasks extension and form-mode elicitation.
48
48
  - `trigger-list-changed` (tools/trigger-list-changed.ts), **both**: Sends `notifications/<list>/list_changed` for `tools`, `prompts` or `resources`: on 2026-07-28 to each `subscriptions/listen` stream that asked for that list, on a 2025-era connection unsolicited.
49
49
  - `trigger-log-messages` (tools/trigger-log-messages.ts), **both**, deprecated: Sends one log message at each level during the call. A 2026-07-28 request gets those at or above the level its `_meta` names (none if it names none); a 2025-era client those at or above its `logging/setLevel` level.
50
- - `trigger-long-running-operation` (tools/trigger-long-running-operation.ts), **both**: Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client.
50
+ - `trigger-long-running-operation` (tools/trigger-long-running-operation.ts), **both**: Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client. Honors cancellation: a cancelled call clears its timer and sends no further progress.
51
51
  - `trigger-multi-step-elicitation` (tools/trigger-multi-step-elicitation.ts), **both**: Asks for a name, then for a favorite color addressed by that name, carrying the first answer to the second round in `requestState`. The state is HMAC-signed and expires after ten minutes; a tampered or expired one is refused with `-32602`. A blank name or a color that is not a choice is asked again. Needs form-mode elicitation.
52
52
  - `trigger-resource-update` (tools/trigger-resource-update.ts), **both**: Sends `notifications/resources/updated` for a URI: on 2026-07-28 to each listen stream whose `resourceSubscriptions` name it, on a 2025-era connection once the client has subscribed to it.
53
53
  - `trigger-sampling-request` (tools/trigger-sampling-request.ts), **both**, deprecated: Asks the client's LLM for a completion with a multi-round-trip request, using the provided `prompt` and `maxTokens`; returns the LLM's response payload. Needs client capability `sampling`.
@@ -70,8 +70,9 @@ On a 2025-era connection the tools that need a client capability are registered
70
70
  - Static Documents: `demo://resource/static/document/<filename>` (serves files from `src/everything/docs/` as static file-based resources; a 2026-07-28 read carries a one-hour public cache hint)
71
71
  - Session Scoped, **2025-era**: `demo://resource/session/<name>` (per-session resources registered dynamically; available only for the lifetime of the session)
72
72
  - Minted, **2026-07-28**: `demo://resource/minted/<id>/<name>` (resources a tool created, under a server-minted id; readable by any client that has the URI, for ten minutes; the process keeps at most 100 of them and 64 MiB of content, dropping the oldest first)
73
+ - Collections: `demo://resource/collection/summer-specials`, `demo://resource/collection/by-category/{category}` and `demo://resource/collection/item/{itemId}` (resources/collections.ts; one `resources/read` of a collection returns several contents, one per item, each under its item's own URI, which reads back on its own; `category` and `itemId` complete)
73
74
 
74
- A read of a resource that does not exist (an unknown URI, a template id that is not a positive integer, an expired minted resource) is answered with `-32602` and the URI in the error's `data`.
75
+ A read of a resource that does not exist (an unknown URI, a template id that is not a positive integer, a collection category or item that is not in the catalog, an expired minted resource) is answered with `-32602` and the URI in the error's `data`.
75
76
 
76
77
  ## Resource Subscriptions and Notifications
77
78
 
@@ -79,6 +80,10 @@ A read of a resource that does not exist (an unknown URI, a template id that is
79
80
  - **2025-era**: clients subscribe and unsubscribe to resource URIs with `resources/subscribe` and `resources/unsubscribe`. `toggle-subscriber-updates` starts or stops a per-connection interval that emits `notifications/resources/updated { uri }` for the URIs that connection subscribed to, and `trigger-resource-update` sends one on demand. List changes arrive unsolicited.
80
81
  - Each client's subscriptions belong to the server instance serving its connection, so concurrent clients are independent.
81
82
 
83
+ ## Icons
84
+
85
+ **Both.** The server demonstrates icons with light and dark themes (SEP-973). Its `serverInfo` (in `initialize` and in `server/discover`) and every entry of `tools/list`, `prompts/list`, `resources/list` and `resources/templates/list` carry an `icons` array of two scalable SVG icons, one with `theme: "light"` (drawn for a light background) and one with `theme: "dark"`. Each kind has its own glyph: a server rack, a wrench for tools, a speech bubble for prompts, a document for resources, and a document with braces for templates. The icons are inline `data:` URIs, so a client fetches nothing; they are defined in `server/icons.ts`.
86
+
82
87
  ## Logging
83
88
 
84
89
  Logging is deprecated as of 2026-07-28 (SEP-2577) and remains available on both eras.
@@ -28,6 +28,7 @@ src/everything
28
28
  │ └── resource.ts
29
29
  ├── resources
30
30
  │ ├── index.ts
31
+ │ ├── collections.ts
31
32
  │ ├── files.ts
32
33
  │ ├── minted.ts
33
34
  │ ├── session.ts
@@ -36,6 +37,7 @@ src/everything
36
37
  ├── server
37
38
  │ ├── index.ts
38
39
  │ ├── context.ts
40
+ │ ├── icons.ts
39
41
  │ ├── logging.ts
40
42
  │ ├── roots.ts
41
43
  │ └── tasks.ts
@@ -132,6 +134,8 @@ src/everything
132
134
  - Blob: `demo://resource/dynamic/blob/{index}` (MIME: `application/octet-stream`, Base64 payload)
133
135
  - The `{index}` path variable must be a finite positive integer; any other is not found (`-32602`). Content is generated on demand with a timestamp.
134
136
  - Exposes helpers `textResource(uri, index)`, `textResourceUri(index)`, `blobResource(uri, index)`, and `blobResourceUri(index)` so other modules can construct and embed dynamic resources directly (e.g., from prompts).
137
+ - `collections.ts`
138
+ - Registers a resource collection example: `summer-specials` (`demo://resource/collection/summer-specials`), whose read returns every item of a small fixed catalog as a separate content under its own URI; the `collection-by-category` template (`demo://resource/collection/by-category/{category}`), which returns one category's items; and the `collection-item` template (`demo://resource/collection/item/{itemId}`), which reads one item back. Both templates complete their variable, and a category or id not in the catalog is not found (`-32602`).
135
139
  - `files.ts`
136
140
  - Registers static file-based resources for each file in the `docs/` folder.
137
141
  - URIs follow the pattern: `demo://resource/static/document/<filename>`.
@@ -152,6 +156,8 @@ src/everything
152
156
  - Exposes `{ server, cleanup }` to the chosen transport. Cleanup stops any running intervals in the server when the connection ends.
153
157
  - `context.ts`
154
158
  - The per-instance context features receive: the era, the change publisher, the 2025-era subscriptions and a cleanup registry.
159
+ - `icons.ts`
160
+ - The light- and dark-themed icon pairs (SEP-973) attached to the server info and to every tool, prompt, resource and resource template, one pair per kind, as inline SVG `data:` URIs.
155
161
  - `logging.ts`
156
162
  - Implements simulated logging (2025 era). Periodically sends randomized log messages at various levels to the connected client. Started/stopped on demand via a dedicated tool.
157
163
  - `roots.ts`
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { PROMPT_ICONS } from "../server/icons.js";
2
3
  /**
3
4
  * Register a prompt with arguments
4
5
  * - Two arguments, one required and one optional
@@ -15,6 +16,7 @@ export const registerArgumentsPrompt = (server) => {
15
16
  // Register the prompt
16
17
  server.registerPrompt("args-prompt", {
17
18
  title: "Arguments Prompt",
19
+ icons: PROMPT_ICONS,
18
20
  description: "A prompt with two arguments, one required and one optional",
19
21
  argsSchema: promptArgsSchema,
20
22
  }, (args) => {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { completable } from "@modelcontextprotocol/server";
3
+ import { PROMPT_ICONS } from "../server/icons.js";
3
4
  /**
4
5
  * Register a prompt with completable arguments
5
6
  * - Two required arguments, both with completion handlers
@@ -36,6 +37,7 @@ export const registerPromptWithCompletions = (server) => {
36
37
  // Register the prompt
37
38
  server.registerPrompt("completable-prompt", {
38
39
  title: "Team Management",
40
+ icons: PROMPT_ICONS,
39
41
  description: "First argument choice narrows values for second argument.",
40
42
  argsSchema: promptArgsSchema,
41
43
  }, ({ department, name }) => ({
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { resourceTypeCompleter, resourceIdForPromptCompleter, } from "../resources/templates.js";
3
3
  import { textResource, textResourceUri, blobResourceUri, blobResource, RESOURCE_TYPE_BLOB, RESOURCE_TYPE_TEXT, RESOURCE_TYPES, } from "../resources/templates.js";
4
+ import { PROMPT_ICONS } from "../server/icons.js";
4
5
  /**
5
6
  * Register a prompt with an embedded resource reference
6
7
  * - Takes a resource type and id
@@ -17,6 +18,7 @@ export const registerEmbeddedResourcePrompt = (server) => {
17
18
  // Register the prompt
18
19
  server.registerPrompt("resource-prompt", {
19
20
  title: "Resource Prompt",
21
+ icons: PROMPT_ICONS,
20
22
  description: "A prompt that includes an embedded resource reference",
21
23
  argsSchema: promptArgsSchema,
22
24
  }, (args) => {
@@ -1,3 +1,4 @@
1
+ import { PROMPT_ICONS } from "../server/icons.js";
1
2
  /**
2
3
  * Register a simple prompt with no arguments
3
4
  * - Returns the fixed text of the prompt with no modifications
@@ -8,6 +9,7 @@ export const registerSimplePrompt = (server) => {
8
9
  // Register the prompt
9
10
  server.registerPrompt("simple-prompt", {
10
11
  title: "Simple Prompt",
12
+ icons: PROMPT_ICONS,
11
13
  description: "A prompt with no arguments",
12
14
  }, () => ({
13
15
  messages: [
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Resource collections (#3130): one `resources/read` that answers with several
3
+ * contents, each under a URI of its own. The spec allows a read to return more
4
+ * than one content ("a server could return the contents of several files when
5
+ * a directory resource is read"), and this module shows the pattern with a
6
+ * small, fixed product catalog:
7
+ *
8
+ * - `demo://resource/collection/summer-specials` (static, listed): every item.
9
+ * - `demo://resource/collection/by-category/{category}` (template, with a
10
+ * completer for `category`): the items in one category.
11
+ * - `demo://resource/collection/item/{itemId}` (template, with a completer for
12
+ * `itemId`): one item.
13
+ *
14
+ * Every content a collection returns carries its item's URI, not the
15
+ * collection's, and that URI is readable on its own through the item
16
+ * template, so a client can follow up on any one member. The catalog is a
17
+ * constant, so the module keeps no state and serves both protocol eras alike.
18
+ * Adapted from the example in olaservo's gist linked on the issue.
19
+ */
20
+ import { ResourceNotFoundError, ResourceTemplate, } from "@modelcontextprotocol/server";
21
+ import { RESOURCE_ICONS, RESOURCE_TEMPLATE_ICONS } from "../server/icons.js";
22
+ /** The example catalog the collections are drawn from. */
23
+ export const COLLECTION_ITEMS = [
24
+ { id: 1, name: "Summer Hat", price: 29.99, category: "accessories" },
25
+ { id: 2, name: "Beach Towel", price: 19.99, category: "accessories" },
26
+ { id: 3, name: "Sunglasses", price: 49.99, category: "accessories" },
27
+ { id: 4, name: "Flip Flops", price: 14.99, category: "footwear" },
28
+ { id: 5, name: "Sunscreen SPF50", price: 12.99, category: "skincare" },
29
+ ];
30
+ /** The distinct categories in the catalog, in first-seen order. */
31
+ export const COLLECTION_CATEGORIES = [
32
+ ...new Set(COLLECTION_ITEMS.map((item) => item.category)),
33
+ ];
34
+ const MIME_TYPE = "application/json";
35
+ const collectionUriBase = "demo://resource/collection";
36
+ const itemUriBase = `${collectionUriBase}/item`;
37
+ const categoryUriBase = `${collectionUriBase}/by-category`;
38
+ /** The URI of the collection holding every item. */
39
+ export const SUMMER_SPECIALS_URI = `${collectionUriBase}/summer-specials`;
40
+ /**
41
+ * The URI under which one item can be read on its own.
42
+ * @param id
43
+ */
44
+ export const collectionItemUri = (id) => `${itemUriBase}/${id}`;
45
+ /**
46
+ * The contents of one item: JSON, under the item's own URI.
47
+ * @param item
48
+ */
49
+ const itemContents = (item) => ({
50
+ uri: collectionItemUri(item.id),
51
+ mimeType: MIME_TYPE,
52
+ text: JSON.stringify(item, null, 2),
53
+ });
54
+ /** Completes a category name from its prefix. */
55
+ const categoryCompleter = (value) => COLLECTION_CATEGORIES.filter((category) => category.startsWith(value));
56
+ /** Completes an item id from its prefix. */
57
+ const itemIdCompleter = (value) => COLLECTION_ITEMS.map((item) => String(item.id)).filter((id) => id.startsWith(value));
58
+ /**
59
+ * Register the collection resources with the MCP server.
60
+ * - `summer-specials`: a static resource whose read returns every item
61
+ * - `collection-by-category`: a template whose read returns one category's items
62
+ * - `collection-item`: a template whose read returns one item
63
+ * - A category or item id that is not in the catalog is not found (`-32602`)
64
+ *
65
+ * @param server
66
+ */
67
+ export const registerCollectionResources = (server) => {
68
+ // The whole collection: one read, one content per item, each with its own URI
69
+ server.registerResource("summer-specials", SUMMER_SPECIALS_URI, {
70
+ title: "Summer Specials Collection",
71
+ icons: RESOURCE_ICONS,
72
+ mimeType: MIME_TYPE,
73
+ description: "A resource collection: one read returns every item in the catalog as a separate content, each under its own demo://resource/collection/item/{itemId} URI.",
74
+ }, async () => ({ contents: COLLECTION_ITEMS.map(itemContents) }));
75
+ // A filtered collection: the items in one category
76
+ server.registerResource("collection-by-category", new ResourceTemplate(`${categoryUriBase}/{category}`, {
77
+ list: undefined,
78
+ complete: { category: categoryCompleter },
79
+ }), {
80
+ title: "Collection by Category",
81
+ icons: RESOURCE_TEMPLATE_ICONS,
82
+ mimeType: MIME_TYPE,
83
+ description: `A resource collection filtered by the {category} variable (${COLLECTION_CATEGORIES.join(", ")}): one read returns each item in that category as a separate content, under its own URI.`,
84
+ }, async (uri, variables) => {
85
+ const category = String(variables.category);
86
+ const items = COLLECTION_ITEMS.filter((item) => item.category === category);
87
+ if (items.length === 0)
88
+ throw new ResourceNotFoundError(uri.toString());
89
+ return { contents: items.map(itemContents) };
90
+ });
91
+ // One member of the collections, readable on its own
92
+ server.registerResource("collection-item", new ResourceTemplate(`${itemUriBase}/{itemId}`, {
93
+ list: undefined,
94
+ complete: { itemId: itemIdCompleter },
95
+ }), {
96
+ title: "Collection Item",
97
+ icons: RESOURCE_TEMPLATE_ICONS,
98
+ mimeType: MIME_TYPE,
99
+ description: "One item of the resource collections, selected by the {itemId} variable (1 to 5). The collections return their items under these URIs.",
100
+ }, async (uri, variables) => {
101
+ // Match the id's exact spelling, so "01" is not found rather than item 1
102
+ const itemId = String(variables.itemId);
103
+ const item = COLLECTION_ITEMS.find((candidate) => String(candidate.id) === itemId);
104
+ if (!item)
105
+ throw new ResourceNotFoundError(uri.toString());
106
+ return { contents: [itemContents(item)] };
107
+ });
108
+ };
@@ -1,6 +1,7 @@
1
1
  import { dirname, join } from "path";
2
2
  import { fileURLToPath } from "url";
3
3
  import { readdirSync, readFileSync, statSync } from "fs";
4
+ import { RESOURCE_ICONS } from "../server/icons.js";
4
5
  /** How long a client or shared cache may keep a static document. */
5
6
  export const STATIC_DOCUMENT_CACHE_HINT = {
6
7
  ttlMs: 60 * 60_000,
@@ -49,7 +50,12 @@ export const registerFileResources = (server) => {
49
50
  server.registerResource(name, uri,
50
51
  // A static document changes only when the server is upgraded, so any
51
52
  // cache may keep it for an hour (2026-07-28 clients only; #4852).
52
- { mimeType, description, cacheHint: STATIC_DOCUMENT_CACHE_HINT }, async (uri) => {
53
+ {
54
+ mimeType,
55
+ description,
56
+ icons: RESOURCE_ICONS,
57
+ cacheHint: STATIC_DOCUMENT_CACHE_HINT,
58
+ }, async (uri) => {
53
59
  const text = readFileSafe(fullPath);
54
60
  return {
55
61
  contents: [
@@ -1,6 +1,7 @@
1
1
  import { registerResourceTemplates } from "./templates.js";
2
2
  import { registerFileResources } from "./files.js";
3
3
  import { registerMintedResources } from "./minted.js";
4
+ import { registerCollectionResources } from "./collections.js";
4
5
  import { fileURLToPath } from "url";
5
6
  import { dirname, join } from "path";
6
7
  import { readFileSync } from "fs";
@@ -13,6 +14,7 @@ import { readFileSync } from "fs";
13
14
  export const registerResources = (server, context) => {
14
15
  registerResourceTemplates(server);
15
16
  registerFileResources(server);
17
+ registerCollectionResources(server);
16
18
  if (context.era === "modern")
17
19
  registerMintedResources(server);
18
20
  };
@@ -14,6 +14,7 @@
14
14
  // (-32602).
15
15
  import { randomUUID } from "node:crypto";
16
16
  import { ResourceNotFoundError, ResourceTemplate, } from "@modelcontextprotocol/server";
17
+ import { RESOURCE_ICONS, RESOURCE_TEMPLATE_ICONS } from "../server/icons.js";
17
18
  /** How long a minted resource stays readable, in milliseconds. */
18
19
  export const MINTED_RESOURCE_TTL_MS = 10 * 60_000;
19
20
  /**
@@ -85,6 +86,8 @@ export function mintBlobResource(name, mimeType, blob) {
85
86
  name,
86
87
  mimeType,
87
88
  description: `Created by a tool call; readable for ${MINTED_RESOURCE_TTL_MS / 60_000} minutes at this URI`,
89
+ // #5434: a minted resource is a resource like any other (#3131).
90
+ icons: RESOURCE_ICONS,
88
91
  };
89
92
  }
90
93
  /**
@@ -96,6 +99,7 @@ export function mintBlobResource(name, mimeType, blob) {
96
99
  */
97
100
  export function registerMintedResources(server) {
98
101
  server.registerResource("Minted Resource", new ResourceTemplate(mintedUriTemplate, { list: undefined }), {
102
+ icons: RESOURCE_TEMPLATE_ICONS,
99
103
  description: "A resource a tool created for this client, such as gzip-file-as-resource's output. Readable for ten minutes at the URI the tool returned.",
100
104
  }, async (uri) => {
101
105
  sweep(Date.now());
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ResourceNotFoundError, ResourceTemplate, completable, } from "@modelcontextprotocol/server";
3
+ import { RESOURCE_TEMPLATE_ICONS } from "../server/icons.js";
3
4
  // Resource types
4
5
  export const RESOURCE_TYPE_TEXT = "Text";
5
6
  export const RESOURCE_TYPE_BLOB = "Blob";
@@ -17,7 +18,12 @@ export const RESOURCE_TYPES = [
17
18
  * The input value is expected to be a string representing the type of resource to fetch.
18
19
  * The completion logic matches the input against available resource types.
19
20
  */
20
- export const resourceTypeCompleter = completable(z.string().describe("Type of resource to fetch"), (value) => {
21
+ export const resourceTypeCompleter = completable(
22
+ // Prompt arguments carry no JSON Schema, only a description, so the
23
+ // description is the only place a client can learn the allowed values (#3985)
24
+ z
25
+ .string()
26
+ .describe(`Type of resource to fetch. Must be "${RESOURCE_TYPE_TEXT}" or "${RESOURCE_TYPE_BLOB}".`), (value) => {
21
27
  return RESOURCE_TYPES.filter((t) => t.startsWith(value));
22
28
  });
23
29
  /**
@@ -36,7 +42,9 @@ export const resourceTypeCompleter = completable(z.string().describe("Type of re
36
42
  * The input string is first transformed into a number and checked to ensure it is an integer.
37
43
  * This helps validate and suggest appropriate resource IDs.
38
44
  */
39
- export const resourceIdForPromptCompleter = completable(z.string().describe("ID of the text resource to fetch"), (value) => {
45
+ export const resourceIdForPromptCompleter = completable(z
46
+ .string()
47
+ .describe("ID of the resource to fetch. Must be a positive integer (1 or greater)."), (value) => {
40
48
  const resourceId = Number(value);
41
49
  return Number.isInteger(resourceId) && resourceId > 0 ? [value] : [];
42
50
  });
@@ -144,6 +152,7 @@ export const registerResourceTemplates = (server) => {
144
152
  complete: { resourceId: resourceIdForResourceTemplateCompleter },
145
153
  }), {
146
154
  mimeType: "text/plain",
155
+ icons: RESOURCE_TEMPLATE_ICONS,
147
156
  description: "Plaintext dynamic resource fabricated from the {resourceId} variable, which must be an integer.",
148
157
  }, async (uri, variables) => {
149
158
  const resourceId = parseResourceId(uri, variables);
@@ -157,6 +166,7 @@ export const registerResourceTemplates = (server) => {
157
166
  complete: { resourceId: resourceIdForResourceTemplateCompleter },
158
167
  }), {
159
168
  mimeType: "application/octet-stream",
169
+ icons: RESOURCE_TEMPLATE_ICONS,
160
170
  description: "Binary (base64) dynamic resource fabricated from the {resourceId} variable, which must be an integer.",
161
171
  }, async (uri, variables) => {
162
172
  const resourceId = parseResourceId(uri, variables);
@@ -0,0 +1,51 @@
1
+ // The icons the everything server attaches to its primitives (#3131).
2
+ //
3
+ // SEP-973 lets a server give `icons` to its implementation info and to each
4
+ // tool, prompt, resource and resource template, and an icon may name the
5
+ // `theme` it is drawn for: "light" for a light background, "dark" for a dark
6
+ // one. This module defines one light/dark pair per primitive kind, so a client
7
+ // such as the Inspector can show which kind an entry is and pick the variant
8
+ // that suits its own theme.
9
+ //
10
+ // One pair per kind, rather than one per item, keeps every registration to a
11
+ // single `icons:` line that names its kind's set. Each icon is a small inline
12
+ // SVG carried as a base64 `data:` URI, the form the spec names for embedded
13
+ // image data: a client fetches nothing, and the package ships no new files.
14
+ /** Stroke colour of the variant drawn for a light background. */
15
+ const LIGHT_THEME_STROKE = "#1F2937";
16
+ /** Stroke colour of the variant drawn for a dark background. */
17
+ const DARK_THEME_STROKE = "#F9FAFB";
18
+ /**
19
+ * Build the light and dark variants of one glyph.
20
+ *
21
+ * @param glyph - The SVG elements of a 24x24, stroke-only glyph.
22
+ * @returns Two scalable SVG icons, one per theme.
23
+ */
24
+ const themedIcons = (glyph) => [
25
+ ["light", LIGHT_THEME_STROKE],
26
+ ["dark", DARK_THEME_STROKE],
27
+ ].map(([theme, stroke]) => {
28
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" ` +
29
+ `fill="none" stroke="${stroke}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">` +
30
+ `${glyph}</svg>`;
31
+ return {
32
+ src: `data:image/svg+xml;base64,${Buffer.from(svg).toString("base64")}`,
33
+ mimeType: "image/svg+xml",
34
+ sizes: ["any"],
35
+ theme,
36
+ };
37
+ });
38
+ /** The server itself (its `serverInfo`): a two-unit server rack. */
39
+ export const SERVER_ICONS = themedIcons('<rect x="3" y="4" width="18" height="7" rx="2"/>' +
40
+ '<rect x="3" y="13" width="18" height="7" rx="2"/>' +
41
+ '<path d="M7 7.5h.01M7 16.5h.01"/>');
42
+ /** Every tool: a wrench. */
43
+ export const TOOL_ICONS = themedIcons('<path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z"/>');
44
+ /** Every prompt: a speech bubble. */
45
+ export const PROMPT_ICONS = themedIcons('<path d="M4 5h16v11H9l-5 4z"/><path d="M8 9h8M8 12h5"/>');
46
+ /** Every concrete resource: a document. */
47
+ export const RESOURCE_ICONS = themedIcons('<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4M9 12h6M9 16h6"/>');
48
+ /** Every resource template: a document with a placeholder in braces. */
49
+ export const RESOURCE_TEMPLATE_ICONS = themedIcons('<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4"/>' +
50
+ '<path d="M10.5 11c-1 0-1 .8-1 1.5s0 1.5-1 1.5c1 0 1 .8 1 1.5s0 1.5 1 1.5"/>' +
51
+ '<path d="M13.5 11c1 0 1 .8 1 1.5s0 1.5 1 1.5c-1 0-1 .8-1 1.5s0 1.5-1 1.5"/>');
@@ -27,6 +27,7 @@ import { guardTaskTools, registerTasksExtension, TASKS_EXTENSION, } from "./task
27
27
  import { syncRoots } from "./roots.js";
28
28
  import { instancePublisher, } from "./context.js";
29
29
  import { SERVER_VERSION } from "../version.js";
30
+ import { SERVER_ICONS } from "./icons.js";
30
31
  /**
31
32
  * The process-wide `requestState` codec. The key is per process: on the
32
33
  * 2026-07-28 HTTP path a later round may be served by a fresh instance, so
@@ -73,6 +74,7 @@ export const createServer = (options = {}) => {
73
74
  const server = new McpServer({
74
75
  name: "mcp-servers/everything",
75
76
  title: "Everything Reference Server",
77
+ icons: SERVER_ICONS,
76
78
  version: SERVER_VERSION,
77
79
  }, {
78
80
  capabilities: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { TOOL_ICONS } from "../server/icons.js";
2
3
  // Tool input schema
3
4
  export const EchoSchema = z.object({
4
5
  message: z.string().describe("Message to echo"),
@@ -9,6 +10,7 @@ const config = {
9
10
  title: "Echo Tool",
10
11
  description: "Echoes back the input string",
11
12
  inputSchema: EchoSchema,
13
+ icons: TOOL_ICONS,
12
14
  annotations: {
13
15
  readOnlyHint: true,
14
16
  destructiveHint: false,
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { MCP_TINY_IMAGE } from "./get-tiny-image.js";
3
+ import { TOOL_ICONS } from "../server/icons.js";
3
4
  // Tool input schema
4
5
  const GetAnnotatedMessageSchema = z.object({
5
6
  messageType: z
@@ -16,6 +17,7 @@ const config = {
16
17
  title: "Get Annotated Message Tool",
17
18
  description: "Demonstrates how annotations can be used to provide metadata about content.",
18
19
  inputSchema: GetAnnotatedMessageSchema,
20
+ icons: TOOL_ICONS,
19
21
  annotations: {
20
22
  readOnlyHint: true, // This tool only returns data, no side effects
21
23
  destructiveHint: false, // Does not delete or modify anything
@@ -1,3 +1,4 @@
1
+ import { TOOL_ICONS } from "../server/icons.js";
1
2
  /** The placeholder that replaces a masked value. */
2
3
  export const REDACTED = "<redacted>";
3
4
  /** The opt-in that returns every value unmasked. */
@@ -22,6 +23,7 @@ const config = {
22
23
  description: "Returns all environment variables, helpful for debugging MCP server configuration. " +
23
24
  `Values of credential-like names (a KEY, TOKEN, SECRET, PASSWORD, PASSWD, CREDENTIAL, AUTH or COOKIE name segment) are masked as "${REDACTED}" unless ${INCLUDE_SECRETS_VAR} is set to 1 or true in the server's environment.`,
24
25
  inputSchema: {},
26
+ icons: TOOL_ICONS,
25
27
  annotations: {
26
28
  readOnlyHint: true,
27
29
  destructiveHint: false,
@@ -12,6 +12,7 @@
12
12
  // with the body (-32020). The tool reports the header it was sent, which is
13
13
  // null on stdio and for a 2025-era client, which mirrors nothing.
14
14
  import { fromJsonSchema, } from "@modelcontextprotocol/server";
15
+ import { TOOL_ICONS } from "../server/icons.js";
15
16
  /**
16
17
  * The keyword that asks a 2026-07-28 client to mirror an argument into the
17
18
  * `Mcp-Param-<value>` header (SEP-2243). It is an extension keyword, so the
@@ -67,6 +68,7 @@ const config = {
67
68
  "JSON Schema 2020-12 input and output schemas.",
68
69
  inputSchema: fromJsonSchema(inputSchema),
69
70
  outputSchema: fromJsonSchema(outputSchema),
71
+ icons: TOOL_ICONS,
70
72
  annotations: {
71
73
  readOnlyHint: true,
72
74
  destructiveHint: false,
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { textResource, textResourceUri, blobResourceUri, blobResource, } from "../resources/templates.js";
3
+ import { TOOL_ICONS } from "../server/icons.js";
3
4
  // Tool input schema
4
5
  const GetResourceLinksSchema = z.object({
5
6
  count: z
@@ -15,6 +16,7 @@ const config = {
15
16
  title: "Get Resource Links Tool",
16
17
  description: "Returns up to ten resource links that reference different types of resources",
17
18
  inputSchema: GetResourceLinksSchema,
19
+ icons: TOOL_ICONS,
18
20
  annotations: {
19
21
  readOnlyHint: true,
20
22
  destructiveHint: false,
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { textResource, textResourceUri, blobResourceUri, blobResource, RESOURCE_TYPE_BLOB, RESOURCE_TYPE_TEXT, RESOURCE_TYPES, } from "../resources/templates.js";
3
+ import { TOOL_ICONS } from "../server/icons.js";
3
4
  // Tool input schema
4
5
  const GetResourceReferenceSchema = z.object({
5
6
  resourceType: z
@@ -16,6 +17,7 @@ const config = {
16
17
  title: "Get Resource Reference Tool",
17
18
  description: "Returns a resource reference that can be used by MCP clients",
18
19
  inputSchema: GetResourceReferenceSchema,
20
+ icons: TOOL_ICONS,
19
21
  annotations: {
20
22
  readOnlyHint: true,
21
23
  destructiveHint: false,
@@ -7,6 +7,7 @@
7
7
  // SDK's legacy shim sends a real `roots/list` request and re-enters the
8
8
  // handler with the answer. Roots is deprecated as of 2026-07-28 (SEP-2577).
9
9
  import { inputRequired, inputResponse, } from "@modelcontextprotocol/server";
10
+ import { TOOL_ICONS } from "../server/icons.js";
10
11
  // Tool configuration
11
12
  const name = "get-roots-list";
12
13
  const config = {
@@ -14,6 +15,7 @@ const config = {
14
15
  description: "Lists the current MCP roots provided by the client. Demonstrates the roots protocol capability even though this server doesn't access files. " +
15
16
  "Deprecated: Roots is deprecated as of protocol version 2026-07-28. The server asks for the roots with a multi-round-trip request on every protocol version.",
16
17
  inputSchema: {},
18
+ icons: TOOL_ICONS,
17
19
  annotations: {
18
20
  readOnlyHint: true,
19
21
  destructiveHint: false,
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { TOOL_ICONS } from "../server/icons.js";
2
3
  // Tool input schema
3
4
  const GetStructuredContentInputSchema = {
4
5
  location: z
@@ -18,6 +19,7 @@ const config = {
18
19
  description: "Returns structured content along with an output schema for client data validation",
19
20
  inputSchema: GetStructuredContentInputSchema,
20
21
  outputSchema: GetStructuredContentOutputSchema,
22
+ icons: TOOL_ICONS,
21
23
  annotations: {
22
24
  readOnlyHint: true,
23
25
  destructiveHint: false,
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { TOOL_ICONS } from "../server/icons.js";
2
3
  // Tool input schema
3
4
  const GetSumSchema = z.object({
4
5
  a: z.number().describe("First number"),
@@ -10,6 +11,7 @@ const config = {
10
11
  title: "Get Sum Tool",
11
12
  description: "Returns the sum of two numbers",
12
13
  inputSchema: GetSumSchema,
14
+ icons: TOOL_ICONS,
13
15
  annotations: {
14
16
  readOnlyHint: true,
15
17
  destructiveHint: false,
@@ -1,3 +1,4 @@
1
+ import { TOOL_ICONS } from "../server/icons.js";
1
2
  // A tiny encoded MCP logo image
2
3
  export const MCP_TINY_IMAGE = "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAeGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAJAAAAABAAAAkAAAAAEAAqACAAQAAAABAAAAFKADAAQAAAABAAAAFAAAAAAXNii1AAAACXBIWXMAABYlAAAWJQFJUiTwAAAB82lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjE0NDwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+MTQ0PC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KReh49gAAAjRJREFUOBGFlD2vMUEUx2clvoNCcW8hCqFAo1dKhEQpvsF9KrWEBh/ALbQ0KkInBI3SWyGPCCJEQliXgsTLefaca/bBWjvJzs6cOf/fnDkzOQJIjWm06/XKBEGgD8c6nU5VIWgBtQDPZPWtJE8O63a7LBgMMo/Hw0ql0jPjcY4RvmqXy4XMjUYDUwLtdhtmsxnYbDbI5/O0djqdFFKmsEiGZ9jP9gem0yn0ej2Yz+fg9XpfycimAD7DttstQTDKfr8Po9GIIg6Hw1Cr1RTgB+A72GAwgMPhQLBMJgNSXsFqtUI2myUo18pA6QJogefsPrLBX4QdCVatViklw+EQRFGEj88P2O12pEUGATmsXq+TaLPZ0AXgMRF2vMEqlQoJTSYTpNNpApvNZliv1/+BHDaZTAi2Wq1A3Ig0xmMej7+RcZjdbodUKkWAaDQK+GHjHPnImB88JrZIJAKFQgH2+z2BOczhcMiwRCIBgUAA+NN5BP6mj2DYff35gk6nA61WCzBn2JxO5wPM7/fLz4vD0E+OECfn8xl/0Gw2KbLxeAyLxQIsFgt8p75pDSO7h/HbpUWpewCike9WLpfB7XaDy+WCYrFI/slk8i0MnRRAUt46hPMI4vE4+Hw+ec7t9/44VgWigEeby+UgFArJWjUYOqhWG6x50rpcSfR6PVUfNOgEVRlTX0HhrZBKz4MZjUYWi8VoA+lc9H/VaRZYjBKrtXR8tlwumcFgeMWRbZpA9ORQWfVm8A/FsrLaxebd5wAAAABJRU5ErkJggg==";
3
4
  // Tool configuration
@@ -6,6 +7,7 @@ const config = {
6
7
  title: "Get Tiny Image Tool",
7
8
  description: "Returns a tiny MCP logo image.",
8
9
  inputSchema: {},
10
+ icons: TOOL_ICONS,
9
11
  annotations: {
10
12
  readOnlyHint: true,
11
13
  destructiveHint: false,
@@ -24,6 +24,7 @@ import { BlockList } from "node:net";
24
24
  import { gzipSync } from "node:zlib";
25
25
  import { mintBlobResource } from "../resources/minted.js";
26
26
  import { getSessionResourceURI, registerSessionResource, } from "../resources/session.js";
27
+ import { RESOURCE_ICONS, TOOL_ICONS } from "../server/icons.js";
27
28
  // Maximum input file size - 10 MB default
28
29
  const GZIP_MAX_FETCH_SIZE = Number(process.env.GZIP_MAX_FETCH_SIZE ?? String(10 * 1024 * 1024));
29
30
  // Maximum fetch time - 30 seconds default.
@@ -143,6 +144,7 @@ const config = {
143
144
  title: "GZip File as Resource Tool",
144
145
  description: "Compresses a single file using gzip compression. Depending upon the selected output type, returns either the compressed data as a gzipped resource or a resource link, allowing it to be downloaded in a subsequent request: during the current session for a 2025-era client, or for ten minutes at a minted URI on protocol version 2026-07-28.",
145
146
  inputSchema: GZipFileAsResourceSchema,
147
+ icons: TOOL_ICONS,
146
148
  annotations: {
147
149
  readOnlyHint: false,
148
150
  destructiveHint: false,
@@ -181,7 +183,9 @@ export const registerGZipFileAsResourceTool = (server, context) => {
181
183
  const uri = getSessionResourceURI(name);
182
184
  const blob = compressedBuffer.toString("base64");
183
185
  const mimeType = "application/gzip";
184
- const resource = { uri, name, mimeType };
186
+ // #5434: the session resource is listed like any other, so it carries
187
+ // the resource icons (#3131) in resources/list and in its link.
188
+ const resource = { uri, name, mimeType, icons: RESOURCE_ICONS };
185
189
  // Return the resource or a resource link that can be used to access this resource later
186
190
  if (outputType === "resource") {
187
191
  return {
@@ -16,6 +16,7 @@
16
16
  import { acceptedContent, inputRequired, inputResponse, } from "@modelcontextprotocol/server";
17
17
  import { z } from "zod";
18
18
  import { clientSupportsFormElicitation, createTask, } from "../server/tasks.js";
19
+ import { TOOL_ICONS } from "../server/icons.js";
19
20
  // Tool input schema
20
21
  const SimulateResearchQuerySchema = z.object({
21
22
  topic: z
@@ -48,6 +49,7 @@ const config = {
48
49
  "If 'ambiguous' is true and the client supports elicitation, the task pauses with status " +
49
50
  "input_required until the client answers its clarification request with tasks/update.",
50
51
  inputSchema: SimulateResearchQuerySchema,
52
+ icons: TOOL_ICONS,
51
53
  annotations: {
52
54
  // Each call creates a task in the process-wide task store.
53
55
  readOnlyHint: false,
@@ -9,6 +9,7 @@
9
9
  // per request. The timer belongs to the server instance serving this client,
10
10
  // so no session map is needed (#4852).
11
11
  import { beginSimulatedLogging } from "../server/logging.js";
12
+ import { TOOL_ICONS } from "../server/icons.js";
12
13
  // Tool configuration
13
14
  const name = "toggle-simulated-logging";
14
15
  const config = {
@@ -17,6 +18,7 @@ const config = {
17
18
  "protocol version 2026-07-28 removes logging/setLevel; use trigger-log-messages with a per-request " +
18
19
  "log level instead.",
19
20
  inputSchema: {},
21
+ icons: TOOL_ICONS,
20
22
  annotations: {
21
23
  readOnlyHint: false,
22
24
  destructiveHint: false,
@@ -9,6 +9,7 @@
9
9
  // `trigger-resource-update` sends one on demand. The timer belongs to the
10
10
  // server instance serving this client, so no session map is needed (#4852).
11
11
  import { beginSimulatedResourceUpdates } from "../resources/subscriptions.js";
12
+ import { TOOL_ICONS } from "../server/icons.js";
12
13
  // Tool configuration
13
14
  const name = "toggle-subscriber-updates";
14
15
  const config = {
@@ -17,6 +18,7 @@ const config = {
17
18
  "since protocol version 2026-07-28 removes resources/subscribe; use trigger-resource-update with a " +
18
19
  "subscriptions/listen stream instead.",
19
20
  inputSchema: {},
21
+ icons: TOOL_ICONS,
20
22
  annotations: {
21
23
  readOnlyHint: false,
22
24
  destructiveHint: false,
@@ -11,6 +11,7 @@
11
11
  import { acceptedContent, inputRequired, inputResponse, } from "@modelcontextprotocol/server";
12
12
  import { z } from "zod";
13
13
  import { createTask } from "../server/tasks.js";
14
+ import { TOOL_ICONS } from "../server/icons.js";
14
15
  // Tool configuration
15
16
  const name = "trigger-elicitation-request-async";
16
17
  const config = {
@@ -19,6 +20,7 @@ const config = {
19
20
  "the user's input: the task waits in status input_required, carrying an elicitation request, until the " +
20
21
  "client answers it with tasks/update, then completes with a summary of the answer.",
21
22
  inputSchema: {},
23
+ icons: TOOL_ICONS,
22
24
  annotations: {
23
25
  readOnlyHint: false,
24
26
  destructiveHint: false,
@@ -9,12 +9,14 @@
9
9
  // in-band; for a 2025-era client the SDK's legacy shim sends a real
10
10
  // `elicitation/create` request and re-enters the handler with the answer.
11
11
  import { inputRequired, inputResponse, } from "@modelcontextprotocol/server";
12
+ import { TOOL_ICONS } from "../server/icons.js";
12
13
  // Tool configuration
13
14
  const name = "trigger-elicitation-request";
14
15
  const config = {
15
16
  title: "Trigger Elicitation Request Tool",
16
17
  description: "Trigger a Request from the Server for User Elicitation",
17
18
  inputSchema: {},
19
+ icons: TOOL_ICONS,
18
20
  annotations: {
19
21
  readOnlyHint: false,
20
22
  destructiveHint: false,
@@ -9,6 +9,7 @@
9
9
  // and on a 2025-era session, the handler's subscription bus on the 2026-07-28
10
10
  // HTTP path.
11
11
  import { z } from "zod";
12
+ import { TOOL_ICONS } from "../server/icons.js";
12
13
  // Tool input schema
13
14
  const TriggerListChangedSchema = z.object({
14
15
  list: z
@@ -23,6 +24,7 @@ const config = {
23
24
  "2026-07-28 it is delivered on each subscriptions/listen stream that asked for that list; a 2025-era " +
24
25
  "client receives it unsolicited.",
25
26
  inputSchema: TriggerListChangedSchema,
27
+ icons: TOOL_ICONS,
26
28
  annotations: {
27
29
  readOnlyHint: true,
28
30
  destructiveHint: false,
@@ -10,6 +10,7 @@
10
10
  // the handler is the same for both. Logging is deprecated as of 2026-07-28
11
11
  // (SEP-2577); this replaces `toggle-simulated-logging`, whose timer relies on
12
12
  // `logging/setLevel` and unsolicited messages, which 2026-07-28 removes.
13
+ import { TOOL_ICONS } from "../server/icons.js";
13
14
  /** Every logging level, from least to most severe. */
14
15
  export const LOGGING_LEVELS = [
15
16
  "debug",
@@ -30,6 +31,7 @@ const config = {
30
31
  "are sent, and none if it names no level; a 2025-era client gets those at or above the level it set " +
31
32
  "with logging/setLevel. Deprecated: logging is deprecated as of protocol version 2026-07-28.",
32
33
  inputSchema: {},
34
+ icons: TOOL_ICONS,
33
35
  annotations: {
34
36
  readOnlyHint: true,
35
37
  destructiveHint: false,
@@ -1,4 +1,6 @@
1
+ import { setTimeout as sleep } from "node:timers/promises";
1
2
  import { z } from "zod";
3
+ import { TOOL_ICONS } from "../server/icons.js";
2
4
  // Tool input schema
3
5
  const TriggerLongRunningOperationSchema = z.object({
4
6
  duration: z
@@ -13,6 +15,7 @@ const config = {
13
15
  title: "Trigger Long Running Operation Tool",
14
16
  description: "Demonstrates a long running operation with progress updates.",
15
17
  inputSchema: TriggerLongRunningOperationSchema,
18
+ icons: TOOL_ICONS,
16
19
  annotations: {
17
20
  readOnlyHint: true,
18
21
  destructiveHint: false,
@@ -32,6 +35,11 @@ const config = {
32
35
  * At the end of the operation, the tool returns a message indicating the completion of the
33
36
  * operation, including the total duration and steps.
34
37
  *
38
+ * The operation watches the request's abort signal, which the SDK fires when the client
39
+ * sends `notifications/cancelled` or the connection closes, in either protocol era. On
40
+ * cancellation it clears its pending timer and stops without sending further progress, so
41
+ * a cancelled operation never holds the process open (#1124, #4846).
42
+ *
35
43
  * @param {McpServer} server - The McpServer instance where the tool will be registered.
36
44
  */
37
45
  export const registerTriggerLongRunningOperationTool = (server) => {
@@ -40,8 +48,24 @@ export const registerTriggerLongRunningOperationTool = (server) => {
40
48
  const { duration, steps } = validatedArgs;
41
49
  const stepDuration = duration / steps;
42
50
  const progressToken = ctx.mcpReq._meta?.progressToken;
51
+ const signal = ctx.mcpReq.signal;
43
52
  for (let i = 1; i < steps + 1; i++) {
44
- await new Promise((resolve) => setTimeout(resolve, stepDuration * 1000));
53
+ try {
54
+ // Rejects at once, clearing its timer, when the request is cancelled.
55
+ await sleep(stepDuration * 1000, undefined, { signal });
56
+ }
57
+ catch {
58
+ // The SDK drops the response to a cancelled request, so this result
59
+ // never reaches the client; returning simply ends the handler.
60
+ return {
61
+ content: [
62
+ {
63
+ type: "text",
64
+ text: `Long running operation cancelled after ${i - 1} of ${steps} steps.`,
65
+ },
66
+ ],
67
+ };
68
+ }
45
69
  if (progressToken !== undefined) {
46
70
  await server.server.notification({
47
71
  method: "notifications/progress",
@@ -18,6 +18,7 @@
18
18
  import { acceptedContent, inputRequired, inputResponse, } from "@modelcontextprotocol/server";
19
19
  import { z } from "zod";
20
20
  import { roundStateCodec } from "../server/index.js";
21
+ import { TOOL_ICONS } from "../server/icons.js";
21
22
  // Tool configuration
22
23
  const name = "trigger-multi-step-elicitation";
23
24
  const config = {
@@ -27,6 +28,7 @@ const config = {
27
28
  "(input_required) and requestState on protocol version 2026-07-28; 2025-era clients get the same " +
28
29
  "flow as elicitation requests.",
29
30
  inputSchema: {},
31
+ icons: TOOL_ICONS,
30
32
  annotations: {
31
33
  readOnlyHint: false,
32
34
  destructiveHint: false,
@@ -9,6 +9,7 @@
9
9
  // notification is sent only once it has. This replaces the timed updates of
10
10
  // `toggle-subscriber-updates` (2025-era only) with one sent on demand.
11
11
  import { z } from "zod";
12
+ import { TOOL_ICONS } from "../server/icons.js";
12
13
  // Tool input schema
13
14
  const TriggerResourceUpdateSchema = z.object({
14
15
  uri: z
@@ -23,6 +24,7 @@ const config = {
23
24
  "delivered on each subscriptions/listen stream whose resourceSubscriptions name the URI; a 2025-era " +
24
25
  "client receives it once it has called resources/subscribe for the URI.",
25
26
  inputSchema: TriggerResourceUpdateSchema,
27
+ icons: TOOL_ICONS,
26
28
  annotations: {
27
29
  readOnlyHint: true,
28
30
  destructiveHint: false,
@@ -12,6 +12,7 @@
12
12
  import { inputRequired, inputResponse, } from "@modelcontextprotocol/server";
13
13
  import { z } from "zod";
14
14
  import { createTask } from "../server/tasks.js";
15
+ import { TOOL_ICONS } from "../server/icons.js";
15
16
  // Tool input schema
16
17
  const TriggerSamplingRequestAsyncSchema = z.object({
17
18
  prompt: z
@@ -32,6 +33,7 @@ const config = {
32
33
  "answers it with tasks/update, then completes with the result. Deprecated: Sampling is deprecated as of " +
33
34
  "protocol version 2026-07-28.",
34
35
  inputSchema: TriggerSamplingRequestAsyncSchema,
36
+ icons: TOOL_ICONS,
35
37
  annotations: {
36
38
  readOnlyHint: false,
37
39
  destructiveHint: false,
@@ -10,6 +10,7 @@
10
10
  // as of 2026-07-28 (SEP-2577).
11
11
  import { inputRequired, inputResponse, } from "@modelcontextprotocol/server";
12
12
  import { z } from "zod";
13
+ import { TOOL_ICONS } from "../server/icons.js";
13
14
  // Tool input schema
14
15
  const TriggerSamplingRequestSchema = z.object({
15
16
  prompt: z.string().describe("The prompt to send to the LLM"),
@@ -25,6 +26,7 @@ const config = {
25
26
  description: "Trigger a Request from the Server for LLM Sampling. Deprecated: Sampling is deprecated as of protocol " +
26
27
  "version 2026-07-28. The server asks with a multi-round-trip request on every protocol version.",
27
28
  inputSchema: TriggerSamplingRequestSchema,
29
+ icons: TOOL_ICONS,
28
30
  annotations: {
29
31
  readOnlyHint: false,
30
32
  destructiveHint: false,
@@ -14,6 +14,7 @@
14
14
  import { randomUUID } from "node:crypto";
15
15
  import { inputRequired, inputResponse, UrlElicitationRequiredError, } from "@modelcontextprotocol/server";
16
16
  import { z } from "zod";
17
+ import { TOOL_ICONS } from "../server/icons.js";
17
18
  // Tool input schema
18
19
  const TriggerUrlElicitationSchema = z.object({
19
20
  url: z.string().url().describe("The URL the user should open"),
@@ -48,6 +49,7 @@ const config = {
48
49
  "to handle URL elicitation via the error response. Set errorPath=true to use the error path. " +
49
50
  "On protocol version 2026-07-28 the server instead returns the URL elicitation in-band (input_required).",
50
51
  inputSchema: TriggerUrlElicitationSchema,
52
+ icons: TOOL_ICONS,
51
53
  annotations: {
52
54
  readOnlyHint: false,
53
55
  destructiveHint: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "MCP server that exercises all the features of the MCP protocol",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "mcpName": "io.github.modelcontextprotocol/server-everything",