@modelcontextprotocol/server-everything 2025.1.14 → 2025.3.19

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
@@ -45,6 +45,24 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
45
45
  - No inputs required
46
46
  - Returns: JSON string of all environment variables
47
47
 
48
+ 7. `annotatedMessage`
49
+ - Demonstrates how annotations can be used to provide metadata about content
50
+ - Inputs:
51
+ - `messageType` (enum: "error" | "success" | "debug"): Type of message to demonstrate different annotation patterns
52
+ - `includeImage` (boolean, default: false): Whether to include an example image
53
+ - Returns: Content with varying annotations:
54
+ - Error messages: High priority (1.0), visible to both user and assistant
55
+ - Success messages: Medium priority (0.7), user-focused
56
+ - Debug messages: Low priority (0.3), assistant-focused
57
+ - Optional image: Medium priority (0.5), user-focused
58
+ - Example annotations:
59
+ ```json
60
+ {
61
+ "priority": 1.0,
62
+ "audience": ["user", "assistant"]
63
+ }
64
+ ```
65
+
48
66
  ### Resources
49
67
 
50
68
  The server provides 100 test resources in two formats:
@@ -78,6 +96,20 @@ Resource features:
78
96
  - `style` (string): Output style preference
79
97
  - Returns: Multi-turn conversation with images
80
98
 
99
+ ### Logging
100
+
101
+ The server sends random-leveled log messages every 15 seconds, e.g.:
102
+
103
+ ```json
104
+ {
105
+ "method": "notifications/message",
106
+ "params": {
107
+ "level": "info",
108
+ "data": "Info-level message"
109
+ }
110
+ }
111
+ ```
112
+
81
113
  ## Usage with Claude Desktop
82
114
 
83
115
  Add to your `claude_desktop_config.json`:
@@ -33,6 +33,12 @@ const EXAMPLE_COMPLETIONS = {
33
33
  resourceId: ["1", "2", "3", "4", "5"],
34
34
  };
35
35
  const GetTinyImageSchema = z.object({});
36
+ const AnnotatedMessageSchema = z.object({
37
+ messageType: z.enum(["error", "success", "debug"])
38
+ .describe("Type of message to demonstrate different annotation patterns"),
39
+ includeImage: z.boolean().default(false)
40
+ .describe("Whether to include an example image")
41
+ });
36
42
  var ToolName;
37
43
  (function (ToolName) {
38
44
  ToolName["ECHO"] = "echo";
@@ -41,6 +47,7 @@ var ToolName;
41
47
  ToolName["PRINT_ENV"] = "printEnv";
42
48
  ToolName["SAMPLE_LLM"] = "sampleLLM";
43
49
  ToolName["GET_TINY_IMAGE"] = "getTinyImage";
50
+ ToolName["ANNOTATED_MESSAGE"] = "annotatedMessage";
44
51
  })(ToolName || (ToolName = {}));
45
52
  var PromptName;
46
53
  (function (PromptName) {
@@ -60,9 +67,9 @@ export const createServer = () => {
60
67
  },
61
68
  });
62
69
  let subscriptions = new Set();
63
- let updateInterval;
70
+ let subsUpdateInterval;
64
71
  // Set up update interval for subscribed resources
65
- updateInterval = setInterval(() => {
72
+ subsUpdateInterval = setInterval(() => {
66
73
  for (const uri of subscriptions) {
67
74
  server.notification({
68
75
  method: "notifications/resources/updated",
@@ -70,6 +77,32 @@ export const createServer = () => {
70
77
  });
71
78
  }
72
79
  }, 5000);
80
+ let logLevel = "debug";
81
+ let logsUpdateInterval;
82
+ const messages = [
83
+ { level: "debug", data: "Debug-level message" },
84
+ { level: "info", data: "Info-level message" },
85
+ { level: "notice", data: "Notice-level message" },
86
+ { level: "warning", data: "Warning-level message" },
87
+ { level: "error", data: "Error-level message" },
88
+ { level: "critical", data: "Critical-level message" },
89
+ { level: "alert", data: "Alert level-message" },
90
+ { level: "emergency", data: "Emergency-level message" }
91
+ ];
92
+ const isMessageIgnored = (level) => {
93
+ const currentLevel = messages.findIndex((msg) => logLevel === msg.level);
94
+ const messageLevel = messages.findIndex((msg) => level === msg.level);
95
+ return messageLevel < currentLevel;
96
+ };
97
+ // Set up update interval for random log messages
98
+ logsUpdateInterval = setInterval(() => {
99
+ let message = {
100
+ method: "notifications/message",
101
+ params: messages[Math.floor(Math.random() * messages.length)],
102
+ };
103
+ if (!isMessageIgnored(message.params.level))
104
+ server.notification(message);
105
+ }, 15000);
73
106
  // Helper method to request sampling from client
74
107
  const requestSampling = async (context, uri, maxTokens = 100) => {
75
108
  const request = {
@@ -271,6 +304,11 @@ export const createServer = () => {
271
304
  description: "Returns the MCP_TINY_IMAGE",
272
305
  inputSchema: zodToJsonSchema(GetTinyImageSchema),
273
306
  },
307
+ {
308
+ name: ToolName.ANNOTATED_MESSAGE,
309
+ description: "Demonstrates how annotations can be used to provide metadata about content",
310
+ inputSchema: zodToJsonSchema(AnnotatedMessageSchema),
311
+ },
274
312
  ];
275
313
  return { tools };
276
314
  });
@@ -359,6 +397,54 @@ export const createServer = () => {
359
397
  ],
360
398
  };
361
399
  }
400
+ if (name === ToolName.ANNOTATED_MESSAGE) {
401
+ const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
402
+ const content = [];
403
+ // Main message with different priorities/audiences based on type
404
+ if (messageType === "error") {
405
+ content.push({
406
+ type: "text",
407
+ text: "Error: Operation failed",
408
+ annotations: {
409
+ priority: 1.0, // Errors are highest priority
410
+ audience: ["user", "assistant"] // Both need to know about errors
411
+ }
412
+ });
413
+ }
414
+ else if (messageType === "success") {
415
+ content.push({
416
+ type: "text",
417
+ text: "Operation completed successfully",
418
+ annotations: {
419
+ priority: 0.7, // Success messages are important but not critical
420
+ audience: ["user"] // Success mainly for user consumption
421
+ }
422
+ });
423
+ }
424
+ else if (messageType === "debug") {
425
+ content.push({
426
+ type: "text",
427
+ text: "Debug: Cache hit ratio 0.95, latency 150ms",
428
+ annotations: {
429
+ priority: 0.3, // Debug info is low priority
430
+ audience: ["assistant"] // Technical details for assistant
431
+ }
432
+ });
433
+ }
434
+ // Optional image with its own annotations
435
+ if (includeImage) {
436
+ content.push({
437
+ type: "image",
438
+ data: MCP_TINY_IMAGE,
439
+ mimeType: "image/png",
440
+ annotations: {
441
+ priority: 0.5,
442
+ audience: ["user"] // Images primarily for user visualization
443
+ }
444
+ });
445
+ }
446
+ return { content };
447
+ }
362
448
  throw new Error(`Unknown tool: ${name}`);
363
449
  });
364
450
  server.setRequestHandler(CompleteRequestSchema, async (request) => {
@@ -383,21 +469,23 @@ export const createServer = () => {
383
469
  });
384
470
  server.setRequestHandler(SetLevelRequestSchema, async (request) => {
385
471
  const { level } = request.params;
472
+ logLevel = level;
386
473
  // Demonstrate different log levels
387
474
  await server.notification({
388
475
  method: "notifications/message",
389
476
  params: {
390
477
  level: "debug",
391
478
  logger: "test-server",
392
- data: `Logging level set to: ${level}`,
479
+ data: `Logging level set to: ${logLevel}`,
393
480
  },
394
481
  });
395
482
  return {};
396
483
  });
397
484
  const cleanup = async () => {
398
- if (updateInterval) {
399
- clearInterval(updateInterval);
400
- }
485
+ if (subsUpdateInterval)
486
+ clearInterval(subsUpdateInterval);
487
+ if (logsUpdateInterval)
488
+ clearInterval(logsUpdateInterval);
401
489
  };
402
490
  return { server, cleanup };
403
491
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-everything",
3
- "version": "2025.1.14",
3
+ "version": "2025.3.19",
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)",
@@ -16,7 +16,9 @@
16
16
  "scripts": {
17
17
  "build": "tsc && shx chmod +x dist/*.js",
18
18
  "prepare": "npm run build",
19
- "watch": "tsc --watch"
19
+ "watch": "tsc --watch",
20
+ "start": "node dist/index.js",
21
+ "start:sse": "node dist/sse.js"
20
22
  },
21
23
  "dependencies": {
22
24
  "@modelcontextprotocol/sdk": "1.0.1",