@modelcontextprotocol/server-everything 2025.7.1 → 2025.7.29

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
  });
@@ -158,6 +196,16 @@ export const createServer = () => {
158
196
  };
159
197
  return await server.request(request, CreateMessageResultSchema);
160
198
  };
199
+ const requestElicitation = async (message, requestedSchema) => {
200
+ const request = {
201
+ method: 'elicitation/create',
202
+ params: {
203
+ message,
204
+ requestedSchema
205
+ }
206
+ };
207
+ return await server.request(request, z.any());
208
+ };
161
209
  const ALL_RESOURCES = Array.from({ length: 100 }, (_, i) => {
162
210
  const uri = `test://static/resource/${i + 1}`;
163
211
  if (i % 2 === 0) {
@@ -354,16 +402,16 @@ export const createServer = () => {
354
402
  description: "Adds two numbers",
355
403
  inputSchema: zodToJsonSchema(AddSchema),
356
404
  },
357
- {
358
- name: ToolName.PRINT_ENV,
359
- description: "Prints all environment variables, helpful for debugging MCP server configuration",
360
- inputSchema: zodToJsonSchema(PrintEnvSchema),
361
- },
362
405
  {
363
406
  name: ToolName.LONG_RUNNING_OPERATION,
364
407
  description: "Demonstrates a long running operation with progress updates",
365
408
  inputSchema: zodToJsonSchema(LongRunningOperationSchema),
366
409
  },
410
+ {
411
+ name: ToolName.PRINT_ENV,
412
+ description: "Prints all environment variables, helpful for debugging MCP server configuration",
413
+ inputSchema: zodToJsonSchema(PrintEnvSchema),
414
+ },
367
415
  {
368
416
  name: ToolName.SAMPLE_LLM,
369
417
  description: "Samples from an LLM using MCP's sampling feature",
@@ -384,6 +432,22 @@ export const createServer = () => {
384
432
  description: "Returns a resource reference that can be used by MCP clients",
385
433
  inputSchema: zodToJsonSchema(GetResourceReferenceSchema),
386
434
  },
435
+ {
436
+ name: ToolName.ELICITATION,
437
+ description: "Demonstrates the Elicitation feature by asking the user to provide information about their favorite color, number, and pets.",
438
+ inputSchema: zodToJsonSchema(ElicitationSchema),
439
+ },
440
+ {
441
+ name: ToolName.GET_RESOURCE_LINKS,
442
+ description: "Returns multiple resource links that reference different types of resources",
443
+ inputSchema: zodToJsonSchema(GetResourceLinksSchema),
444
+ },
445
+ {
446
+ name: ToolName.STRUCTURED_CONTENT,
447
+ description: "Returns structured content along with an output schema for client data validation",
448
+ inputSchema: zodToJsonSchema(StructuredContentSchema.input),
449
+ outputSchema: zodToJsonSchema(StructuredContentSchema.output),
450
+ },
387
451
  ];
388
452
  return { tools };
389
453
  });
@@ -474,31 +538,6 @@ export const createServer = () => {
474
538
  ],
475
539
  };
476
540
  }
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
541
  if (name === ToolName.ANNOTATED_MESSAGE) {
503
542
  const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
504
543
  const content = [];
@@ -547,6 +586,119 @@ export const createServer = () => {
547
586
  }
548
587
  return { content };
549
588
  }
589
+ if (name === ToolName.GET_RESOURCE_REFERENCE) {
590
+ const validatedArgs = GetResourceReferenceSchema.parse(args);
591
+ const resourceId = validatedArgs.resourceId;
592
+ const resourceIndex = resourceId - 1;
593
+ if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
594
+ throw new Error(`Resource with ID ${resourceId} does not exist`);
595
+ }
596
+ const resource = ALL_RESOURCES[resourceIndex];
597
+ return {
598
+ content: [
599
+ {
600
+ type: "text",
601
+ text: `Returning resource reference for Resource ${resourceId}:`,
602
+ },
603
+ {
604
+ type: "resource",
605
+ resource: resource,
606
+ },
607
+ {
608
+ type: "text",
609
+ text: `You can access this resource using the URI: ${resource.uri}`,
610
+ },
611
+ ],
612
+ };
613
+ }
614
+ if (name === ToolName.ELICITATION) {
615
+ ElicitationSchema.parse(args);
616
+ const elicitationResult = await requestElicitation('What are your favorite things?', {
617
+ type: 'object',
618
+ properties: {
619
+ color: { type: 'string', description: 'Favorite color' },
620
+ number: { type: 'integer', description: 'Favorite number', minimum: 1, maximum: 100 },
621
+ pets: {
622
+ type: 'string',
623
+ enum: ['cats', 'dogs', 'birds', 'fish', 'reptiles'],
624
+ description: 'Favorite pets'
625
+ },
626
+ }
627
+ });
628
+ // Handle different response actions
629
+ const content = [];
630
+ if (elicitationResult.action === 'accept' && elicitationResult.content) {
631
+ content.push({
632
+ type: "text",
633
+ text: `✅ User provided their favorite things!`,
634
+ });
635
+ // Only access elicitationResult.content when action is accept
636
+ const { color, number, pets } = elicitationResult.content;
637
+ content.push({
638
+ type: "text",
639
+ text: `Their favorites are:\n- Color: ${color || 'not specified'}\n- Number: ${number || 'not specified'}\n- Pets: ${pets || 'not specified'}`,
640
+ });
641
+ }
642
+ else if (elicitationResult.action === 'decline') {
643
+ content.push({
644
+ type: "text",
645
+ text: `❌ User declined to provide their favorite things.`,
646
+ });
647
+ }
648
+ else if (elicitationResult.action === 'cancel') {
649
+ content.push({
650
+ type: "text",
651
+ text: `⚠️ User cancelled the elicitation dialog.`,
652
+ });
653
+ }
654
+ // Include raw result for debugging
655
+ content.push({
656
+ type: "text",
657
+ text: `\nRaw result: ${JSON.stringify(elicitationResult, null, 2)}`,
658
+ });
659
+ return { content };
660
+ }
661
+ if (name === ToolName.GET_RESOURCE_LINKS) {
662
+ const { count } = GetResourceLinksSchema.parse(args);
663
+ const content = [];
664
+ // Add intro text
665
+ content.push({
666
+ type: "text",
667
+ 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):`,
668
+ });
669
+ // Return resource links to actual resources from ALL_RESOURCES
670
+ const actualCount = Math.min(count, ALL_RESOURCES.length);
671
+ for (let i = 0; i < actualCount; i++) {
672
+ const resource = ALL_RESOURCES[i];
673
+ content.push({
674
+ type: "resource_link",
675
+ uri: resource.uri,
676
+ name: resource.name,
677
+ description: `Resource ${i + 1}: ${resource.mimeType === "text/plain"
678
+ ? "plaintext resource"
679
+ : "binary blob resource"}`,
680
+ mimeType: resource.mimeType,
681
+ });
682
+ }
683
+ return { content };
684
+ }
685
+ if (name === ToolName.STRUCTURED_CONTENT) {
686
+ // The same response is returned for every input.
687
+ const validatedArgs = StructuredContentSchema.input.parse(args);
688
+ const weather = {
689
+ temperature: 22.5,
690
+ conditions: "Partly cloudy",
691
+ humidity: 65
692
+ };
693
+ const backwardCompatiblecontent = {
694
+ type: "text",
695
+ text: JSON.stringify(weather)
696
+ };
697
+ return {
698
+ content: [backwardCompatiblecontent],
699
+ structuredContent: weather
700
+ };
701
+ }
550
702
  throw new Error(`Unknown tool: ${name}`);
551
703
  });
552
704
  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.7.29",
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)",