Skip to content

Commit bd164d9

Browse files
authored
Merge pull request #1919 from olaservo/add-instructions
Add instructions to Everything Server
2 parents 0db03b7 + 5543202 commit bd164d9

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

src/everything/everything.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ import {
2020
} from "@modelcontextprotocol/sdk/types.js";
2121
import { z } from "zod";
2222
import { zodToJsonSchema } from "zod-to-json-schema";
23+
import { readFileSync } from "fs";
24+
import { fileURLToPath } from "url";
25+
import { dirname, join } from "path";
26+
27+
const __filename = fileURLToPath(import.meta.url);
28+
const __dirname = dirname(__filename);
29+
const instructions = readFileSync(join(__dirname, "instructions.md"), "utf-8");
2330

2431
const ToolInputSchema = ToolSchema.shape.inputSchema;
2532
type ToolInput = z.infer<typeof ToolInputSchema>;
@@ -110,6 +117,7 @@ export const createServer = () => {
110117
logging: {},
111118
completions: {},
112119
},
120+
instructions
113121
}
114122
);
115123

@@ -160,9 +168,9 @@ export const createServer = () => {
160168
// Set up update interval for stderr messages
161169
stdErrUpdateInterval = setInterval(() => {
162170
const shortTimestamp = new Date().toLocaleTimeString([], {
163-
hour: '2-digit',
164-
minute: '2-digit',
165-
second: '2-digit'
171+
hour: "2-digit",
172+
minute: "2-digit",
173+
second: "2-digit"
166174
});
167175
server.notification({
168176
method: "notifications/stderr",

src/everything/instructions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Testing and demonstration server for MCP protocol features.
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.
4+
5+
Key dependencies: Progress notifications require `_meta.progressToken` in tool calls. Resource subscriptions generate updates every 10 seconds.
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.
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.
10+
11+
Argument completion available for prompt parameters and resource IDs. Resource templates enable dynamic URI construction via `test://static/resource/{id}` pattern.
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."

src/everything/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dist"
1515
],
1616
"scripts": {
17-
"build": "tsc && shx chmod +x dist/*.js",
17+
"build": "tsc && shx cp instructions.md dist/ && shx chmod +x dist/*.js",
1818
"prepare": "npm run build",
1919
"watch": "tsc --watch",
2020
"start": "node dist/index.js",

0 commit comments

Comments
 (0)