From 318c22b2acf9aa17dc11c1eff1f2b70caaf5bf94 Mon Sep 17 00:00:00 2001 From: olaservo Date: Mon, 26 May 2025 12:49:33 -0700 Subject: [PATCH 1/5] Add instructions --- src/everything/everything.ts | 14 +++++++++--- src/everything/instructions.md | 39 ++++++++++++++++++++++++++++++++++ src/everything/package.json | 2 +- 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 src/everything/instructions.md diff --git a/src/everything/everything.ts b/src/everything/everything.ts index 50fa5160ac..2abce9a075 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -20,6 +20,13 @@ import { } from "@modelcontextprotocol/sdk/types.js"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; +import { readFileSync } from "fs"; +import { fileURLToPath } from "url"; +import { dirname, join } from "path"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const instructions = readFileSync(join(__dirname, "instructions.md"), "utf-8"); const ToolInputSchema = ToolSchema.shape.inputSchema; type ToolInput = z.infer; @@ -110,6 +117,7 @@ export const createServer = () => { logging: {}, completions: {}, }, + instructions } ); @@ -160,9 +168,9 @@ export const createServer = () => { // Set up update interval for stderr messages stdErrUpdateInterval = setInterval(() => { const shortTimestamp = new Date().toLocaleTimeString([], { - hour: '2-digit', - minute: '2-digit', - second: '2-digit' + hour: "2-digit", + minute: "2-digit", + second: "2-digit" }); server.notification({ method: "notifications/stderr", diff --git a/src/everything/instructions.md b/src/everything/instructions.md new file mode 100644 index 0000000000..ad61db43c3 --- /dev/null +++ b/src/everything/instructions.md @@ -0,0 +1,39 @@ +# Everything Server + +This is a comprehensive MCP server that demonstrates all major MCP features and capabilities. + +## Available Tools + +- **echo**: Echo back any message +- **add**: Add two numbers together +- **longRunningOperation**: Demonstrate progress notifications with configurable duration and steps +- **printEnv**: Display all environment variables for debugging server configuration +- **sampleLLM**: Request LLM sampling from the client with a custom prompt +- **getTinyImage**: Return a small example image in PNG format +- **annotatedMessage**: Show how content annotations work for different message types +- **getResourceReference**: Return an embedded resource reference by ID (1-100) + +## Available Resources + +- Static resources numbered 1-100 accessible via `test://static/resource/{id}` +- Even-numbered resources contain plain text, odd-numbered contain binary data +- Resources support subscription for real-time updates every 10 seconds +- Resource templates allow dynamic URI construction + +## Available Prompts + +- **simple_prompt**: Basic prompt without arguments +- **complex_prompt**: Advanced prompt with temperature and style arguments, includes image content +- **resource_prompt**: Prompt that embeds a specific resource by ID + +## Features + +- Pagination support for large resource lists +- Argument completion for prompt parameters and resource IDs +- Progress notifications for long-running operations +- Configurable logging levels with automatic log message generation +- Resource subscription system with periodic update notifications +- LLM sampling integration for server-initiated model requests +- Content annotations for priority and audience targeting + +Use this server to test MCP client implementations and explore all protocol features. diff --git a/src/everything/package.json b/src/everything/package.json index 553db407eb..a9e9d9ebf0 100644 --- a/src/everything/package.json +++ b/src/everything/package.json @@ -14,7 +14,7 @@ "dist" ], "scripts": { - "build": "tsc && shx chmod +x dist/*.js", + "build": "tsc && shx cp instructions.md dist/ && shx chmod +x dist/*.js", "prepare": "npm run build", "watch": "tsc --watch", "start": "node dist/index.js", From 88ce1f1fdd3408c4a26ade46d5259c2d0c812d81 Mon Sep 17 00:00:00 2001 From: olaservo Date: Sat, 14 Jun 2025 18:22:43 -0700 Subject: [PATCH 2/5] Adjust instructions --- src/everything/instructions.md | 40 +++++----------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/src/everything/instructions.md b/src/everything/instructions.md index ad61db43c3..84529aed39 100644 --- a/src/everything/instructions.md +++ b/src/everything/instructions.md @@ -1,39 +1,11 @@ -# Everything Server +Testing and demonstration server for MCP protocol features. Workflow: Subscribe to resources before testing notifications - subscription automatically triggers sampling request to client. 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. -This is a comprehensive MCP server that demonstrates all major MCP features and capabilities. +Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds. Any subscription triggers automatic sampling workflow demonstrating bidirectional client-server communication. -## Available Tools +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. -- **echo**: Echo back any message -- **add**: Add two numbers together -- **longRunningOperation**: Demonstrate progress notifications with configurable duration and steps -- **printEnv**: Display all environment variables for debugging server configuration -- **sampleLLM**: Request LLM sampling from the client with a custom prompt -- **getTinyImage**: Return a small example image in PNG format -- **annotatedMessage**: Show how content annotations work for different message types -- **getResourceReference**: Return an embedded resource reference by ID (1-100) +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. -## Available Resources +Argument completion available for prompt parameters and resource IDs. Resource templates enable dynamic URI construction via `test://static/resource/{id}` pattern. -- Static resources numbered 1-100 accessible via `test://static/resource/{id}` -- Even-numbered resources contain plain text, odd-numbered contain binary data -- Resources support subscription for real-time updates every 10 seconds -- Resource templates allow dynamic URI construction - -## Available Prompts - -- **simple_prompt**: Basic prompt without arguments -- **complex_prompt**: Advanced prompt with temperature and style arguments, includes image content -- **resource_prompt**: Prompt that embeds a specific resource by ID - -## Features - -- Pagination support for large resource lists -- Argument completion for prompt parameters and resource IDs -- Progress notifications for long-running operations -- Configurable logging levels with automatic log message generation -- Resource subscription system with periodic update notifications -- LLM sampling integration for server-initiated model requests -- Content annotations for priority and audience targeting - -Use this server to test MCP client implementations and explore all protocol features. +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." From 57c056e9ad0af0c5a0673024c942cdbed0fa1d0e Mon Sep 17 00:00:00 2001 From: Ola Hungerford Date: Tue, 17 Jun 2025 06:58:12 -0700 Subject: [PATCH 3/5] Remove auto-sampling on subscription to a Resource --- src/everything/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/everything/instructions.md b/src/everything/instructions.md index 84529aed39..116678f2ca 100644 --- a/src/everything/instructions.md +++ b/src/everything/instructions.md @@ -1,6 +1,6 @@ Testing and demonstration server for MCP protocol features. Workflow: Subscribe to resources before testing notifications - subscription automatically triggers sampling request to client. 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. -Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds. Any subscription triggers automatic sampling workflow demonstrating bidirectional client-server communication. +Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds. 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. From d85a01c4e2bfd334c193ac11e1addae751a760e1 Mon Sep 17 00:00:00 2001 From: Ola Hungerford Date: Wed, 18 Jun 2025 07:39:03 -0700 Subject: [PATCH 4/5] Remove workflow mention related to resource subscription --- src/everything/instructions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/everything/instructions.md b/src/everything/instructions.md index 116678f2ca..a4766de6a7 100644 --- a/src/everything/instructions.md +++ b/src/everything/instructions.md @@ -1,5 +1,6 @@ -Testing and demonstration server for MCP protocol features. Workflow: Subscribe to resources before testing notifications - subscription automatically triggers sampling request to client. 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. +Testing and demonstration server for MCP protocol features. +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. Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds. 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. From 554320281b9eb22fdf7bad72b8242fc9a8207a6a Mon Sep 17 00:00:00 2001 From: Ola Hungerford Date: Thu, 19 Jun 2025 15:26:47 -0700 Subject: [PATCH 5/5] Update src/everything/instructions.md Co-authored-by: Cliff Hall --- src/everything/instructions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/everything/instructions.md b/src/everything/instructions.md index a4766de6a7..d6adf0f452 100644 --- a/src/everything/instructions.md +++ b/src/everything/instructions.md @@ -1,6 +1,7 @@ Testing and demonstration server for MCP protocol features. 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. + Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds. 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.