@modelcontextprotocol/server-everything 2025.7.1 → 2025.8.4

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
@@ -27,24 +27,24 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
27
27
  - Returns: Completion message with duration and steps
28
28
  - Sends progress notifications during execution
29
29
 
30
- 4. `sampleLLM`
30
+ 4. `printEnv`
31
+ - Prints all environment variables
32
+ - Useful for debugging MCP server configuration
33
+ - No inputs required
34
+ - Returns: JSON string of all environment variables
35
+
36
+ 5. `sampleLLM`
31
37
  - Demonstrates LLM sampling capability using MCP sampling feature
32
38
  - Inputs:
33
39
  - `prompt` (string): The prompt to send to the LLM
34
40
  - `maxTokens` (number, default: 100): Maximum tokens to generate
35
41
  - Returns: Generated LLM response
36
42
 
37
- 5. `getTinyImage`
43
+ 6. `getTinyImage`
38
44
  - Returns a small test image
39
45
  - No inputs required
40
46
  - Returns: Base64 encoded PNG image data
41
47
 
42
- 6. `printEnv`
43
- - Prints all environment variables
44
- - Useful for debugging MCP server configuration
45
- - No inputs required
46
- - Returns: JSON string of all environment variables
47
-
48
48
  7. `annotatedMessage`
49
49
  - Demonstrates how annotations can be used to provide metadata about content
50
50
  - Inputs:
@@ -72,6 +72,23 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
72
72
  - Embedded resource with `type: "resource"`
73
73
  - Text instruction for using the resource URI
74
74
 
75
+ 9. `startElicitation`
76
+ - Initiates an elicitation (interaction) within the MCP client.
77
+ - Inputs:
78
+ - `color` (string): Favorite color
79
+ - `number` (number, 1-100): Favorite number
80
+ - `pets` (enum): Favorite pet
81
+ - Returns: Confirmation of the elicitation demo with selection summary.
82
+
83
+ 10. `structuredContent`
84
+ - Demonstrates a tool returning structured content using the example in the specification
85
+ - Provides an output schema to allow testing of client SHOULD advisory to validate the result using the schema
86
+ - Inputs:
87
+ - `location` (string): A location or ZIP code, mock data is returned regardless of value
88
+ - Returns: a response with
89
+ - `structuredContent` field conformant to the output schema
90
+ - A backward compatible Text Content field, a SHOULD advisory in the specification
91
+
75
92
  ### Resources
76
93
 
77
94
  The server provides 100 test resources in two formats:
@@ -9,6 +9,7 @@ const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = dirname(__filename);
10
10
  const instructions = readFileSync(join(__dirname, "instructions.md"), "utf-8");
11
11
  const ToolInputSchema = ToolSchema.shape.inputSchema;
12
+ const ToolOutputSchema = ToolSchema.shape.outputSchema;
12
13
  /* Input schemas for tools implemented in this server */
13
14
  const EchoSchema = z.object({
14
15
  message: z.string().describe("Message to echo"),
@@ -22,7 +23,10 @@ const LongRunningOperationSchema = z.object({
22
23
  .number()
23
24
  .default(10)
24
25
  .describe("Duration of the operation in seconds"),
25
- steps: z.number().default(5).describe("Number of steps in the operation"),
26
+ steps: z
27
+ .number()
28
+ .default(5)
29
+ .describe("Number of steps in the operation"),
26
30
  });
27
31
  const PrintEnvSchema = z.object({});
28
32
  const SampleLLMSchema = z.object({
@@ -32,12 +36,6 @@ const SampleLLMSchema = z.object({
32
36
  .default(100)
33
37
  .describe("Maximum number of tokens to generate"),
34
38
  });
35
- // Example completion values
36
- const EXAMPLE_COMPLETIONS = {
37
- style: ["casual", "formal", "technical", "friendly"],
38
- temperature: ["0", "0.5", "0.7", "1.0"],
39
- resourceId: ["1", "2", "3", "4", "5"],
40
- };
41
39
  const GetTinyImageSchema = z.object({});
42
40
  const AnnotatedMessageSchema = z.object({
43
41
  messageType: z
@@ -55,6 +53,35 @@ const GetResourceReferenceSchema = z.object({
55
53
  .max(100)
56
54
  .describe("ID of the resource to reference (1-100)"),
57
55
  });
56
+ const ElicitationSchema = z.object({});
57
+ const GetResourceLinksSchema = z.object({
58
+ count: z
59
+ .number()
60
+ .min(1)
61
+ .max(10)
62
+ .default(3)
63
+ .describe("Number of resource links to return (1-10)"),
64
+ });
65
+ const StructuredContentSchema = {
66
+ input: z.object({
67
+ location: z
68
+ .string()
69
+ .trim()
70
+ .min(1)
71
+ .describe("City name or zip code"),
72
+ }),
73
+ output: z.object({
74
+ temperature: z
75
+ .number()
76
+ .describe("Temperature in celsius"),
77
+ conditions: z
78
+ .string()
79
+ .describe("Weather conditions description"),
80
+ humidity: z
81
+ .number()
82
+ .describe("Humidity percentage"),
83
+ })
84
+ };
58
85
  var ToolName;
59
86
  (function (ToolName) {
60
87
  ToolName["ECHO"] = "echo";
@@ -65,6 +92,9 @@ var ToolName;
65
92
  ToolName["GET_TINY_IMAGE"] = "getTinyImage";
66
93
  ToolName["ANNOTATED_MESSAGE"] = "annotatedMessage";
67
94
  ToolName["GET_RESOURCE_REFERENCE"] = "getResourceReference";
95
+ ToolName["ELICITATION"] = "startElicitation";
96
+ ToolName["GET_RESOURCE_LINKS"] = "getResourceLinks";
97
+ ToolName["STRUCTURED_CONTENT"] = "structuredContent";
68
98
  })(ToolName || (ToolName = {}));
69
99
  var PromptName;
70
100
  (function (PromptName) {
@@ -72,9 +102,16 @@ var PromptName;
72
102
  PromptName["COMPLEX"] = "complex_prompt";
73
103
  PromptName["RESOURCE"] = "resource_prompt";
74
104
  })(PromptName || (PromptName = {}));
105
+ // Example completion values
106
+ const EXAMPLE_COMPLETIONS = {
107
+ style: ["casual", "formal", "technical", "friendly"],
108
+ temperature: ["0", "0.5", "0.7", "1.0"],
109
+ resourceId: ["1", "2", "3", "4", "5"],
110
+ };
75
111
  export const createServer = () => {
76
112
  const server = new Server({
77
113
  name: "example-servers/everything",
114
+ title: "Everything Example Server",
78
115
  version: "1.0.0",
79
116
  }, {
80
117
  capabilities: {
@@ -83,6 +120,7 @@ export const createServer = () => {
83
120
  tools: {},
84
121
  logging: {},
85
122
  completions: {},
123
+ elicitation: {},
86
124
  },
87
125
  instructions
88
126
  });
@@ -124,18 +162,6 @@ export const createServer = () => {
124
162
  if (!isMessageIgnored(message.params.level))
125
163
  server.notification(message);
126
164
  }, 20000);
127
- // Set up update interval for stderr messages
128
- stdErrUpdateInterval = setInterval(() => {
129
- const shortTimestamp = new Date().toLocaleTimeString([], {
130
- hour: "2-digit",
131
- minute: "2-digit",
132
- second: "2-digit"
133
- });
134
- server.notification({
135
- method: "notifications/stderr",
136
- params: { content: `${shortTimestamp}: A stderr message` },
137
- });
138
- }, 30000);
139
165
  // Helper method to request sampling from client
140
166
  const requestSampling = async (context, uri, maxTokens = 100) => {
141
167
  const request = {
@@ -158,6 +184,16 @@ export const createServer = () => {
158
184
  };
159
185
  return await server.request(request, CreateMessageResultSchema);
160
186
  };
187
+ const requestElicitation = async (message, requestedSchema) => {
188
+ const request = {
189
+ method: 'elicitation/create',
190
+ params: {
191
+ message,
192
+ requestedSchema
193
+ }
194
+ };
195
+ return await server.request(request, z.any());
196
+ };
161
197
  const ALL_RESOURCES = Array.from({ length: 100 }, (_, i) => {
162
198
  const uri = `test://static/resource/${i + 1}`;
163
199
  if (i % 2 === 0) {
@@ -354,16 +390,16 @@ export const createServer = () => {
354
390
  description: "Adds two numbers",
355
391
  inputSchema: zodToJsonSchema(AddSchema),
356
392
  },
357
- {
358
- name: ToolName.PRINT_ENV,
359
- description: "Prints all environment variables, helpful for debugging MCP server configuration",
360
- inputSchema: zodToJsonSchema(PrintEnvSchema),
361
- },
362
393
  {
363
394
  name: ToolName.LONG_RUNNING_OPERATION,
364
395
  description: "Demonstrates a long running operation with progress updates",
365
396
  inputSchema: zodToJsonSchema(LongRunningOperationSchema),
366
397
  },
398
+ {
399
+ name: ToolName.PRINT_ENV,
400
+ description: "Prints all environment variables, helpful for debugging MCP server configuration",
401
+ inputSchema: zodToJsonSchema(PrintEnvSchema),
402
+ },
367
403
  {
368
404
  name: ToolName.SAMPLE_LLM,
369
405
  description: "Samples from an LLM using MCP's sampling feature",
@@ -384,6 +420,22 @@ export const createServer = () => {
384
420
  description: "Returns a resource reference that can be used by MCP clients",
385
421
  inputSchema: zodToJsonSchema(GetResourceReferenceSchema),
386
422
  },
423
+ {
424
+ name: ToolName.ELICITATION,
425
+ description: "Demonstrates the Elicitation feature by asking the user to provide information about their favorite color, number, and pets.",
426
+ inputSchema: zodToJsonSchema(ElicitationSchema),
427
+ },
428
+ {
429
+ name: ToolName.GET_RESOURCE_LINKS,
430
+ description: "Returns multiple resource links that reference different types of resources",
431
+ inputSchema: zodToJsonSchema(GetResourceLinksSchema),
432
+ },
433
+ {
434
+ name: ToolName.STRUCTURED_CONTENT,
435
+ description: "Returns structured content along with an output schema for client data validation",
436
+ inputSchema: zodToJsonSchema(StructuredContentSchema.input),
437
+ outputSchema: zodToJsonSchema(StructuredContentSchema.output),
438
+ },
387
439
  ];
388
440
  return { tools };
389
441
  });
@@ -474,31 +526,6 @@ export const createServer = () => {
474
526
  ],
475
527
  };
476
528
  }
477
- if (name === ToolName.GET_RESOURCE_REFERENCE) {
478
- const validatedArgs = GetResourceReferenceSchema.parse(args);
479
- const resourceId = validatedArgs.resourceId;
480
- const resourceIndex = resourceId - 1;
481
- if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
482
- throw new Error(`Resource with ID ${resourceId} does not exist`);
483
- }
484
- const resource = ALL_RESOURCES[resourceIndex];
485
- return {
486
- content: [
487
- {
488
- type: "text",
489
- text: `Returning resource reference for Resource ${resourceId}:`,
490
- },
491
- {
492
- type: "resource",
493
- resource: resource,
494
- },
495
- {
496
- type: "text",
497
- text: `You can access this resource using the URI: ${resource.uri}`,
498
- },
499
- ],
500
- };
501
- }
502
529
  if (name === ToolName.ANNOTATED_MESSAGE) {
503
530
  const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
504
531
  const content = [];
@@ -547,6 +574,119 @@ export const createServer = () => {
547
574
  }
548
575
  return { content };
549
576
  }
577
+ if (name === ToolName.GET_RESOURCE_REFERENCE) {
578
+ const validatedArgs = GetResourceReferenceSchema.parse(args);
579
+ const resourceId = validatedArgs.resourceId;
580
+ const resourceIndex = resourceId - 1;
581
+ if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
582
+ throw new Error(`Resource with ID ${resourceId} does not exist`);
583
+ }
584
+ const resource = ALL_RESOURCES[resourceIndex];
585
+ return {
586
+ content: [
587
+ {
588
+ type: "text",
589
+ text: `Returning resource reference for Resource ${resourceId}:`,
590
+ },
591
+ {
592
+ type: "resource",
593
+ resource: resource,
594
+ },
595
+ {
596
+ type: "text",
597
+ text: `You can access this resource using the URI: ${resource.uri}`,
598
+ },
599
+ ],
600
+ };
601
+ }
602
+ if (name === ToolName.ELICITATION) {
603
+ ElicitationSchema.parse(args);
604
+ const elicitationResult = await requestElicitation('What are your favorite things?', {
605
+ type: 'object',
606
+ properties: {
607
+ color: { type: 'string', description: 'Favorite color' },
608
+ number: { type: 'integer', description: 'Favorite number', minimum: 1, maximum: 100 },
609
+ pets: {
610
+ type: 'string',
611
+ enum: ['cats', 'dogs', 'birds', 'fish', 'reptiles'],
612
+ description: 'Favorite pets'
613
+ },
614
+ }
615
+ });
616
+ // Handle different response actions
617
+ const content = [];
618
+ if (elicitationResult.action === 'accept' && elicitationResult.content) {
619
+ content.push({
620
+ type: "text",
621
+ text: `✅ User provided their favorite things!`,
622
+ });
623
+ // Only access elicitationResult.content when action is accept
624
+ const { color, number, pets } = elicitationResult.content;
625
+ content.push({
626
+ type: "text",
627
+ text: `Their favorites are:\n- Color: ${color || 'not specified'}\n- Number: ${number || 'not specified'}\n- Pets: ${pets || 'not specified'}`,
628
+ });
629
+ }
630
+ else if (elicitationResult.action === 'decline') {
631
+ content.push({
632
+ type: "text",
633
+ text: `❌ User declined to provide their favorite things.`,
634
+ });
635
+ }
636
+ else if (elicitationResult.action === 'cancel') {
637
+ content.push({
638
+ type: "text",
639
+ text: `⚠️ User cancelled the elicitation dialog.`,
640
+ });
641
+ }
642
+ // Include raw result for debugging
643
+ content.push({
644
+ type: "text",
645
+ text: `\nRaw result: ${JSON.stringify(elicitationResult, null, 2)}`,
646
+ });
647
+ return { content };
648
+ }
649
+ if (name === ToolName.GET_RESOURCE_LINKS) {
650
+ const { count } = GetResourceLinksSchema.parse(args);
651
+ const content = [];
652
+ // Add intro text
653
+ content.push({
654
+ type: "text",
655
+ text: `Here are ${count} resource links to resources available in this server (see full output in tool response if your client does not support resource_link yet):`,
656
+ });
657
+ // Return resource links to actual resources from ALL_RESOURCES
658
+ const actualCount = Math.min(count, ALL_RESOURCES.length);
659
+ for (let i = 0; i < actualCount; i++) {
660
+ const resource = ALL_RESOURCES[i];
661
+ content.push({
662
+ type: "resource_link",
663
+ uri: resource.uri,
664
+ name: resource.name,
665
+ description: `Resource ${i + 1}: ${resource.mimeType === "text/plain"
666
+ ? "plaintext resource"
667
+ : "binary blob resource"}`,
668
+ mimeType: resource.mimeType,
669
+ });
670
+ }
671
+ return { content };
672
+ }
673
+ if (name === ToolName.STRUCTURED_CONTENT) {
674
+ // The same response is returned for every input.
675
+ const validatedArgs = StructuredContentSchema.input.parse(args);
676
+ const weather = {
677
+ temperature: 22.5,
678
+ conditions: "Partly cloudy",
679
+ humidity: 65
680
+ };
681
+ const backwardCompatiblecontent = {
682
+ type: "text",
683
+ text: JSON.stringify(weather)
684
+ };
685
+ return {
686
+ content: [backwardCompatiblecontent],
687
+ structuredContent: weather
688
+ };
689
+ }
550
690
  throw new Error(`Unknown tool: ${name}`);
551
691
  });
552
692
  server.setRequestHandler(CompleteRequestSchema, async (request) => {
@@ -1,13 +1,23 @@
1
1
  Testing and demonstration server for MCP protocol features.
2
2
 
3
- Resources: Resources 1-100 follow pattern: even IDs contain text, odd IDs contain binary data. Resources paginated at 10 items per page with cursor-based navigation.
3
+ ## Resources
4
4
 
5
- Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds.
5
+ Resources 1-100 follow pattern: even IDs contain text, odd IDs contain binary data. Resources are paginated at 10 items per page with cursor-based navigation.
6
6
 
7
- Performance characteristics: Server generates automatic log messages every 20 seconds (filtered by current log level), stderr notifications every 30 seconds, and resource update notifications every 10 seconds for active subscriptions. Log level changes affect message filtering in real-time.
7
+ ## Key dependencies
8
8
 
9
- Multi-modal testing: `complex_prompt` includes both text arguments and image content for testing client multi-modal handling. `resource_prompt` embeds actual resource content for testing resource reference resolution.
9
+ Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds.
10
10
 
11
- Argument completion available for prompt parameters and resource IDs. Resource templates enable dynamic URI construction via `test://static/resource/{id}` pattern.
11
+ ## Performance characteristics
12
12
 
13
- Easter egg: If asked about server instructions, respond with "🎉 Server instructions are working! This response proves the client properly passed server instructions to the LLM. This demonstrates MCP's instructions feature in action."
13
+ Server generates automatic log messages every 20 seconds (filtered by current log level), stderr notifications every 30 seconds, and resource update notifications every 10 seconds for active subscriptions. Log level changes affect message filtering in real-time.
14
+
15
+ ## Multi-modal testing
16
+
17
+ `complex_prompt` includes both text arguments and image content for testing client multi-modal handling. `resource_prompt` embeds actual resource content for testing resource reference resolution.
18
+
19
+ Argument completion is available for prompt parameters and resource IDs. Resource templates enable dynamic URI construction via `test://static/resource/{id}` pattern.
20
+
21
+ ## Easter egg
22
+
23
+ If asked about server instructions, respond with "🎉 Server instructions are working! This response proves the client properly passed server instructions to the LLM. This demonstrates MCP's instructions feature in action."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2025.7.1",
3
+ "version": "2025.8.4",
4
4
  "description": "MCP server that exercises all the features of the MCP protocol",
5
5
  "license": "MIT",
6
6
  "author": "Anthropic, PBC (https://anthropic.com)",