@modelcontextprotocol/server-everything 0.6.2 → 2.0.0

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.
Files changed (59) hide show
  1. package/README.md +140 -76
  2. package/dist/docs/architecture.md +45 -0
  3. package/dist/docs/extension.md +25 -0
  4. package/dist/docs/features.md +99 -0
  5. package/dist/docs/how-it-works.md +60 -0
  6. package/dist/docs/instructions.md +44 -0
  7. package/dist/docs/startup.md +71 -0
  8. package/dist/docs/structure.md +246 -0
  9. package/dist/index.js +73 -16
  10. package/dist/prompts/args.js +34 -0
  11. package/dist/prompts/completions.js +52 -0
  12. package/dist/prompts/index.js +15 -0
  13. package/dist/prompts/resource.js +61 -0
  14. package/dist/prompts/simple.js +23 -0
  15. package/dist/resources/files.js +91 -0
  16. package/dist/resources/index.js +38 -0
  17. package/dist/resources/minted.js +119 -0
  18. package/dist/resources/session.js +62 -0
  19. package/dist/resources/subscriptions.js +66 -0
  20. package/dist/resources/templates.js +167 -0
  21. package/dist/server/context.js +47 -0
  22. package/dist/server/index.js +153 -0
  23. package/dist/server/logging.js +43 -0
  24. package/dist/server/roots.js +49 -0
  25. package/dist/server/tasks.js +295 -0
  26. package/dist/tools/echo.js +35 -0
  27. package/dist/tools/get-annotated-message.js +89 -0
  28. package/dist/tools/get-env.js +34 -0
  29. package/dist/tools/get-header-params.js +95 -0
  30. package/dist/tools/get-resource-links.js +68 -0
  31. package/dist/tools/get-resource-reference.js +81 -0
  32. package/dist/tools/get-roots-list.js +76 -0
  33. package/dist/tools/get-structured-content.js +78 -0
  34. package/dist/tools/get-sum.js +46 -0
  35. package/dist/tools/get-tiny-image.js +47 -0
  36. package/dist/tools/gzip-file-as-resource.js +213 -0
  37. package/dist/tools/index.js +110 -0
  38. package/dist/tools/simulate-research-query.js +216 -0
  39. package/dist/tools/toggle-simulated-logging.js +60 -0
  40. package/dist/tools/toggle-subscriber-updates.js +60 -0
  41. package/dist/tools/trigger-elicitation-request-async.js +122 -0
  42. package/dist/tools/trigger-elicitation-request.js +223 -0
  43. package/dist/tools/trigger-list-changed.js +57 -0
  44. package/dist/tools/trigger-log-messages.js +60 -0
  45. package/dist/tools/trigger-long-running-operation.js +65 -0
  46. package/dist/tools/trigger-multi-step-elicitation.js +125 -0
  47. package/dist/tools/trigger-resource-update.js +52 -0
  48. package/dist/tools/trigger-sampling-request-async.js +110 -0
  49. package/dist/tools/trigger-sampling-request.js +83 -0
  50. package/dist/tools/trigger-url-elicitation.js +206 -0
  51. package/dist/transports/in-memory-event-store.js +44 -0
  52. package/dist/transports/listen.js +36 -0
  53. package/dist/transports/sse.js +112 -0
  54. package/dist/transports/stdio.js +68 -0
  55. package/dist/transports/streamableHttp.js +326 -0
  56. package/dist/version.js +35 -0
  57. package/package.json +39 -13
  58. package/dist/everything.js +0 -361
  59. package/dist/sse.js +0 -24
package/README.md CHANGED
@@ -1,78 +1,32 @@
1
- # Everything MCP Server
1
+ # Everything MCP Server
2
+
3
+ **[Architecture](docs/architecture.md)
4
+ | [Project Structure](docs/structure.md)
5
+ | [Startup Process](docs/startup.md)
6
+ | [Server Features](docs/features.md)
7
+ | [Extension Points](docs/extension.md)
8
+ | [How It Works](docs/how-it-works.md)**
2
9
 
3
10
  This MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.
4
11
 
5
- ## Components
6
-
7
- ### Tools
8
-
9
- 1. `echo`
10
- - Simple tool to echo back input messages
11
- - Input:
12
- - `message` (string): Message to echo back
13
- - Returns: Text content with echoed message
14
-
15
- 2. `add`
16
- - Adds two numbers together
17
- - Inputs:
18
- - `a` (number): First number
19
- - `b` (number): Second number
20
- - Returns: Text result of the addition
21
-
22
- 3. `longRunningOperation`
23
- - Demonstrates progress notifications for long operations
24
- - Inputs:
25
- - `duration` (number, default: 10): Duration in seconds
26
- - `steps` (number, default: 5): Number of progress steps
27
- - Returns: Completion message with duration and steps
28
- - Sends progress notifications during execution
29
-
30
- 4. `sampleLLM`
31
- - Demonstrates LLM sampling capability using MCP sampling feature
32
- - Inputs:
33
- - `prompt` (string): The prompt to send to the LLM
34
- - `maxTokens` (number, default: 100): Maximum tokens to generate
35
- - Returns: Generated LLM response
36
-
37
- 5. `getTinyImage`
38
- - Returns a small test image
39
- - No inputs required
40
- - Returns: Base64 encoded PNG image data
41
-
42
- ### Resources
43
-
44
- The server provides 100 test resources in two formats:
45
- - Even numbered resources:
46
- - Plaintext format
47
- - URI pattern: `test://static/resource/{even_number}`
48
- - Content: Simple text description
49
-
50
- - Odd numbered resources:
51
- - Binary blob format
52
- - URI pattern: `test://static/resource/{odd_number}`
53
- - Content: Base64 encoded binary data
54
-
55
- Resource features:
56
- - Supports pagination (10 items per page)
57
- - Allows subscribing to resource updates
58
- - Demonstrates resource templates
59
- - Auto-updates subscribed resources every 5 seconds
60
-
61
- ### Prompts
62
-
63
- 1. `simple_prompt`
64
- - Basic prompt without arguments
65
- - Returns: Single message exchange
66
-
67
- 2. `complex_prompt`
68
- - Advanced prompt demonstrating argument handling
69
- - Required arguments:
70
- - `temperature` (number): Temperature setting
71
- - Optional arguments:
72
- - `style` (string): Output style preference
73
- - Returns: Multi-turn conversation with images
74
-
75
- ## Usage with Claude Desktop
12
+ ## Tools, Resources, Prompts, and Other Features
13
+
14
+ A complete list of the registered MCP primitives and other protocol features demonstrated can be found in the [Server Features](docs/features.md) document.
15
+
16
+ ## Protocol versions
17
+
18
+ The server serves both protocol eras, over stdio and Streamable HTTP, from one process:
19
+
20
+ - **2026-07-28** clients connect with `server/discover`, send their protocol version, identity and capabilities with each request, and have no session. The server demonstrates the revision's new features for them: multi-round-trip requests (`input_required`) with `requestState`, `subscriptions/listen` change notifications, per-request log levels, cache hints (`ttlMs` / `cacheScope`), the tasks extension (`io.modelcontextprotocol/tasks`) under the `extensions` capability, and `x-mcp-header` with JSON Schema 2020-12 tool schemas.
21
+ - **2025-era** clients connect with the `initialize` handshake, as before. Elicitation, sampling and roots are served to them from the same multi-round-trip handlers through the SDK's legacy shim.
22
+
23
+ Roots, sampling and logging are deprecated as of 2026-07-28 and stay available, labelled deprecated. [Server Features](docs/features.md) marks which era each feature belongs to.
24
+
25
+ ## Requirements
26
+
27
+ Node.js 24 or later, when the server runs through `npx` or from source.
28
+
29
+ ## Usage with Claude Desktop (uses [stdio Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#stdio))
76
30
 
77
31
  Add to your `claude_desktop_config.json`:
78
32
 
@@ -81,11 +35,121 @@ Add to your `claude_desktop_config.json`:
81
35
  "mcpServers": {
82
36
  "everything": {
83
37
  "command": "npx",
84
- "args": [
85
- "-y",
86
- "@modelcontextprotocol/server-everything"
87
- ]
38
+ "args": ["-y", "@modelcontextprotocol/server-everything"]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ On Windows, use `cmd /c` to launch `npx`:
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "everything": {
50
+ "command": "cmd",
51
+ "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"]
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Usage with VS Code
58
+
59
+ For quick installation, use one of the one-click install buttons below...
60
+
61
+ [![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-NPM-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=everything&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-everything%22%5D%7D) [![Install with NPX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-NPM-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=everything&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-everything%22%5D%7D&quality=insiders)
62
+
63
+ [![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Docker-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=everything&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22mcp%2Feverything%22%5D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Docker-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=everything&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22mcp%2Feverything%22%5D%7D&quality=insiders)
64
+
65
+ For manual installation, you can configure the MCP server using one of these methods:
66
+
67
+ **Method 1: User Configuration (Recommended)**
68
+ Add the configuration to your user-level MCP configuration file. Open the Command Palette (`Ctrl + Shift + P`) and run `MCP: Open User Configuration`. This will open your user `mcp.json` file where you can add the server configuration.
69
+
70
+ **Method 2: Workspace Configuration**
71
+ Alternatively, you can add the configuration to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
72
+
73
+ > For more details about MCP configuration in VS Code, see the [official VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).
74
+
75
+ #### NPX
76
+
77
+ ```json
78
+ {
79
+ "servers": {
80
+ "everything": {
81
+ "command": "npx",
82
+ "args": ["-y", "@modelcontextprotocol/server-everything"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ On Windows, use:
89
+
90
+ ```json
91
+ {
92
+ "servers": {
93
+ "everything": {
94
+ "command": "cmd",
95
+ "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"]
88
96
  }
89
97
  }
90
98
  }
91
99
  ```
100
+
101
+ ## Run from source with [Streamable HTTP Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http)
102
+
103
+ ```shell
104
+ cd src/everything
105
+ npm install
106
+ npm run start:streamableHttp
107
+ ```
108
+
109
+ The endpoint is `http://localhost:3001/mcp` (`PORT` overrides the port). It serves 2026-07-28 clients statelessly and 2025-era clients with sessions, from the same URL.
110
+
111
+ ## Running from source with [HTTP+SSE Transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) (deprecated as of [2025-03-26](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports))
112
+
113
+ ```shell
114
+ cd src/everything
115
+ npm install
116
+ npm run start:sse
117
+ ```
118
+
119
+ The HTTP+SSE transport serves 2025-era clients only, and the server prints a deprecation warning when it starts. Prefer Streamable HTTP.
120
+
121
+ ## Running as an installed package
122
+
123
+ ### Install
124
+
125
+ ```shell
126
+ npm install -g @modelcontextprotocol/server-everything@latest
127
+ ```
128
+
129
+ ### Run the default (stdio) server
130
+
131
+ ```shell
132
+ npx @modelcontextprotocol/server-everything
133
+ ```
134
+
135
+ ### Or specify stdio explicitly
136
+
137
+ ```shell
138
+ npx @modelcontextprotocol/server-everything stdio
139
+ ```
140
+
141
+ ### Run the streamable HTTP server
142
+
143
+ ```shell
144
+ npx @modelcontextprotocol/server-everything streamableHttp
145
+ ```
146
+
147
+ ### Run the SSE server (deprecated, 2025-era clients only)
148
+
149
+ ```shell
150
+ npx @modelcontextprotocol/server-everything sse
151
+ ```
152
+
153
+ ## License
154
+
155
+ This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
@@ -0,0 +1,45 @@
1
+ # Everything Server – Architecture
2
+
3
+ **Architecture
4
+ | [Project Structure](structure.md)
5
+ | [Startup Process](startup.md)
6
+ | [Server Features](features.md)
7
+ | [Extension Points](extension.md)
8
+ | [How It Works](how-it-works.md)**
9
+
10
+ This documentation summarizes the current layout and runtime architecture of the `src/everything` package.
11
+ It explains how the server starts, how transports are wired, where tools, prompts, and resources are registered, and how to extend the system.
12
+
13
+ ## High‑level Overview
14
+
15
+ ### Purpose
16
+
17
+ A minimal, modular MCP server showcasing core Model Context Protocol features. It exposes simple tools, prompts, and resources, and can be run over multiple transports (STDIO, Streamable HTTP, and the deprecated HTTP+SSE). It serves both protocol eras: 2026-07-28 clients (`server/discover`, per-request `_meta`, no sessions) and 2025-era clients (`initialize`), from one server factory.
18
+
19
+ ### Design
20
+
21
+ A small “server factory” constructs the MCP server for a protocol era and registers features.
22
+ Transports are separate entry points that serve the factory and handle network concerns: the SDK's `serveStdio` and `createMcpHandler` entries pick each client's era.
23
+ Tools, prompts, and resources are organized in their own submodules.
24
+
25
+ ### Multi‑client
26
+
27
+ The server supports multiple concurrent clients. Per-connection state (resource subscriptions,
28
+ simulated logging) lives on the server instance serving the connection, and state that must outlive
29
+ a 2026-07-28 request (tasks, minted resources) is stored under handles the server mints.
30
+
31
+ ## Build and Distribution
32
+
33
+ - TypeScript sources are compiled into `dist/` via `npm run build`.
34
+ - The `build` script copies `docs/` into `dist/` so instruction files ship alongside the compiled server.
35
+ - The CLI bin is configured in `package.json` as `mcp-server-everything` → `dist/index.js`.
36
+
37
+ ## [Project Structure](structure.md)
38
+
39
+ ## [Startup Process](startup.md)
40
+
41
+ ## [Server Features](features.md)
42
+
43
+ ## [Extension Points](extension.md)
44
+
45
+ ## [How It Works](how-it-works.md)
@@ -0,0 +1,25 @@
1
+ # Everything Server - Extension Points
2
+
3
+ **[Architecture](architecture.md)
4
+ | [Project Structure](structure.md)
5
+ | [Startup Process](startup.md)
6
+ | [Server Features](features.md)
7
+ | Extension Points
8
+ | [How It Works](how-it-works.md)**
9
+
10
+ ## Adding Tools
11
+
12
+ - Create a new file under `tools/` with your `registerXTool(server)` function that registers the tool via `server.registerTool(...)`. Take the `context` (`server/context.ts`) as a second argument if the tool needs the protocol era, the change publisher, or state that lives as long as the connection.
13
+ - Export and call it from `tools/index.ts`, in the function for the eras that get it: `registerTools(server, context)` for both, `registerModernTools` for 2026-07-28 only, `registerLegacyTools` or `registerConditionalTools` (capability-gated) for the 2025 era only.
14
+ - Never keep state in a module-level map keyed by session id: the 2026-07-28 protocol has no sessions, and its HTTP path builds a fresh server per request. Keep per-connection state in the registration closure, and state that must outlive a request under a handle the server mints (as `server/tasks.ts` and `resources/minted.ts` do).
15
+ - For client input (elicitation, sampling, roots), return `inputRequired(...)` from the handler rather than sending a request; the SDK's legacy shim serves the same handler to 2025-era clients.
16
+
17
+ ## Adding Prompts
18
+
19
+ - Create a new file under `prompts/` with your `registerXPrompt(server)` function that registers the prompt via `server.registerPrompt(...)`.
20
+ - Export and call it from `prompts/index.ts` inside `registerPrompts(server)`.
21
+
22
+ ## Adding Resources
23
+
24
+ - Create a new file under `resources/` with your `registerXResources(server)` function using `server.registerResource(...)` (optionally with `ResourceTemplate`).
25
+ - Export and call it from `resources/index.ts` inside `registerResources(server, context)`.
@@ -0,0 +1,99 @@
1
+ # Everything Server - Features
2
+
3
+ **[Architecture](architecture.md)
4
+ | [Project Structure](structure.md)
5
+ | [Startup Process](startup.md)
6
+ | Server Features
7
+ | [Extension Points](extension.md)
8
+ | [How It Works](how-it-works.md)**
9
+
10
+ ## Protocol eras
11
+
12
+ The server serves two protocol eras from one process, over stdio and over Streamable HTTP. A client's first message picks its era:
13
+
14
+ - **2026-07-28** (`modern`): the client opens with `server/discover`, with no `initialize` and no session, and sends its protocol version, identity and capabilities in each request's `_meta`.
15
+ - **2025-era** (`legacy`, 2024-10-07 through 2025-11-25): the client opens with the `initialize` handshake. The HTTP+SSE transport serves this era only.
16
+
17
+ Each feature below is marked **both**, **2026-07-28** or **2025-era**. Roots, sampling and logging are deprecated as of 2026-07-28 (SEP-2577), as is the HTTP+SSE transport; they stay available and are labelled deprecated in their descriptions.
18
+
19
+ | Feature | 2026-07-28 | 2025-era |
20
+ | ------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
21
+ | Discovery | `server/discover` | `initialize` |
22
+ | Client input (elicitation, sampling, roots) | in-band: the tool returns `input_required`, the client retries | the SDK's legacy shim sends real server-to-client requests for the same handler |
23
+ | State across rounds | `requestState`, signed and expiring | the same, replayed by the shim |
24
+ | Change notifications | on a `subscriptions/listen` stream the client opened | unsolicited, or after `resources/subscribe` |
25
+ | Log level | per request, `_meta` `io.modelcontextprotocol/logLevel` (none named: no logs) | per session, `logging/setLevel` |
26
+ | Tasks | the `io.modelcontextprotocol/tasks` extension | not served |
27
+ | Cache hints | `ttlMs` / `cacheScope` on lists, reads and `server/discover` | not sent |
28
+ | `x-mcp-header` | mirrored into `Mcp-Param-*` headers over Streamable HTTP | not mirrored |
29
+
30
+ ## Tools
31
+
32
+ - `echo` (tools/echo.ts), **both**: Echoes the provided `message: string`. Uses Zod to validate inputs.
33
+ - `get-annotated-message` (tools/get-annotated-message.ts), **both**: Returns a `text` message annotated with `priority` and `audience` based on `messageType` (`error`, `success`, or `debug`); can optionally include an annotated `image`.
34
+ - `get-env` (tools/get-env.ts), **both**: Returns all environment variables from the running process as pretty-printed JSON text.
35
+ - `get-header-params` (tools/get-header-params.ts), **both**: Returns its `region` argument and the `Mcp-Param-Region` HTTP header it arrived in. Its input and output schemas are plain JSON Schema 2020-12, and `region` carries `x-mcp-header: "Region"`, so a 2026-07-28 Streamable HTTP client mirrors it into that header and the server refuses a call whose header disagrees with the body (`-32020`). The header is `null` on stdio and for a 2025-era client.
36
+ - `get-resource-links` (tools/get-resource-links.ts), **both**: Returns an intro `text` block followed by multiple `resource_link` items. For a requested `count` (1–10), alternates between dynamic Text and Blob resources using URIs from `resources/templates.ts`.
37
+ - `get-resource-reference` (tools/get-resource-reference.ts), **both**: Accepts `resourceType` (`text` or `blob`) and `resourceId` (positive integer). Returns a concrete `resource` content block (with its `uri`, `mimeType`, and data) with surrounding explanatory `text`.
38
+ - `get-roots-list` (tools/get-roots-list.ts), **both**, deprecated: Asks the client for its roots with a multi-round-trip request (`inputRequired.listRoots()`) and lists them. Needs client capability `roots`.
39
+ - `gzip-file-as-resource` (tools/gzip-file-as-resource.ts), **both**: Accepts a `name` and `data` (URL or data URI), fetches the data subject to size/time/domain constraints, compresses it, and returns either a `resource_link` (default) or an inline `resource` depending on `outputType`, with `mimeType: application/gzip`. The linked resource is registered as a session resource at `demo://resource/session/<name>` for a 2025-era client, and stored for ten minutes at a minted `demo://resource/minted/<id>/<name>` for a 2026-07-28 client.
40
+ - `get-structured-content` (tools/get-structured-content.ts), **both**: Demonstrates structured responses. Accepts `location` input and returns both backward‑compatible `content` (a `text` block containing JSON) and `structuredContent` validated by an `outputSchema` (temperature, conditions, humidity).
41
+ - `get-sum` (tools/get-sum.ts), **both**: For two numbers `a` and `b` calculates and returns their sum. Uses Zod to validate inputs.
42
+ - `get-tiny-image` (tools/get-tiny-image.ts), **both**: Returns a tiny PNG MCP logo as an `image` content item with brief descriptive text before and after.
43
+ - `simulate-research-query` (tools/simulate-research-query.ts), **2026-07-28**: Runs as a task on the tasks extension. The call returns a task handle; the task works through four stages, one a second, which the client follows with `tasks/get`. With `ambiguous: true` and an elicitation-capable client it pauses at `input_required`, carrying a clarification request the client answers with `tasks/update`. Needs a client that declares the extension.
44
+ - `toggle-simulated-logging` (tools/toggle-simulated-logging.ts), **2025-era**, deprecated: Starts or stops simulated, random‑leveled logging for the connection. Respects the level the client set with `logging/setLevel`.
45
+ - `toggle-subscriber-updates` (tools/toggle-subscriber-updates.ts), **2025-era**, deprecated: Starts or stops simulated resource update notifications for URIs the connection has subscribed to with `resources/subscribe`.
46
+ - `trigger-elicitation-request` (tools/trigger-elicitation-request.ts), **both**: Asks for a form of every field type form-mode elicitation supports (strings, numbers, booleans, enums, and format validation) with a multi-round-trip request, and returns the resulting action/content. Needs client form-mode elicitation: `elicitation.form`, or an `elicitation` object that declares neither mode.
47
+ - `trigger-elicitation-request-async` (tools/trigger-elicitation-request-async.ts), **2026-07-28**: Runs as a task whose `input_required` status carries a form elicitation; the client answers with `tasks/update` and the task completes with a summary. Needs a client that declares the tasks extension and form-mode elicitation.
48
+ - `trigger-list-changed` (tools/trigger-list-changed.ts), **both**: Sends `notifications/<list>/list_changed` for `tools`, `prompts` or `resources`: on 2026-07-28 to each `subscriptions/listen` stream that asked for that list, on a 2025-era connection unsolicited.
49
+ - `trigger-log-messages` (tools/trigger-log-messages.ts), **both**, deprecated: Sends one log message at each level during the call. A 2026-07-28 request gets those at or above the level its `_meta` names (none if it names none); a 2025-era client those at or above its `logging/setLevel` level.
50
+ - `trigger-long-running-operation` (tools/trigger-long-running-operation.ts), **both**: Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client.
51
+ - `trigger-multi-step-elicitation` (tools/trigger-multi-step-elicitation.ts), **both**: Asks for a name, then for a favorite color addressed by that name, carrying the first answer to the second round in `requestState`. The state is HMAC-signed and expires after ten minutes; a tampered or expired one is refused with `-32602`. A blank name or a color that is not a choice is asked again. Needs form-mode elicitation.
52
+ - `trigger-resource-update` (tools/trigger-resource-update.ts), **both**: Sends `notifications/resources/updated` for a URI: on 2026-07-28 to each listen stream whose `resourceSubscriptions` name it, on a 2025-era connection once the client has subscribed to it.
53
+ - `trigger-sampling-request` (tools/trigger-sampling-request.ts), **both**, deprecated: Asks the client's LLM for a completion with a multi-round-trip request, using the provided `prompt` and `maxTokens`; returns the LLM's response payload. Needs client capability `sampling`.
54
+ - `trigger-sampling-request-async` (tools/trigger-sampling-request-async.ts), **2026-07-28**, deprecated: Runs as a task whose `input_required` status carries a sampling request; the client answers with `tasks/update` and the task completes with the result. Needs a client that declares the tasks extension and sampling.
55
+ - `trigger-url-elicitation` (tools/trigger-url-elicitation.ts), **both**: Directs the user to a URL (URL-mode elicitation). On 2026-07-28 the elicitation comes in-band (`input_required`), with no `elicitationId`. On a 2025-era connection it issues an `elicitation/create` request in URL mode with an `elicitationId`, or throws MCP error `-32042` (`UrlElicitationRequiredError`) when `errorPath=true`. On the error path the prerequisite elicitation it returns points at a different URL than the failing request (`https://modelcontextprotocol.io`); when the client satisfies it and retries the same call, the retry ignores `errorPath` and proceeds via the request path, so the client does not loop on the same error. The retry marker is one-shot per `(url, elicitationId)` on the connection: it is cleared on the recognized retry, so re-running the error path with identical arguments without an intervening prerequisite is treated as a retry and proceeds. Needs client capability `elicitation.url`.
56
+
57
+ On a 2025-era connection the tools that need a client capability are registered only for a client that declared it at `initialize`. On 2026-07-28 they are always listed, because the capabilities arrive with each request, and the SDK refuses a call whose embedded request the client did not declare (`-32021`).
58
+
59
+ ## Prompts
60
+
61
+ - `simple-prompt` (prompts/simple.ts): No-argument prompt that returns a static user message.
62
+ - `args-prompt` (prompts/args.ts): Two-argument prompt with `city` (required) and `state` (optional) used to compose a question.
63
+ - `completable-prompt` (prompts/completions.ts): Demonstrates argument auto-completions with the SDK’s `completable` helper; `department` completions drive context-aware `name` suggestions.
64
+ - `resource-prompt` (prompts/resource.ts): Accepts `resourceType` ("Text" or "Blob") and `resourceId` (string convertible to integer) and returns messages that include an embedded dynamic resource of the selected type generated via `resources/templates.ts`.
65
+
66
+ ## Resources
67
+
68
+ - Dynamic Text: `demo://resource/dynamic/text/{index}` (content generated on the fly)
69
+ - Dynamic Blob: `demo://resource/dynamic/blob/{index}` (base64 payload generated on the fly)
70
+ - Static Documents: `demo://resource/static/document/<filename>` (serves files from `src/everything/docs/` as static file-based resources; a 2026-07-28 read carries a one-hour public cache hint)
71
+ - Session Scoped, **2025-era**: `demo://resource/session/<name>` (per-session resources registered dynamically; available only for the lifetime of the session)
72
+ - Minted, **2026-07-28**: `demo://resource/minted/<id>/<name>` (resources a tool created, under a server-minted id; readable by any client that has the URI, for ten minutes; the process keeps at most 100 of them and 64 MiB of content, dropping the oldest first)
73
+
74
+ A read of a resource that does not exist (an unknown URI, a template id that is not a positive integer, an expired minted resource) is answered with `-32602` and the URI in the error's `data`.
75
+
76
+ ## Resource Subscriptions and Notifications
77
+
78
+ - **2026-07-28**: a client opens a `subscriptions/listen` stream whose filter names the notifications it wants (`toolsListChanged`, `promptsListChanged`, `resourcesListChanged`, and `resourceSubscriptions` for per-resource updates). `trigger-list-changed` and `trigger-resource-update` publish onto those streams; over Streamable HTTP, through the handler's subscription bus, so a change made in one request reaches streams other requests opened.
79
+ - **2025-era**: clients subscribe and unsubscribe to resource URIs with `resources/subscribe` and `resources/unsubscribe`. `toggle-subscriber-updates` starts or stops a per-connection interval that emits `notifications/resources/updated { uri }` for the URIs that connection subscribed to, and `trigger-resource-update` sends one on demand. List changes arrive unsolicited.
80
+ - Each client's subscriptions belong to the server instance serving its connection, so concurrent clients are independent.
81
+
82
+ ## Logging
83
+
84
+ Logging is deprecated as of 2026-07-28 (SEP-2577) and remains available on both eras.
85
+
86
+ - **2026-07-28**: a request names its log level in `_meta` (`io.modelcontextprotocol/logLevel`); a request that names none gets no log messages. Use `trigger-log-messages` to see the filter at work.
87
+ - **2025-era**: clients set the minimum level for the session with `logging/setLevel`. `toggle-simulated-logging` starts or stops periodic log messages of varying levels (debug, info, notice, warning, error, critical, alert, emergency).
88
+
89
+ ## Tasks
90
+
91
+ **2026-07-28.** The server implements the server side of the [tasks extension](https://github.com/modelcontextprotocol/ext-tasks) (`io.modelcontextprotocol/tasks`, SEP-2663), advertised under `capabilities.extensions` in `server/discover`. `simulate-research-query`, `trigger-sampling-request-async` and `trigger-elicitation-request-async` answer `tools/call` with a task handle (`resultType: "task"`) for a client that declares the extension, and serve:
92
+
93
+ - `tasks/get`: the task's status, `statusMessage`, `ttlMs` and `pollIntervalMs`, plus its `inputRequests` while `input_required` and its `result` once `completed`;
94
+ - `tasks/update`: the client's `inputResponses` to the outstanding input requests;
95
+ - `tasks/cancel`: stop a task that has not finished.
96
+
97
+ A task tool called by a client whose request does not declare the extension, or the capability its task asks for input with (`sampling` for `trigger-sampling-request-async`, form-mode `elicitation` for `trigger-elicitation-request-async`), is refused with `-32021` (missing required client capability), naming what is missing in `data.requiredCapabilities`; so is a `tasks/*` request from a client without the extension. An unknown or expired task, and a `tasks/update` whose answers exceed 64 KiB serialized, are refused with `-32602`. A `tasks/cancel` is acknowledged whatever the task's status (cancellation is cooperative), and a finished task stays as it ended. An update's answers to requests that are not outstanding (never issued, already answered, or sent while the task is not waiting for input) are ignored, as the extension asks. Each input request a task makes has its own key, never reused once answered, so a request asked again after an answer that does not fit gets a new key (`form-2`, `sampling-2`). The process keeps at most 100 tasks, each until its TTL; at that limit a new task is refused with a tool error. The task id is a server-minted UUID, so a task lives across requests (each 2026-07-28 HTTP request is served by a fresh server instance) and is reached only through its handle. A task's progress is computed from the clock when it is read, so nothing runs in the background.
98
+
99
+ The 2025-11-25 core task methods (`tasks/result`, `tasks/list`, task-augmented requests) are not served: SDK v2 removed the experimental layer they were built on.
@@ -0,0 +1,60 @@
1
+ # Everything Server - How It Works
2
+
3
+ **[Architecture](architecture.md)
4
+ | [Project Structure](structure.md)
5
+ | [Startup Process](startup.md)
6
+ | [Server Features](features.md)
7
+ | [Extension Points](extension.md)
8
+ | How It Works**
9
+
10
+ # Conditional Tool Registration
11
+
12
+ ### Modules: `server/index.ts`, `tools/index.ts`
13
+
14
+ - Some tools require client support for the capability they demonstrate. These are:
15
+ - `get-roots-list`
16
+ - `trigger-elicitation-request`
17
+ - `trigger-multi-step-elicitation`
18
+ - `trigger-sampling-request`
19
+ - `trigger-url-elicitation`
20
+ - **2025 era**: client capabilities aren't known until the initialization handshake is complete, so these tools are registered by `registerConditionalTools(server, context)`, invoked from an `oninitialized` handler, for a client that declared the capability.
21
+ - **2026-07-28**: there is no handshake, and each request carries the client's capabilities in `_meta`, so `registerModernTools(server, context)` registers them up front. The SDK refuses a call whose embedded request the client did not declare (`-32021`).
22
+
23
+ # Multi-Round-Trip Requests
24
+
25
+ ### Modules: the elicitation, sampling and roots tools
26
+
27
+ - A tool that needs client input returns `inputRequired({ inputRequests })` instead of a result. A 2026-07-28 client fulfils the embedded requests and retries the call with `inputResponses`; for a 2025-era client the SDK's legacy shim sends real `elicitation/create`, `sampling/createMessage` or `roots/list` requests and re-enters the handler with the answers. Each handler is written once.
28
+ - The handler reads the answers with `inputResponse(...)` (any kind, including a decline) or `acceptedContent(..., schema)` (a validated form answer).
29
+ - A flow of several rounds carries what it has learned in `requestState`. `trigger-multi-step-elicitation` mints it with `roundStateCodec` (HMAC-signed, ten-minute expiry, process-wide key), passed to the server as `requestState.verify`, so a tampered or expired state is refused with `-32602` before the handler runs.
30
+
31
+ # Tasks
32
+
33
+ ### Module: `server/tasks.ts`
34
+
35
+ - Serves the tasks extension (`io.modelcontextprotocol/tasks`) on 2026-07-28: `tasks/get`, `tasks/update` and `tasks/cancel`, with explicit schemas.
36
+ - `createTask(behavior, options)` stores a task under a minted UUID and returns the `tools/call` result that hands its handle to the client (`resultType: "task"`). A task's `behavior` works out its state from the clock (`stateAt`) and takes the client's answers (`receive`), so nothing runs in the background. Tasks past their TTL are dropped when the store is next touched.
37
+
38
+ ## Resource Subscriptions
39
+
40
+ ### Module: `resources/subscriptions.ts`
41
+
42
+ - **2025 era**: `setSubscriptionHandlers(server, subscribed)` processes subscribe/unsubscribe requests, keeping the instance's set of subscribed URIs.
43
+ - Updates are started/stopped on demand by the `toggle-subscriber-updates` tool, which calls `beginSimulatedResourceUpdates(server, subscribed)` and keeps the stop function it returns; the instance's `cleanup()` stops it too.
44
+ - **2026-07-28**: the serving entry handles `subscriptions/listen` itself. The context's publisher (`server/context.ts`) sends changes from the instance on stdio, where `serveStdio` routes them onto the open streams, and through the handler's bus over Streamable HTTP.
45
+
46
+ ## Session‑scoped and Minted Resources
47
+
48
+ ### Modules: `resources/session.ts`, `resources/minted.ts`
49
+
50
+ - `getSessionResourceURI(name: string)`: Builds a session resource URI: `demo://resource/session/<name>`.
51
+ - `registerSessionResource(server, resource, type, payload)`: Registers a resource with the given `uri`, `name`, and `mimeType`, returning a `resource_link`. The content is served from memory for the life of the session only. Supports `type: "text" | "blob"` and returns data in the corresponding field.
52
+ - `mintBlobResource(name, mimeType, blob)`: on 2026-07-28, where an instance may not outlive the request, stores the resource process-wide under `demo://resource/minted/<uuid>/<name>` for ten minutes and returns a `resource_link`; `registerMintedResources(server)` serves the store through one template.
53
+ - Intended usage: tools can create and expose artifacts without persisting them. For example, `tools/gzip-file-as-resource.ts` compresses fetched content and returns either a `resource_link` to a session or minted resource, by era, or an inline `resource`, based on `outputType`.
54
+
55
+ ## Logging
56
+
57
+ ### Modules: `server/logging.ts`, `tools/trigger-log-messages.ts`
58
+
59
+ - **2025 era**: `beginSimulatedLogging(server)` periodically sends randomized log messages at different levels, and returns the function that stops it. `toggle-simulated-logging` starts and stops it; the instance's `cleanup()` stops it too. It uses `server.sendLoggingMessage(params, sessionId)` so that the level the client set with `logging/setLevel` is respected by the SDK.
60
+ - **Both eras**: `trigger-log-messages` sends one message per level with `ctx.mcpReq.log(...)`, which the SDK filters by the request's `_meta` log level on 2026-07-28 and by the session level on the 2025 era.
@@ -0,0 +1,44 @@
1
+ # Everything Server – Server Instructions
2
+
3
+ Audience: These instructions are written for an LLM or autonomous agent integrating with the Everything MCP Server.
4
+ Follow them to use, extend, and troubleshoot the server safely and effectively.
5
+
6
+ ## Protocol Versions
7
+
8
+ The server serves two protocol eras. A client on protocol version 2026-07-28 connects with `server/discover` and sends its capabilities with each request; a 2025-era client connects with `initialize`. Some tools exist on one era only, so trust your `tools/list`:
9
+
10
+ - 2026-07-28 only: `simulate-research-query`, `trigger-sampling-request-async` and `trigger-elicitation-request-async`, which run as tasks on the `io.modelcontextprotocol/tasks` extension and need a client that declares it; `trigger-sampling-request-async` also needs `sampling`, and `trigger-elicitation-request-async` form-mode `elicitation`. A call without them fails with `-32021`
11
+ - 2025-era only (deprecated): `toggle-simulated-logging` and `toggle-subscriber-updates`
12
+
13
+ ## Cross-Feature Relationships
14
+
15
+ - If `get-roots-list` is in your tool list, use it to see client workspace roots before file operations
16
+ - `gzip-file-as-resource` creates resources you can read later: for the current session on a 2025-era connection, or for ten minutes at the returned URI on 2026-07-28
17
+ - Use `trigger-log-messages` to see which log levels reach you; on 2026-07-28 the level is set per request in `_meta`
18
+ - Use `trigger-resource-update` and `trigger-list-changed` to see change notifications; on 2026-07-28 they arrive only on a `subscriptions/listen` stream that asked for them
19
+
20
+ ## Constraints & Limitations
21
+
22
+ - `gzip-file-as-resource`: Max fetch size controlled by `GZIP_MAX_FETCH_SIZE` (default 10MB), timeout by `GZIP_MAX_FETCH_TIME_MILLIS` (default 30s), allowed domains by `GZIP_ALLOWED_DOMAINS`
23
+ - Session resources are ephemeral and lost when the session ends; minted resources expire after ten minutes
24
+ - Roots, sampling and logging are deprecated as of protocol version 2026-07-28, as is the HTTP+SSE transport
25
+
26
+ ## Capability-Gated Tools
27
+
28
+ On a 2025-era connection these are registered only if your client declared the capability shown. Otherwise they are absent from `tools/list`, so do not call them. On 2026-07-28 they are always listed, and a call fails if your request did not declare the capability:
29
+
30
+ - `get-roots-list`: `roots`
31
+ - `trigger-sampling-request`: `sampling`
32
+ - `trigger-elicitation-request`: `elicitation.form`, or `elicitation` with no mode
33
+ - `trigger-multi-step-elicitation`: `elicitation.form`, or `elicitation` with no mode
34
+ - `trigger-url-elicitation`: `elicitation.url`
35
+
36
+ ## Operational Patterns
37
+
38
+ - For long operations, use `trigger-long-running-operation` which sends progress notifications
39
+ - Prefer reading resources before calling mutating tools
40
+ - If `get-roots-list` is in your tool list, check its output to understand the client's workspace context
41
+
42
+ ## Easter Egg
43
+
44
+ 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."
@@ -0,0 +1,71 @@
1
+ # Everything Server - Startup Process
2
+
3
+ **[Architecture](architecture.md)
4
+ | [Project Structure](structure.md)
5
+ | Startup Process
6
+ | [Server Features](features.md)
7
+ | [Extension Points](extension.md)
8
+ | [How It Works](how-it-works.md)**
9
+
10
+ ## 1. Everything Server Launcher
11
+
12
+ - Usage `node dist/index.js [stdio|sse|streamableHttp]`
13
+ - Runs the specified **transport manager** to handle client connections.
14
+ - Specify transport type on command line (default `stdio`)
15
+ - `stdio` → `transports/stdio.js`
16
+ - `sse` → `transports/sse.js` (deprecated, 2025-era clients only; prints a warning)
17
+ - `streamableHttp` → `transports/streamableHttp.js`
18
+
19
+ ## 2. The Transport Manager
20
+
21
+ - Serves server instances built by `createServer()` from `server/index.ts`, one per connection (or per request), each for the protocol era the client speaks.
22
+ - Handles communication according to the MCP specs for the chosen transport.
23
+ - **STDIO**:
24
+ - One process‑bound connection, served by the SDK's `serveStdio` entry.
25
+ - The client's first message picks the era: `server/discover` (or any request with the 2026-07-28 `_meta` envelope) for 2026-07-28, `initialize` for the 2025 era. `serveStdio` then builds the server for that era with `createServer({ era })` and pins it to the connection (it may build and discard one more first, to answer a discover probe).
26
+ - Runs an instance's `cleanup()` when it closes, and on `SIGINT` closes the connection, cleans up and exits.
27
+ - **SSE** (deprecated; 2025-era clients only):
28
+ - Supports multiple client connections, one server per `GET /sse` stream.
29
+ - Client transports are mapped to `sessionId`.
30
+ - Hooks server’s `onclose` to clean and remove session.
31
+ - Exposes
32
+ - `/sse` **GET** (SSE stream)
33
+ - `/message` **POST** (JSON‑RPC messages)
34
+ - **Streamable HTTP**: one `/mcp` endpoint for both eras.
35
+ - **2026-07-28**: a session-less **POST** carrying the per-request `_meta` envelope is served by the SDK's `createMcpHandler`, which builds a fresh server per request with `createServer({ era: "modern", publish })`. There are no sessions. Change notifications are published on the handler's subscription bus (`publish`), which reaches every open `subscriptions/listen` stream.
36
+ - **2025 era**: everything else, classified by the SDK's `isLegacyRequest`, keeps the sessionful wiring: a server per session, created on the `initialize` **POST**, with **GET** for the standalone SSE stream and **DELETE** to end the session. Transports are stored by `sessionId`, an event store makes streams resumable, and the session's `cleanup()` runs when it closes. Sessionful serving keeps the server-to-client channel the legacy shim needs for elicitation, sampling and roots.
37
+ - A session-less POST's body is parsed once (up to 4 MiB) to classify it and serve it.
38
+ - **SSE** and **Streamable HTTP** bind their port (`PORT`, default `3001`) through `listenOrExit()` in `transports/listen.ts`.
39
+ - The listening line is printed only once the port is bound.
40
+ - A bind failure, such as a port already in use, is reported on stderr and the process exits non-zero.
41
+
42
+ ## 3. The Server Factory
43
+
44
+ - Invoke `createServer({ era, publish })` from `server/index.ts`
45
+ - Creates a new `McpServer` instance with
46
+ - **Capabilities**:
47
+ - `tools: { listChanged: true }`
48
+ - `logging: {}`
49
+ - `prompts: { listChanged: true }`
50
+ - `resources: { subscribe: true, listChanged: true }`
51
+ - `extensions: { "io.modelcontextprotocol/tasks": {} }` (2026-07-28 only)
52
+ - **Server Instructions**
53
+ - Loaded from the docs folder (`instructions.md`).
54
+ - **Options**
55
+ - Cache hints for the 2026-07-28 cacheable results (`cacheHints`).
56
+ - The `requestState` verifier for multi-round tools (`roundStateCodec`).
57
+ - **Registrations**
58
+ - Builds a per-instance **context** (`server/context.ts`): the era, where change notifications go, the 2025-era resource subscriptions, and a cleanup registry.
59
+ - Registers **tools** via `registerTools(server, context)`, and then by era: `registerModernTools` and the tasks extension (`server/tasks.ts`) for 2026-07-28; `registerLegacyTools` now and `registerConditionalTools` once the client has initialized, for the 2025 era.
60
+ - Registers **resources** via `registerResources(server, context)`.
61
+ - Registers **prompts** via `registerPrompts(server)`.
62
+ - **Other Request Handlers** (2025 era)
63
+ - Sets up resource subscription handlers via `setSubscriptionHandlers(server, subscribed)`.
64
+ - Syncs the client's roots after `initialize` via `syncRoots(server)`, which also installs the `roots/list_changed` handler.
65
+ - **Returns**
66
+ - The `McpServer` instance
67
+ - A `cleanup()` callback that stops the instance's intervals and clears its state
68
+
69
+ ## Enabling Multiple Clients
70
+
71
+ Every piece of per-connection state lives on the server instance that serves the connection: there are no maps keyed by session id. On stdio and on a 2025-era session one instance serves the whole connection; on the 2026-07-28 HTTP path each request gets its own instance, so what must outlive a request (a task, a minted resource) is stored process-wide under a handle the server mints.