@modelcontextprotocol/server-everything 2.0.1 → 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 (40) hide show
  1. package/README.md +45 -0
  2. package/dist/docs/features.md +9 -4
  3. package/dist/docs/instructions.md +2 -1
  4. package/dist/docs/structure.md +9 -2
  5. package/dist/prompts/args.js +2 -0
  6. package/dist/prompts/completions.js +2 -0
  7. package/dist/prompts/resource.js +2 -0
  8. package/dist/prompts/simple.js +2 -0
  9. package/dist/resources/collections.js +108 -0
  10. package/dist/resources/files.js +7 -1
  11. package/dist/resources/index.js +2 -0
  12. package/dist/resources/minted.js +4 -0
  13. package/dist/resources/templates.js +12 -2
  14. package/dist/server/icons.js +51 -0
  15. package/dist/server/index.js +2 -0
  16. package/dist/tools/echo.js +2 -0
  17. package/dist/tools/get-annotated-message.js +2 -0
  18. package/dist/tools/get-env.js +60 -4
  19. package/dist/tools/get-header-params.js +2 -0
  20. package/dist/tools/get-resource-links.js +9 -7
  21. package/dist/tools/get-resource-reference.js +2 -0
  22. package/dist/tools/get-roots-list.js +2 -0
  23. package/dist/tools/get-structured-content.js +2 -0
  24. package/dist/tools/get-sum.js +2 -0
  25. package/dist/tools/get-tiny-image.js +3 -1
  26. package/dist/tools/gzip-file-as-resource.js +184 -33
  27. package/dist/tools/simulate-research-query.js +2 -0
  28. package/dist/tools/toggle-simulated-logging.js +2 -0
  29. package/dist/tools/toggle-subscriber-updates.js +2 -0
  30. package/dist/tools/trigger-elicitation-request-async.js +2 -0
  31. package/dist/tools/trigger-elicitation-request.js +140 -123
  32. package/dist/tools/trigger-list-changed.js +2 -0
  33. package/dist/tools/trigger-log-messages.js +2 -0
  34. package/dist/tools/trigger-long-running-operation.js +26 -2
  35. package/dist/tools/trigger-multi-step-elicitation.js +2 -0
  36. package/dist/tools/trigger-resource-update.js +2 -0
  37. package/dist/tools/trigger-sampling-request-async.js +2 -0
  38. package/dist/tools/trigger-sampling-request.js +2 -0
  39. package/dist/tools/trigger-url-elicitation.js +2 -0
  40. package/package.json +1 -1
@@ -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,
@@ -22,116 +24,150 @@ const config = {
22
24
  openWorldHint: false,
23
25
  },
24
26
  };
25
- /** The form: one field of each type form-mode elicitation supports. */
26
- const requestedSchema = {
27
- type: "object",
28
- properties: {
29
- name: {
30
- title: "String",
31
- type: "string",
32
- description: "Your full, legal name",
33
- },
34
- check: {
35
- title: "Boolean",
36
- type: "boolean",
37
- description: "Agree to the terms and conditions",
38
- },
39
- firstLine: {
40
- title: "String with default",
41
- type: "string",
42
- description: "Favorite first line of a story",
43
- default: "It was a dark and stormy night.",
44
- },
45
- email: {
46
- title: "String with email format",
47
- type: "string",
48
- format: "email",
49
- description: "Your email address (will be verified, and never shared with anyone else)",
50
- },
51
- homepage: {
52
- type: "string",
53
- format: "uri",
54
- title: "String with uri format",
55
- description: "Portfolio / personal website",
56
- },
57
- birthdate: {
58
- title: "String with date format",
59
- type: "string",
60
- format: "date",
61
- description: "Your date of birth",
62
- },
63
- integer: {
64
- title: "Integer",
65
- type: "integer",
66
- description: "Your favorite integer (do not give us your phone number, pin, or other sensitive info)",
67
- minimum: 1,
68
- maximum: 100,
69
- default: 42,
70
- },
71
- number: {
72
- title: "Number in range 1-1000",
73
- type: "number",
74
- description: "Favorite number (there are no wrong answers)",
75
- minimum: 0,
76
- maximum: 1000,
77
- default: 3.14,
78
- },
79
- untitledSingleSelectEnum: {
27
+ /** The form's fields: one of each type form-mode elicitation supports. */
28
+ const properties = {
29
+ name: {
30
+ title: "String",
31
+ type: "string",
32
+ description: "Your full, legal name",
33
+ },
34
+ check: {
35
+ title: "Boolean",
36
+ type: "boolean",
37
+ description: "Agree to the terms and conditions",
38
+ },
39
+ firstLine: {
40
+ title: "String with default",
41
+ type: "string",
42
+ description: "Favorite first line of a story",
43
+ default: "It was a dark and stormy night.",
44
+ },
45
+ email: {
46
+ title: "String with email format",
47
+ type: "string",
48
+ format: "email",
49
+ description: "Your email address (will be verified, and never shared with anyone else)",
50
+ },
51
+ homepage: {
52
+ type: "string",
53
+ format: "uri",
54
+ title: "String with uri format",
55
+ description: "Portfolio / personal website",
56
+ },
57
+ birthdate: {
58
+ title: "String with date format",
59
+ type: "string",
60
+ format: "date",
61
+ description: "Your date of birth",
62
+ },
63
+ integer: {
64
+ title: "Integer",
65
+ type: "integer",
66
+ description: "Your favorite integer (do not give us your phone number, pin, or other sensitive info)",
67
+ minimum: 1,
68
+ maximum: 100,
69
+ default: 42,
70
+ },
71
+ number: {
72
+ title: "Number in range 1-1000",
73
+ type: "number",
74
+ description: "Favorite number (there are no wrong answers)",
75
+ minimum: 0,
76
+ maximum: 1000,
77
+ default: 3.14,
78
+ },
79
+ untitledSingleSelectEnum: {
80
+ type: "string",
81
+ title: "Untitled Single Select Enum",
82
+ description: "Choose your favorite friend",
83
+ enum: ["Monica", "Rachel", "Joey", "Chandler", "Ross", "Phoebe"],
84
+ default: "Monica",
85
+ },
86
+ untitledMultipleSelectEnum: {
87
+ type: "array",
88
+ title: "Untitled Multiple Select Enum",
89
+ description: "Choose your favorite instruments",
90
+ minItems: 1,
91
+ maxItems: 3,
92
+ items: {
80
93
  type: "string",
81
- title: "Untitled Single Select Enum",
82
- description: "Choose your favorite friend",
83
- enum: ["Monica", "Rachel", "Joey", "Chandler", "Ross", "Phoebe"],
84
- default: "Monica",
85
- },
86
- untitledMultipleSelectEnum: {
87
- type: "array",
88
- title: "Untitled Multiple Select Enum",
89
- description: "Choose your favorite instruments",
90
- minItems: 1,
91
- maxItems: 3,
92
- items: {
93
- type: "string",
94
- enum: ["Guitar", "Piano", "Violin", "Drums", "Bass"],
95
- },
96
- default: ["Guitar"],
94
+ enum: ["Guitar", "Piano", "Violin", "Drums", "Bass"],
97
95
  },
98
- titledSingleSelectEnum: {
99
- type: "string",
100
- title: "Titled Single Select Enum",
101
- description: "Choose your favorite hero",
102
- oneOf: [
103
- { const: "hero-1", title: "Superman" },
104
- { const: "hero-2", title: "Green Lantern" },
105
- { const: "hero-3", title: "Wonder Woman" },
96
+ default: ["Guitar"],
97
+ },
98
+ titledSingleSelectEnum: {
99
+ type: "string",
100
+ title: "Titled Single Select Enum",
101
+ description: "Choose your favorite hero",
102
+ oneOf: [
103
+ { const: "hero-1", title: "Superman" },
104
+ { const: "hero-2", title: "Green Lantern" },
105
+ { const: "hero-3", title: "Wonder Woman" },
106
+ ],
107
+ default: "hero-1",
108
+ },
109
+ titledMultipleSelectEnum: {
110
+ type: "array",
111
+ title: "Titled Multiple Select Enum",
112
+ description: "Choose your favorite types of fish",
113
+ minItems: 1,
114
+ maxItems: 3,
115
+ items: {
116
+ anyOf: [
117
+ { const: "fish-1", title: "Tuna" },
118
+ { const: "fish-2", title: "Salmon" },
119
+ { const: "fish-3", title: "Trout" },
106
120
  ],
107
- default: "hero-1",
108
- },
109
- titledMultipleSelectEnum: {
110
- type: "array",
111
- title: "Titled Multiple Select Enum",
112
- description: "Choose your favorite types of fish",
113
- minItems: 1,
114
- maxItems: 3,
115
- items: {
116
- anyOf: [
117
- { const: "fish-1", title: "Tuna" },
118
- { const: "fish-2", title: "Salmon" },
119
- { const: "fish-3", title: "Trout" },
120
- ],
121
- },
122
- default: ["fish-1"],
123
- },
124
- legacyTitledEnum: {
125
- type: "string",
126
- title: "Legacy Titled Single Select Enum",
127
- description: "Choose your favorite type of pet",
128
- enum: ["pet-1", "pet-2", "pet-3", "pet-4", "pet-5"],
129
- enumNames: ["Cats", "Dogs", "Birds", "Fish", "Reptiles"],
130
- default: "pet-1",
131
121
  },
122
+ default: ["fish-1"],
123
+ },
124
+ legacyTitledEnum: {
125
+ type: "string",
126
+ title: "Legacy Titled Single Select Enum",
127
+ description: "Choose your favorite type of pet",
128
+ enum: ["pet-1", "pet-2", "pet-3", "pet-4", "pet-5"],
129
+ enumNames: ["Cats", "Dogs", "Birds", "Fish", "Reptiles"],
130
+ default: "pet-1",
132
131
  },
132
+ };
133
+ /** The form, as the elicitation request carries it. */
134
+ const requestedSchema = {
135
+ type: "object",
136
+ properties,
133
137
  required: ["name"],
134
138
  };
139
+ /**
140
+ * The label each field gets in the summary of an accepted form. Keyed by the
141
+ * form's own field names, so a field added to or removed from the form fails
142
+ * to compile until its label follows, and the summary cannot drift from the
143
+ * form again (#5209).
144
+ */
145
+ const summaryLabels = {
146
+ name: "Name",
147
+ check: "Agreed to terms",
148
+ firstLine: "Favorite first line",
149
+ email: "Email",
150
+ homepage: "Homepage",
151
+ birthdate: "Birthdate",
152
+ integer: "Favorite integer",
153
+ number: "Favorite number",
154
+ untitledSingleSelectEnum: "Favorite friend",
155
+ untitledMultipleSelectEnum: "Favorite instruments",
156
+ titledSingleSelectEnum: "Favorite hero",
157
+ titledMultipleSelectEnum: "Favorite fish",
158
+ legacyTitledEnum: "Favorite pet",
159
+ };
160
+ /**
161
+ * One summary line per form field the user answered, in the form's order.
162
+ * A field the form does not define is left out, whatever the client sent.
163
+ */
164
+ const summarize = (userData) => Object.keys(properties)
165
+ .filter((field) => userData[field] !== undefined)
166
+ .map((field) => {
167
+ const value = userData[field];
168
+ const shown = Array.isArray(value) ? value.join(", ") : String(value);
169
+ return `- ${summaryLabels[field]}: ${shown}`;
170
+ });
135
171
  /**
136
172
  * Registers the 'trigger-elicitation-request' tool.
137
173
  *
@@ -176,26 +212,7 @@ export const registerTriggerElicitationRequestTool = (server) => {
176
212
  text: `✅ User provided the requested information!`,
177
213
  });
178
214
  // Only access answer.content when action is accept
179
- const userData = answer.content;
180
- const lines = [];
181
- if (userData.name)
182
- lines.push(`- Name: ${userData.name}`);
183
- if (userData.check !== undefined)
184
- lines.push(`- Agreed to terms: ${userData.check}`);
185
- if (userData.color)
186
- lines.push(`- Favorite Color: ${userData.color}`);
187
- if (userData.email)
188
- lines.push(`- Email: ${userData.email}`);
189
- if (userData.homepage)
190
- lines.push(`- Homepage: ${userData.homepage}`);
191
- if (userData.birthdate)
192
- lines.push(`- Birthdate: ${userData.birthdate}`);
193
- if (userData.integer !== undefined)
194
- lines.push(`- Favorite Integer: ${userData.integer}`);
195
- if (userData.number !== undefined)
196
- lines.push(`- Favorite Number: ${userData.number}`);
197
- if (userData.petType)
198
- lines.push(`- Pet Type: ${userData.petType}`);
215
+ const lines = summarize(answer.content);
199
216
  content.push({
200
217
  type: "text",
201
218
  text: `User inputs:\n${lines.join("\n")}`,
@@ -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,
@@ -21,7 +24,7 @@ const config = {
21
24
  },
22
25
  };
23
26
  /**
24
- * Registers the 'trigger-tong-running-operation' tool.
27
+ * Registers the 'trigger-long-running-operation' tool.
25
28
  *
26
29
  * The registered tool starts a long-running operation defined by a specific duration and
27
30
  * number of steps.
@@ -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.0.1",
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",