MCP Server Framework - v1.0.0
    Preparing search index...

    Interface ServerInstance

    Result from server builder/factory.

    interface ServerInstance {
        isRunning: boolean;
        name: string;
        version: string;
        initTelemetry(): Promise<void>;
        notifyPromptListChanged(): void;
        notifyResourceListChanged(): void;
        notifyResourceUpdated(uri: string): void;
        notifyToolListChanged(): void;
        start(): Promise<void>;
        stop(): Promise<void>;
    }
    Index

    Properties

    isRunning: boolean

    Whether the server is running

    name: string

    Server name

    version: string

    Server version

    Methods

    • Initialize OpenTelemetry before starting the server.

      OTEL auto-instrumentation must be initialized before any HTTP/Express modules are loaded to properly instrument them. Call this method as early as possible in your application bootstrap.

      If not called explicitly, start() will initialize telemetry automatically as a fallback (but auto-instrumentation may miss modules already loaded).

      No-op if telemetry is not enabled in server options.

      Returns Promise<void>

      const server = builder.build();
      await server.initTelemetry(); // Before any other imports
      await server.start();
    • Notify all connected MCP clients that the prompt list has changed.

      Call this when prompt availability changes dynamically. The framework will send notifications/prompts/list_changed to all connected clients per MCP specification.

      Returns void

    • Notify all connected MCP clients that the resource list has changed.

      Call this when resource availability changes dynamically. The framework will send notifications/resources/list_changed to all connected clients per MCP specification.

      Returns void

    • Notify subscribed MCP clients that a specific resource has been updated.

      Only clients that previously sent resources/subscribe for the given URI receive the notifications/resources/updated notification.

      Requires capabilities: { resources: { subscribe: true } } to be set.

      Parameters

      • uri: string

        The resource URI that has changed

      Returns void

      // When a monitored resource changes
      server.notifyResourceUpdated('config://app/settings');
    • Notify all connected MCP clients that the tool list has changed.

      Call this when tool availability changes (e.g., connection state). The framework will send notifications/tools/list_changed to all connected clients per MCP specification.

      Returns void

      // When API connection established
      apiClient.on('connected', () => server.notifyToolListChanged());

      // When API connection lost
      apiClient.on('disconnected', () => server.notifyToolListChanged());