@modelcontextprotocol/server-everything 2025.3.19 → 2025.4.8

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
@@ -63,6 +63,15 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
63
63
  }
64
64
  ```
65
65
 
66
+ 8. `getResourceReference`
67
+ - Returns a resource reference that can be used by MCP clients
68
+ - Inputs:
69
+ - `resourceId` (number, 1-100): ID of the resource to reference
70
+ - Returns: A resource reference with:
71
+ - Text introduction
72
+ - Embedded resource with `type: "resource"`
73
+ - Text instruction for using the resource URI
74
+
66
75
  ### Resources
67
76
 
68
77
  The server provides 100 test resources in two formats:
@@ -96,6 +105,13 @@ Resource features:
96
105
  - `style` (string): Output style preference
97
106
  - Returns: Multi-turn conversation with images
98
107
 
108
+ 3. `resource_prompt`
109
+ - Demonstrates embedding resource references in prompts
110
+ - Required arguments:
111
+ - `resourceId` (number): ID of the resource to embed (1-100)
112
+ - Returns: Multi-turn conversation with an embedded resource reference
113
+ - Shows how to include resources directly in prompt messages
114
+
99
115
  ### Logging
100
116
 
101
117
  The server sends random-leveled log messages every 15 seconds, e.g.:
@@ -34,10 +34,20 @@ const EXAMPLE_COMPLETIONS = {
34
34
  };
35
35
  const GetTinyImageSchema = z.object({});
36
36
  const AnnotatedMessageSchema = z.object({
37
- messageType: z.enum(["error", "success", "debug"])
37
+ messageType: z
38
+ .enum(["error", "success", "debug"])
38
39
  .describe("Type of message to demonstrate different annotation patterns"),
39
- includeImage: z.boolean().default(false)
40
- .describe("Whether to include an example image")
40
+ includeImage: z
41
+ .boolean()
42
+ .default(false)
43
+ .describe("Whether to include an example image"),
44
+ });
45
+ const GetResourceReferenceSchema = z.object({
46
+ resourceId: z
47
+ .number()
48
+ .min(1)
49
+ .max(100)
50
+ .describe("ID of the resource to reference (1-100)"),
41
51
  });
42
52
  var ToolName;
43
53
  (function (ToolName) {
@@ -48,11 +58,13 @@ var ToolName;
48
58
  ToolName["SAMPLE_LLM"] = "sampleLLM";
49
59
  ToolName["GET_TINY_IMAGE"] = "getTinyImage";
50
60
  ToolName["ANNOTATED_MESSAGE"] = "annotatedMessage";
61
+ ToolName["GET_RESOURCE_REFERENCE"] = "getResourceReference";
51
62
  })(ToolName || (ToolName = {}));
52
63
  var PromptName;
53
64
  (function (PromptName) {
54
65
  PromptName["SIMPLE"] = "simple_prompt";
55
66
  PromptName["COMPLEX"] = "complex_prompt";
67
+ PromptName["RESOURCE"] = "resource_prompt";
56
68
  })(PromptName || (PromptName = {}));
57
69
  export const createServer = () => {
58
70
  const server = new Server({
@@ -87,7 +99,7 @@ export const createServer = () => {
87
99
  { level: "error", data: "Error-level message" },
88
100
  { level: "critical", data: "Critical-level message" },
89
101
  { level: "alert", data: "Alert level-message" },
90
- { level: "emergency", data: "Emergency-level message" }
102
+ { level: "emergency", data: "Emergency-level message" },
91
103
  ];
92
104
  const isMessageIgnored = (level) => {
93
105
  const currentLevel = messages.findIndex((msg) => logLevel === msg.level);
@@ -224,6 +236,17 @@ export const createServer = () => {
224
236
  },
225
237
  ],
226
238
  },
239
+ {
240
+ name: PromptName.RESOURCE,
241
+ description: "A prompt that includes an embedded resource reference",
242
+ arguments: [
243
+ {
244
+ name: "resourceId",
245
+ description: "Resource ID to include (1-100)",
246
+ required: true,
247
+ },
248
+ ],
249
+ },
227
250
  ],
228
251
  };
229
252
  });
@@ -270,6 +293,32 @@ export const createServer = () => {
270
293
  ],
271
294
  };
272
295
  }
296
+ if (name === PromptName.RESOURCE) {
297
+ const resourceId = parseInt(args?.resourceId, 10);
298
+ if (isNaN(resourceId) || resourceId < 1 || resourceId > 100) {
299
+ throw new Error(`Invalid resourceId: ${args?.resourceId}. Must be a number between 1 and 100.`);
300
+ }
301
+ const resourceIndex = resourceId - 1;
302
+ const resource = ALL_RESOURCES[resourceIndex];
303
+ return {
304
+ messages: [
305
+ {
306
+ role: "user",
307
+ content: {
308
+ type: "text",
309
+ text: `This prompt includes Resource ${resourceId}. Please analyze the following resource:`,
310
+ },
311
+ },
312
+ {
313
+ role: "user",
314
+ content: {
315
+ type: "resource",
316
+ resource: resource,
317
+ },
318
+ },
319
+ ],
320
+ };
321
+ }
273
322
  throw new Error(`Unknown prompt: ${name}`);
274
323
  });
275
324
  server.setRequestHandler(ListToolsRequestSchema, async () => {
@@ -309,6 +358,11 @@ export const createServer = () => {
309
358
  description: "Demonstrates how annotations can be used to provide metadata about content",
310
359
  inputSchema: zodToJsonSchema(AnnotatedMessageSchema),
311
360
  },
361
+ {
362
+ name: ToolName.GET_RESOURCE_REFERENCE,
363
+ description: "Returns a resource reference that can be used by MCP clients",
364
+ inputSchema: zodToJsonSchema(GetResourceReferenceSchema),
365
+ },
312
366
  ];
313
367
  return { tools };
314
368
  });
@@ -374,7 +428,9 @@ export const createServer = () => {
374
428
  const { prompt, maxTokens } = validatedArgs;
375
429
  const result = await requestSampling(prompt, ToolName.SAMPLE_LLM, maxTokens);
376
430
  return {
377
- content: [{ type: "text", text: `LLM sampling result: ${result.content.text}` }],
431
+ content: [
432
+ { type: "text", text: `LLM sampling result: ${result.content.text}` },
433
+ ],
378
434
  };
379
435
  }
380
436
  if (name === ToolName.GET_TINY_IMAGE) {
@@ -397,6 +453,31 @@ export const createServer = () => {
397
453
  ],
398
454
  };
399
455
  }
456
+ if (name === ToolName.GET_RESOURCE_REFERENCE) {
457
+ const validatedArgs = GetResourceReferenceSchema.parse(args);
458
+ const resourceId = validatedArgs.resourceId;
459
+ const resourceIndex = resourceId - 1;
460
+ if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
461
+ throw new Error(`Resource with ID ${resourceId} does not exist`);
462
+ }
463
+ const resource = ALL_RESOURCES[resourceIndex];
464
+ return {
465
+ content: [
466
+ {
467
+ type: "text",
468
+ text: `Returning resource reference for Resource ${resourceId}:`,
469
+ },
470
+ {
471
+ type: "resource",
472
+ resource: resource,
473
+ },
474
+ {
475
+ type: "text",
476
+ text: `You can access this resource using the URI: ${resource.uri}`,
477
+ },
478
+ ],
479
+ };
480
+ }
400
481
  if (name === ToolName.ANNOTATED_MESSAGE) {
401
482
  const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
402
483
  const content = [];
@@ -407,8 +488,8 @@ export const createServer = () => {
407
488
  text: "Error: Operation failed",
408
489
  annotations: {
409
490
  priority: 1.0, // Errors are highest priority
410
- audience: ["user", "assistant"] // Both need to know about errors
411
- }
491
+ audience: ["user", "assistant"], // Both need to know about errors
492
+ },
412
493
  });
413
494
  }
414
495
  else if (messageType === "success") {
@@ -417,8 +498,8 @@ export const createServer = () => {
417
498
  text: "Operation completed successfully",
418
499
  annotations: {
419
500
  priority: 0.7, // Success messages are important but not critical
420
- audience: ["user"] // Success mainly for user consumption
421
- }
501
+ audience: ["user"], // Success mainly for user consumption
502
+ },
422
503
  });
423
504
  }
424
505
  else if (messageType === "debug") {
@@ -427,8 +508,8 @@ export const createServer = () => {
427
508
  text: "Debug: Cache hit ratio 0.95, latency 150ms",
428
509
  annotations: {
429
510
  priority: 0.3, // Debug info is low priority
430
- audience: ["assistant"] // Technical details for assistant
431
- }
511
+ audience: ["assistant"], // Technical details for assistant
512
+ },
432
513
  });
433
514
  }
434
515
  // Optional image with its own annotations
@@ -439,8 +520,8 @@ export const createServer = () => {
439
520
  mimeType: "image/png",
440
521
  annotations: {
441
522
  priority: 0.5,
442
- audience: ["user"] // Images primarily for user visualization
443
- }
523
+ audience: ["user"], // Images primarily for user visualization
524
+ },
444
525
  });
445
526
  }
446
527
  return { content };
@@ -454,7 +535,7 @@ export const createServer = () => {
454
535
  if (!resourceId)
455
536
  return { completion: { values: [] } };
456
537
  // Filter resource IDs that start with the input value
457
- const values = EXAMPLE_COMPLETIONS.resourceId.filter(id => id.startsWith(argument.value));
538
+ const values = EXAMPLE_COMPLETIONS.resourceId.filter((id) => id.startsWith(argument.value));
458
539
  return { completion: { values, hasMore: false, total: values.length } };
459
540
  }
460
541
  if (ref.type === "ref/prompt") {
@@ -462,7 +543,7 @@ export const createServer = () => {
462
543
  const completions = EXAMPLE_COMPLETIONS[argument.name];
463
544
  if (!completions)
464
545
  return { completion: { values: [] } };
465
- const values = completions.filter(value => value.startsWith(argument.value));
546
+ const values = completions.filter((value) => value.startsWith(argument.value));
466
547
  return { completion: { values, hasMore: false, total: values.length } };
467
548
  }
468
549
  throw new Error(`Unknown reference type`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2025.3.19",
3
+ "version": "2025.4.8",
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)",