@prefecthq/fastmcp-ts 0.0.6 → 0.1.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.
package/dist/server.d.ts CHANGED
@@ -595,6 +595,7 @@ declare class FastMCP {
595
595
  private _primaryState;
596
596
  private _httpServer;
597
597
  private _address;
598
+ private _isRunning;
598
599
  private _sessions;
599
600
  private _primaryServer;
600
601
  private _toolRegisteredCallbacks;
@@ -770,6 +771,12 @@ declare class FastMCP {
770
771
  getContext(): McpContext;
771
772
  /** The bound address after run() resolves for the http transport. Null for stdio or before run(). */
772
773
  get address(): ServerAddress | null;
774
+ /**
775
+ * Whether `run()` or `connect()` has been called on this instance. Used by the
776
+ * CLI's entrypoint loader to detect servers that already started themselves via
777
+ * top-level code, so it doesn't attempt to start them a second time.
778
+ */
779
+ get isRunning(): boolean;
773
780
  connect(transport: Transport): Promise<void>;
774
781
  run(options?: RunOptions): Promise<void>;
775
782
  private _runHttpOAuth;
package/dist/server.js CHANGED
@@ -681,6 +681,7 @@ var FastMCP = class {
681
681
  _primaryState = /* @__PURE__ */ new Map();
682
682
  _httpServer = null;
683
683
  _address = null;
684
+ _isRunning = false;
684
685
  _sessions = /* @__PURE__ */ new Map();
685
686
  // Primary server used by connect() and stdio
686
687
  _primaryServer;
@@ -1588,11 +1589,21 @@ var FastMCP = class {
1588
1589
  get address() {
1589
1590
  return this._address;
1590
1591
  }
1592
+ /**
1593
+ * Whether `run()` or `connect()` has been called on this instance. Used by the
1594
+ * CLI's entrypoint loader to detect servers that already started themselves via
1595
+ * top-level code, so it doesn't attempt to start them a second time.
1596
+ */
1597
+ get isRunning() {
1598
+ return this._isRunning;
1599
+ }
1591
1600
  async connect(transport) {
1601
+ this._isRunning = true;
1592
1602
  this._primaryServer = this._makeServer();
1593
1603
  await this._primaryServer.connect(transport);
1594
1604
  }
1595
1605
  async run(options) {
1606
+ this._isRunning = true;
1596
1607
  const rawTransport = process.env.MCP_TRANSPORT ?? options?.transport ?? "stdio";
1597
1608
  if (rawTransport !== "stdio" && rawTransport !== "http") {
1598
1609
  throw new Error(`Unknown transport: "${rawTransport}". Supported: stdio, http.`);