All skillsModule:
Module:
Module:
Module:
Skillintermediate
Everything Server - How It Works
**[Architecture](architecture.md) | [Project Structure](structure.md) | [Startup Process](startup.md) | [Server Features](features.md) | [Extension Points](extension.md) | How It Works**
Claude Code Knowledge Pack7/10/2026
Overview
Everything Server - How It Works
Architecture | Project Structure | Startup Process | Server Features | Extension Points | How It Works
Conditional Tool Registration
Module: server/index.ts
- Some tools require client support for the capability they demonstrate. These are:
get-roots-listtrigger-elicitation-requesttrigger-sampling-request
- Client capabilities aren't known until after initilization handshake is complete.
- Most tools are registered immediately during the Server Factory execution, prior to client connection.
- To defer registration of these commands until client capabilities are known, a
registerConditionalTools(server)function is invoked from anonintitializedhandler.
Resource Subscriptions
Module: resources/subscriptions.ts
- Tracks subscribers per URI:
Map<uri, Set<sessionId>>. - Installs handlers via
setSubscriptionHandlers(server)to process subscribe/unsubscribe requests and keep the map updated. - Updates are started/stopped on demand by the
toggle-subscriber-updatestool, which callsbeginSimulatedResourceUpdates(server, sessionId)andstopSimulatedResourceUpdates(sessionId). cleanup(sessionId?)callsstopSimulatedResourceUpdates(sessionId)to clear intervals and remove session‑scoped state.
Session‑scoped Resources
Module: resources/session.ts
getSessionResourceURI(name: string): Builds a session resource URI:demo://resource/session/<name>.registerSessionResource(server, resource, type, payload): Registers a resource with the givenuri,name, andmimeType, returning aresource_link. The content is served from memory for the life of the session only. Supportstype: "text" | "blob"and returns data in the corresponding field.- Intended usage: tools can create and expose per-session artifacts without persisting them. For example,
tools/gzip-file-as-resource.tscompresses fetched content, registers it as a session resource withmimeType: application/gzip, and returns either aresource_linkor an inlineresourcebased onoutputType.
Simulated Logging
Module: server/logging.ts
- Periodically sends randomized log messages at different levels. Messages can include the session ID for clarity during demos.
- Started/stopped on demand via the
toggle-simulated-loggingtool, which callsbeginSimulatedLogging(server, sessionId?)andstopSimulatedLogging(sessionId?). Note that transport disconnect triggerscleanup()which also stops any active intervals. - Uses
server.sendLoggingMessage({ level, data }, sessionId?)so that the client’s configured minimum logging level is respected by the SDK.