Architecture | Project Structure | Startup Process | Server Features | Extension Points | How It Works
server/index.tsget-roots-listtrigger-elicitation-requesttrigger-sampling-requestregisterConditionalTools(server) function is invoked from an onintitialized handler.resources/subscriptions.tsMap<uri, Set<sessionId>>.setSubscriptionHandlers(server) to process subscribe/unsubscribe requests and keep the map updated.toggle-subscriber-updates tool, which calls beginSimulatedResourceUpdates(server, sessionId) and stopSimulatedResourceUpdates(sessionId).cleanup(sessionId?) calls stopSimulatedResourceUpdates(sessionId) to clear intervals and remove session‑scoped state.resources/session.tsgetSessionResourceURI(name: string): Builds a session resource URI: demo://resource/session/<name>.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.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.server/logging.tstoggle-simulated-logging tool, which calls beginSimulatedLogging(server, sessionId?) and stopSimulatedLogging(sessionId?). Note that transport disconnect triggers cleanup() which also stops any active intervals.server.sendLoggingMessage({ level, data }, sessionId?) so that the client’s configured minimum logging level is respected by the SDK.