@modelcontextprotocol/server-everything 2025.12.18 → 2026.1.26

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 (49) hide show
  1. package/README.md +9 -158
  2. package/dist/docs/architecture.md +44 -0
  3. package/dist/docs/extension.md +23 -0
  4. package/dist/docs/features.md +103 -0
  5. package/dist/docs/how-it-works.md +45 -0
  6. package/dist/docs/instructions.md +28 -0
  7. package/dist/docs/startup.md +73 -0
  8. package/dist/docs/structure.md +182 -0
  9. package/dist/index.js +19 -14
  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 +60 -0
  14. package/dist/prompts/simple.js +23 -0
  15. package/dist/resources/files.js +83 -0
  16. package/dist/resources/index.js +33 -0
  17. package/dist/resources/session.js +44 -0
  18. package/dist/resources/subscriptions.js +125 -0
  19. package/dist/resources/templates.js +171 -0
  20. package/dist/server/index.js +93 -0
  21. package/dist/server/logging.js +64 -0
  22. package/dist/server/roots.js +65 -0
  23. package/dist/tools/echo.js +29 -0
  24. package/dist/tools/get-annotated-message.js +81 -0
  25. package/dist/tools/get-env.js +28 -0
  26. package/dist/tools/get-resource-links.js +62 -0
  27. package/dist/tools/get-resource-reference.js +74 -0
  28. package/dist/tools/get-roots-list.js +71 -0
  29. package/dist/tools/get-structured-content.js +72 -0
  30. package/dist/tools/get-sum.js +40 -0
  31. package/dist/tools/get-tiny-image.js +41 -0
  32. package/dist/tools/gzip-file-as-resource.js +182 -0
  33. package/dist/tools/index.js +50 -0
  34. package/dist/tools/simulate-research-query.js +249 -0
  35. package/dist/tools/toggle-simulated-logging.js +41 -0
  36. package/dist/tools/toggle-subscriber-updates.js +44 -0
  37. package/dist/tools/trigger-elicitation-request-async.js +202 -0
  38. package/dist/tools/trigger-elicitation-request.js +210 -0
  39. package/dist/tools/trigger-long-running-operation.js +59 -0
  40. package/dist/tools/trigger-sampling-request-async.js +168 -0
  41. package/dist/tools/trigger-sampling-request.js +71 -0
  42. package/dist/{sse.js → transports/sse.js} +25 -17
  43. package/dist/transports/stdio.js +27 -0
  44. package/dist/transports/streamableHttp.js +206 -0
  45. package/package.json +10 -7
  46. package/dist/everything.js +0 -978
  47. package/dist/instructions.md +0 -23
  48. package/dist/stdio.js +0 -23
  49. package/dist/streamableHttp.js +0 -174
package/README.md CHANGED
@@ -1,166 +1,17 @@
1
1
  # Everything MCP Server
2
+ **[Architecture](docs/architecture.md)
3
+ | [Project Structure](docs/structure.md)
4
+ | [Startup Process](docs/startup.md)
5
+ | [Server Features](docs/features.md)
6
+ | [Extension Points](docs/extension.md)
7
+ | [How It Works](docs/how-it-works.md)**
8
+
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. `printEnv`
31
- - Prints all environment variables
32
- - Useful for debugging MCP server configuration
33
- - No inputs required
34
- - Returns: JSON string of all environment variables
35
-
36
- 5. `sampleLLM`
37
- - Demonstrates LLM sampling capability using MCP sampling feature
38
- - Inputs:
39
- - `prompt` (string): The prompt to send to the LLM
40
- - `maxTokens` (number, default: 100): Maximum tokens to generate
41
- - Returns: Generated LLM response
42
-
43
- 6. `getTinyImage`
44
- - Returns a small test image
45
- - No inputs required
46
- - Returns: Base64 encoded PNG image data
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
-
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
-
75
- 9. `startElicitation`
76
- - Initiates an elicitation (interaction) within the MCP client.
77
- - Inputs:
78
- - `color` (string): Favorite color
79
- - `number` (number, 1-100): Favorite number
80
- - `pets` (enum): Favorite pet
81
- - Returns: Confirmation of the elicitation demo with selection summary.
82
-
83
- 10. `structuredContent`
84
- - Demonstrates a tool returning structured content using the example in the specification
85
- - Provides an output schema to allow testing of client SHOULD advisory to validate the result using the schema
86
- - Inputs:
87
- - `location` (string): A location or ZIP code, mock data is returned regardless of value
88
- - Returns: a response with
89
- - `structuredContent` field conformant to the output schema
90
- - A backward compatible Text Content field, a SHOULD advisory in the specification
91
-
92
- 11. `listRoots`
93
- - Lists the current MCP roots provided by the client
94
- - Demonstrates the roots protocol capability even though this server doesn't access files
95
- - No inputs required
96
- - Returns: List of current roots with their URIs and names, or a message if no roots are set
97
- - Shows how servers can interact with the MCP roots protocol
98
-
99
- ### Resources
100
-
101
- The server provides 100 test resources in two formats:
102
- - Even numbered resources:
103
- - Plaintext format
104
- - URI pattern: `test://static/resource/{even_number}`
105
- - Content: Simple text description
106
-
107
- - Odd numbered resources:
108
- - Binary blob format
109
- - URI pattern: `test://static/resource/{odd_number}`
110
- - Content: Base64 encoded binary data
111
-
112
- Resource features:
113
- - Supports pagination (10 items per page)
114
- - Allows subscribing to resource updates
115
- - Demonstrates resource templates
116
- - Auto-updates subscribed resources every 5 seconds
117
-
118
- ### Prompts
119
-
120
- 1. `simple_prompt`
121
- - Basic prompt without arguments
122
- - Returns: Single message exchange
123
-
124
- 2. `complex_prompt`
125
- - Advanced prompt demonstrating argument handling
126
- - Required arguments:
127
- - `temperature` (string): Temperature setting
128
- - Optional arguments:
129
- - `style` (string): Output style preference
130
- - Returns: Multi-turn conversation with images
131
-
132
- 3. `resource_prompt`
133
- - Demonstrates embedding resource references in prompts
134
- - Required arguments:
135
- - `resourceId` (number): ID of the resource to embed (1-100)
136
- - Returns: Multi-turn conversation with an embedded resource reference
137
- - Shows how to include resources directly in prompt messages
138
-
139
- ### Roots
140
-
141
- The server demonstrates the MCP roots protocol capability:
142
-
143
- - Declares `roots: { listChanged: true }` capability to indicate support for roots
144
- - Handles `roots/list_changed` notifications from clients
145
- - Requests initial roots during server initialization
146
- - Provides a `listRoots` tool to display current roots
147
- - Logs roots-related events for demonstration purposes
148
-
149
- Note: This server doesn't actually access files, but demonstrates how servers can interact with the roots protocol for clients that need to understand which directories are available for file operations.
150
-
151
- ### Logging
152
-
153
- The server sends random-leveled log messages every 15 seconds, e.g.:
12
+ ## Tools, Resources, Prompts, and Other Features
154
13
 
155
- ```json
156
- {
157
- "method": "notifications/message",
158
- "params": {
159
- "level": "info",
160
- "data": "Info-level message"
161
- }
162
- }
163
- ```
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.
164
15
 
165
16
  ## Usage with Claude Desktop (uses [stdio Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#stdio))
166
17
 
@@ -0,0 +1,44 @@
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, SSE, and Streamable HTTP).
18
+
19
+ ### Design
20
+
21
+ A small “server factory” constructs the MCP server and registers features.
22
+ Transports are separate entry points that create/connect the server and handle network concerns.
23
+ Tools, prompts, and resources are organized in their own submodules.
24
+
25
+ ### Multi‑client
26
+
27
+ The server supports multiple concurrent clients. Tracking per session data is demonstrated with
28
+ resource subscriptions and simulated logging.
29
+
30
+ ## Build and Distribution
31
+
32
+ - TypeScript sources are compiled into `dist/` via `npm run build`.
33
+ - The `build` script copies `docs/` into `dist/` so instruction files ship alongside the compiled server.
34
+ - The CLI bin is configured in `package.json` as `mcp-server-everything` → `dist/index.js`.
35
+
36
+ ## [Project Structure](structure.md)
37
+
38
+ ## [Startup Process](startup.md)
39
+
40
+ ## [Server Features](features.md)
41
+
42
+ ## [Extension Points](extension.md)
43
+
44
+ ## [How It Works](how-it-works.md)
@@ -0,0 +1,23 @@
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(...)`.
13
+ - Export and call it from `tools/index.ts` inside `registerTools(server)`.
14
+
15
+ ## Adding Prompts
16
+
17
+ - Create a new file under `prompts/` with your `registerXPrompt(server)` function that registers the prompt via `server.registerPrompt(...)`.
18
+ - Export and call it from `prompts/index.ts` inside `registerPrompts(server)`.
19
+
20
+ ## Adding Resources
21
+
22
+ - Create a new file under `resources/` with your `registerXResources(server)` function using `server.registerResource(...)` (optionally with `ResourceTemplate`).
23
+ - Export and call it from `resources/index.ts` inside `registerResources(server)`.
@@ -0,0 +1,103 @@
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
+ ## Tools
11
+
12
+ - `echo` (tools/echo.ts): Echoes the provided `message: string`. Uses Zod to validate inputs.
13
+ - `get-annotated-message` (tools/get-annotated-message.ts): Returns a `text` message annotated with `priority` and `audience` based on `messageType` (`error`, `success`, or `debug`); can optionally include an annotated `image`.
14
+ - `get-env` (tools/get-env.ts): Returns all environment variables from the running process as pretty-printed JSON text.
15
+ - `get-resource-links` (tools/get-resource-links.ts): 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`.
16
+ - `get-resource-reference` (tools/get-resource-reference.ts): 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`.
17
+ - `get-roots-list` (tools/get-roots-list.ts): Returns the last list of roots sent by the client.
18
+ - `gzip-file-as-resource` (tools/gzip-file-as-resource.ts): Accepts a `name` and `data` (URL or data URI), fetches the data subject to size/time/domain constraints, compresses it, registers it as a session resource at `demo://resource/session/<name>` with `mimeType: application/gzip`, and returns either a `resource_link` (default) or an inline `resource` depending on `outputType`.
19
+ - `get-structured-content` (tools/get-structured-content.ts): 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).
20
+ - `get-sum` (tools/get-sum.ts): For two numbers `a` and `b` calculates and returns their sum. Uses Zod to validate inputs.
21
+ - `get-tiny-image` (tools/get-tiny-image.ts): Returns a tiny PNG MCP logo as an `image` content item with brief descriptive text before and after.
22
+ - `trigger-long-running-operation` (tools/trigger-trigger-long-running-operation.ts): 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.
23
+ - `toggle-simulated-logging` (tools/toggle-simulated-logging.ts): Starts or stops simulated, random‑leveled logging for the invoking session. Respects the client’s selected minimum logging level.
24
+ - `toggle-subscriber-updates` (tools/toggle-subscriber-updates.ts): Starts or stops simulated resource update notifications for URIs the invoking session has subscribed to.
25
+ - `trigger-sampling-request` (tools/trigger-sampling-request.ts): Issues a `sampling/createMessage` request to the client/LLM using provided `prompt` and optional generation controls; returns the LLM's response payload.
26
+ - `simulate-research-query` (tools/simulate-research-query.ts): Demonstrates MCP Tasks (SEP-1686) with a simulated multi-stage research operation. Accepts `topic` and `ambiguous` parameters. Returns a task that progresses through stages with status updates. If `ambiguous` is true and client supports elicitation, sends an elicitation request directly to gather clarification before completing.
27
+ - `trigger-sampling-request-async` (tools/trigger-sampling-request-async.ts): Demonstrates bidirectional tasks where the server sends a sampling request that the client executes as a background task. Server polls for status and retrieves the LLM result when complete. Requires client to support `tasks.requests.sampling.createMessage`.
28
+ - `trigger-elicitation-request-async` (tools/trigger-elicitation-request-async.ts): Demonstrates bidirectional tasks where the server sends an elicitation request that the client executes as a background task. Server polls while waiting for user input. Requires client to support `tasks.requests.elicitation.create`.
29
+
30
+ ## Prompts
31
+
32
+ - `simple-prompt` (prompts/simple.ts): No-argument prompt that returns a static user message.
33
+ - `args-prompt` (prompts/args.ts): Two-argument prompt with `city` (required) and `state` (optional) used to compose a question.
34
+ - `completable-prompt` (prompts/completions.ts): Demonstrates argument auto-completions with the SDK’s `completable` helper; `department` completions drive context-aware `name` suggestions.
35
+ - `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`.
36
+
37
+ ## Resources
38
+
39
+ - Dynamic Text: `demo://resource/dynamic/text/{index}` (content generated on the fly)
40
+ - Dynamic Blob: `demo://resource/dynamic/blob/{index}` (base64 payload generated on the fly)
41
+ - Static Documents: `demo://resource/static/document/<filename>` (serves files from `src/everything/docs/` as static file-based resources)
42
+ - Session Scoped: `demo://resource/session/<name>` (per-session resources registered dynamically; available only for the lifetime of the session)
43
+
44
+ ## Resource Subscriptions and Notifications
45
+
46
+ - Simulated update notifications are opt‑in and off by default.
47
+ - Clients may subscribe/unsubscribe to resource URIs using the MCP `resources/subscribe` and `resources/unsubscribe` requests.
48
+ - Use the `toggle-subscriber-updates` tool to start/stop a per‑session interval that emits `notifications/resources/updated { uri }` only for URIs that session has subscribed to.
49
+ - Multiple concurrent clients are supported; each client’s subscriptions are tracked per session and notifications are delivered independently via the server instance associated with that session.
50
+
51
+ ## Simulated Logging
52
+
53
+ - Simulated logging is available but off by default.
54
+ - Use the `toggle-simulated-logging` tool to start/stop periodic log messages of varying levels (debug, info, notice, warning, error, critical, alert, emergency) per session.
55
+ - Clients can control the minimum level they receive via the standard MCP `logging/setLevel` request.
56
+
57
+ ## Tasks (SEP-1686)
58
+
59
+ The server advertises support for MCP Tasks, enabling long-running operations with status tracking:
60
+
61
+ - **Capabilities advertised**: `tasks.list`, `tasks.cancel`, `tasks.requests.tools.call`
62
+ - **Task Store**: Uses `InMemoryTaskStore` from SDK experimental for task lifecycle management
63
+ - **Message Queue**: Uses `InMemoryTaskMessageQueue` for task-related messaging
64
+
65
+ ### Task Lifecycle
66
+
67
+ 1. Client calls `tools/call` with `task: true` parameter
68
+ 2. Server returns `CreateTaskResult` with `taskId` instead of immediate result
69
+ 3. Client polls `tasks/get` to check status and receive `statusMessage` updates
70
+ 4. When status is `completed`, client calls `tasks/result` to retrieve the final result
71
+
72
+ ### Task Statuses
73
+
74
+ - `working`: Task is actively processing
75
+ - `input_required`: Task needs additional input (server sends elicitation request directly)
76
+ - `completed`: Task finished successfully
77
+ - `failed`: Task encountered an error
78
+ - `cancelled`: Task was cancelled by client
79
+
80
+ ### Demo Tools
81
+
82
+ **Server-side tasks (client calls server):**
83
+ Use the `simulate-research-query` tool to exercise the full task lifecycle. Set `ambiguous: true` to trigger elicitation - the server will send an `elicitation/create` request directly and await the response before completing.
84
+
85
+ **Client-side tasks (server calls client):**
86
+ Use `trigger-sampling-request-async` or `trigger-elicitation-request-async` to demonstrate bidirectional tasks where the server sends requests that the client executes as background tasks. These require the client to advertise `tasks.requests.sampling.createMessage` or `tasks.requests.elicitation.create` capabilities respectively.
87
+
88
+ ### Bidirectional Task Flow
89
+
90
+ MCP Tasks are bidirectional - both server and client can be task executors:
91
+
92
+ | Direction | Request Type | Task Executor | Demo Tool |
93
+ | ---------------- | ------------------------ | ------------- | ----------------------------------- |
94
+ | Client -> Server | `tools/call` | Server | `simulate-research-query` |
95
+ | Server -> Client | `sampling/createMessage` | Client | `trigger-sampling-request-async` |
96
+ | Server -> Client | `elicitation/create` | Client | `trigger-elicitation-request-async` |
97
+
98
+ For client-side tasks:
99
+
100
+ 1. Server sends request with task metadata (e.g., `params.task.ttl`)
101
+ 2. Client creates task and returns `CreateTaskResult` with `taskId`
102
+ 3. Server polls `tasks/get` for status updates
103
+ 4. When complete, server calls `tasks/result` to retrieve the result
@@ -0,0 +1,45 @@
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
+ ### Module: `server/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-sampling-request`
18
+ - Client capabilities aren't known until after initilization handshake is complete.
19
+ - Most tools are registered immediately during the Server Factory execution, prior to client connection.
20
+ - To defer registration of these commands until client capabilities are known, a `registerConditionalTools(server)` function is invoked from an `onintitialized` handler.
21
+
22
+ ## Resource Subscriptions
23
+
24
+ ### Module: `resources/subscriptions.ts`
25
+
26
+ - Tracks subscribers per URI: `Map<uri, Set<sessionId>>`.
27
+ - Installs handlers via `setSubscriptionHandlers(server)` to process subscribe/unsubscribe requests and keep the map updated.
28
+ - Updates are started/stopped on demand by the `toggle-subscriber-updates` tool, which calls `beginSimulatedResourceUpdates(server, sessionId)` and `stopSimulatedResourceUpdates(sessionId)`.
29
+ - `cleanup(sessionId?)` calls `stopSimulatedResourceUpdates(sessionId)` to clear intervals and remove session‑scoped state.
30
+
31
+ ## Session‑scoped Resources
32
+
33
+ ### Module: `resources/session.ts`
34
+
35
+ - `getSessionResourceURI(name: string)`: Builds a session resource URI: `demo://resource/session/<name>`.
36
+ - `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.
37
+ - Intended usage: tools can create and expose per-session artifacts without persisting them. For example, `tools/gzip-file-as-resource.ts` compresses fetched content, registers it as a session resource with `mimeType: application/gzip`, and returns either a `resource_link` or an inline `resource` based on `outputType`.
38
+
39
+ ## Simulated Logging
40
+
41
+ ### Module: `server/logging.ts`
42
+
43
+ - Periodically sends randomized log messages at different levels. Messages can include the session ID for clarity during demos.
44
+ - Started/stopped on demand via the `toggle-simulated-logging` tool, which calls `beginSimulatedLogging(server, sessionId?)` and `stopSimulatedLogging(sessionId?)`. Note that transport disconnect triggers `cleanup()` which also stops any active intervals.
45
+ - Uses `server.sendLoggingMessage({ level, data }, sessionId?)` so that the client’s configured minimum logging level is respected by the SDK.
@@ -0,0 +1,28 @@
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
+ ## Cross-Feature Relationships
7
+
8
+ - Use `get-roots-list` to see client workspace roots before file operations
9
+ - `gzip-file-as-resource` creates session-scoped resources accessible only during the current session
10
+ - Enable `toggle-simulated-logging` before debugging to see server log messages
11
+ - Enable `toggle-subscriber-updates` to receive periodic resource update notifications
12
+
13
+ ## Constraints & Limitations
14
+
15
+ - `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`
16
+ - Session resources are ephemeral and lost when the session ends
17
+ - Sampling requests (`trigger-sampling-request`) require client sampling capability
18
+ - Elicitation requests (`trigger-elicitation-request`) require client elicitation capability
19
+
20
+ ## Operational Patterns
21
+
22
+ - For long operations, use `trigger-long-running-operation` which sends progress notifications
23
+ - Prefer reading resources before calling mutating tools
24
+ - Check `get-roots-list` output to understand the client's workspace context
25
+
26
+ ## Easter Egg
27
+
28
+ 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,73 @@
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`
17
+ - `streamableHttp` → `transports/streamableHttp.js`
18
+
19
+ ## 2. The Transport Manager
20
+
21
+ - Creates a server instance using `createServer()` from `server/index.ts`
22
+ - Connects it to the chosen transport type from the MCP SDK.
23
+ - Handles communication according to the MCP specs for the chosen transport.
24
+ - **STDIO**:
25
+ - One simple, process‑bound connection.
26
+ - Calls`clientConnect()` upon connection.
27
+ - Closes and calls `cleanup()` on `SIGINT`.
28
+ - **SSE**:
29
+ - Supports multiple client connections.
30
+ - Client transports are mapped to `sessionId`;
31
+ - Calls `clientConnect(sessionId)` upon connection.
32
+ - Hooks server’s `onclose` to clean and remove session.
33
+ - Exposes
34
+ - `/sse` **GET** (SSE stream)
35
+ - `/message` **POST** (JSON‑RPC messages)
36
+ - **Streamable HTTP**:
37
+ - Supports multiple client connections.
38
+ - Client transports are mapped to `sessionId`;
39
+ - Calls `clientConnect(sessionId)` upon connection.
40
+ - Exposes `/mcp` for
41
+ - **POST** (JSON‑RPC messages)
42
+ - **GET** (SSE stream)
43
+ - **DELETE** (termination)
44
+ - Uses an event store for resumability and stores transports by `sessionId`.
45
+ - Calls `cleanup(sessionId)` on **DELETE**.
46
+
47
+ ## 3. The Server Factory
48
+
49
+ - Invoke `createServer()` from `server/index.ts`
50
+ - Creates a new `McpServer` instance with
51
+ - **Capabilities**:
52
+ - `tools: {}`
53
+ - `logging: {}`
54
+ - `prompts: {}`
55
+ - `resources: { subscribe: true }`
56
+ - **Server Instructions**
57
+ - Loaded from the docs folder (`server-instructions.md`).
58
+ - **Registrations**
59
+ - Registers **tools** via `registerTools(server)`.
60
+ - Registers **resources** via `registerResources(server)`.
61
+ - Registers **prompts** via `registerPrompts(server)`.
62
+ - **Other Request Handlers**
63
+ - Sets up resource subscription handlers via `setSubscriptionHandlers(server)`.
64
+ - Roots list change handler is added post-connection via
65
+ - **Returns**
66
+ - The `McpServer` instance
67
+ - A `clientConnect(sessionId)` callback that enables post-connection setup
68
+ - A `cleanup(sessionId?)` callback that stops any active intervals and removes any session‑scoped state
69
+
70
+ ## Enabling Multiple Clients
71
+
72
+ Some of the transport managers defined in the `transports` folder can support multiple clients.
73
+ In order to do so, they must map certain data to a session identifier.