fastmcp 4.14.3 → 4.15.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/README.md CHANGED
@@ -2410,6 +2410,27 @@ const server = new FastMCP({
2410
2410
  });
2411
2411
  ```
2412
2412
 
2413
+ ### Server icons and metadata
2414
+
2415
+ You can advertise icons and related metadata for your server. Clients that support icons can show them in their UI:
2416
+
2417
+ ```ts
2418
+ const server = new FastMCP({
2419
+ name: "My Server",
2420
+ version: "1.0.0",
2421
+ websiteUrl: "https://example.com",
2422
+ icons: [
2423
+ {
2424
+ src: "https://example.com/icon.png",
2425
+ mimeType: "image/png",
2426
+ sizes: ["48x48"],
2427
+ },
2428
+ ],
2429
+ });
2430
+ ```
2431
+
2432
+ An optional `title` is also passed through to MCP `initialize` (`serverInfo`), for clients that prefer a display name over the server `name`.
2433
+
2413
2434
  ### Sessions
2414
2435
 
2415
2436
  The `session` object is an instance of `FastMCPSession` and it describes active client sessions.
package/dist/FastMCP.cjs CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkD7MJO6C6cjs = require('./chunk-D7MJO6C6.cjs');
14
+ var _chunk6I3JC3FNcjs = require('./chunk-6I3JC3FN.cjs');
15
15
 
16
16
 
17
17
 
@@ -49,5 +49,5 @@ var _chunk5FVNY65Mcjs = require('./chunk-5FVNY65M.cjs');
49
49
 
50
50
 
51
51
 
52
- exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkD7MJO6C6cjs.DiscoveryDocumentCache; exports.FastMCP = _chunkD7MJO6C6cjs.FastMCP; exports.FastMCPError = _chunkD7MJO6C6cjs.FastMCPError; exports.FastMCPSession = _chunkD7MJO6C6cjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkD7MJO6C6cjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkD7MJO6C6cjs.ServerState; exports.SessionError = _chunkD7MJO6C6cjs.SessionError; exports.UnexpectedStateError = _chunkD7MJO6C6cjs.UnexpectedStateError; exports.UserError = _chunkD7MJO6C6cjs.UserError; exports.audioContent = _chunkD7MJO6C6cjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkD7MJO6C6cjs.imageContent; exports.jsonSchemaAdapter = _chunkD7MJO6C6cjs.jsonSchemaAdapter; exports.requireAll = _chunk5FVNY65Mcjs.requireAll; exports.requireAny = _chunk5FVNY65Mcjs.requireAny; exports.requireAuth = _chunk5FVNY65Mcjs.requireAuth; exports.requireRole = _chunk5FVNY65Mcjs.requireRole; exports.requireScopes = _chunk5FVNY65Mcjs.requireScopes;
52
+ exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunk6I3JC3FNcjs.DiscoveryDocumentCache; exports.FastMCP = _chunk6I3JC3FNcjs.FastMCP; exports.FastMCPError = _chunk6I3JC3FNcjs.FastMCPError; exports.FastMCPSession = _chunk6I3JC3FNcjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk6I3JC3FNcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunk6I3JC3FNcjs.ServerState; exports.SessionError = _chunk6I3JC3FNcjs.SessionError; exports.UnexpectedStateError = _chunk6I3JC3FNcjs.UnexpectedStateError; exports.UserError = _chunk6I3JC3FNcjs.UserError; exports.audioContent = _chunk6I3JC3FNcjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunk6I3JC3FNcjs.imageContent; exports.jsonSchemaAdapter = _chunk6I3JC3FNcjs.jsonSchemaAdapter; exports.requireAll = _chunk5FVNY65Mcjs.requireAll; exports.requireAny = _chunk5FVNY65Mcjs.requireAny; exports.requireAuth = _chunk5FVNY65Mcjs.requireAuth; exports.requireRole = _chunk5FVNY65Mcjs.requireRole; exports.requireScopes = _chunk5FVNY65Mcjs.requireScopes;
53
53
  //# sourceMappingURL=FastMCP.cjs.map
@@ -2,8 +2,8 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
2
  import { EventStore } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
3
3
  import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
4
4
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
5
- import { ResourceLink, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Root, ClientCapabilities, GetPromptResult, CreateMessageRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
- export { ResourceLink } from '@modelcontextprotocol/sdk/types.js';
5
+ import { ResourceLink, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Root, ClientCapabilities, Icon, GetPromptResult, CreateMessageRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
+ export { Icon, ResourceLink } from '@modelcontextprotocol/sdk/types.js';
7
7
  import { StandardSchemaV1 } from '@standard-schema/spec';
8
8
  import { EventEmitter } from 'events';
9
9
  import { Hono } from 'hono';
@@ -455,6 +455,12 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
455
455
  */
456
456
  status?: number;
457
457
  };
458
+ /**
459
+ * Optional icons for this server.
460
+ * Advertised to clients via MCP `initialize` (`serverInfo.icons`) so UIs can
461
+ * show a logo next to the server name.
462
+ */
463
+ icons?: Icon[];
458
464
  instructions?: string;
459
465
  /**
460
466
  * Custom logger instance. If not provided, defaults to console.
@@ -727,6 +733,11 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
727
733
  */
728
734
  logLevel?: LoggingLevel;
729
735
  };
736
+ /**
737
+ * Optional human-readable title for display in client UIs.
738
+ * Advertised via MCP `initialize` (`serverInfo.title`).
739
+ */
740
+ title?: string;
730
741
  /**
731
742
  * General utilities
732
743
  */
@@ -734,6 +745,11 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
734
745
  formatInvalidParamsErrorMessage?: (issues: readonly StandardSchemaV1.Issue[]) => string;
735
746
  };
736
747
  version: `${number}.${number}.${number}`;
748
+ /**
749
+ * Optional URL of the website for this server.
750
+ * Advertised via MCP `initialize` (`serverInfo.websiteUrl`).
751
+ */
752
+ websiteUrl?: string;
737
753
  };
738
754
  type Tool<T extends FastMCPSessionAuth, Params extends ToolParameters = ToolParameters, OutputParams extends ToolParameters = ToolParameters> = {
739
755
  /**
@@ -870,8 +886,9 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
870
886
  get server(): Server;
871
887
  get sessionId(): string | undefined;
872
888
  set sessionId(value: string | undefined);
873
- constructor({ auth, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, tools, transportType, utils, version, }: {
889
+ constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
874
890
  auth?: T;
891
+ icons?: Icon[];
875
892
  instructions?: string;
876
893
  logger: Logger;
877
894
  name: string;
@@ -884,10 +901,12 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
884
901
  sessionId?: string;
885
902
  stateless?: boolean;
886
903
  streamKeepalive?: ServerOptions<T>["streamKeepalive"];
904
+ title?: string;
887
905
  tools: Tool<T>[];
888
906
  transportType?: "httpStream" | "stdio";
889
907
  utils?: ServerOptions<T>["utils"];
890
908
  version: string;
909
+ websiteUrl?: string;
891
910
  });
892
911
  close(): Promise<void>;
893
912
  connect(transport: Transport): Promise<void>;
package/dist/FastMCP.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
2
  import { EventStore } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
3
3
  import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
4
4
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
5
- import { ResourceLink, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Root, ClientCapabilities, GetPromptResult, CreateMessageRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
- export { ResourceLink } from '@modelcontextprotocol/sdk/types.js';
5
+ import { ResourceLink, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, Root, ClientCapabilities, Icon, GetPromptResult, CreateMessageRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
+ export { Icon, ResourceLink } from '@modelcontextprotocol/sdk/types.js';
7
7
  import { StandardSchemaV1 } from '@standard-schema/spec';
8
8
  import { EventEmitter } from 'events';
9
9
  import { Hono } from 'hono';
@@ -455,6 +455,12 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
455
455
  */
456
456
  status?: number;
457
457
  };
458
+ /**
459
+ * Optional icons for this server.
460
+ * Advertised to clients via MCP `initialize` (`serverInfo.icons`) so UIs can
461
+ * show a logo next to the server name.
462
+ */
463
+ icons?: Icon[];
458
464
  instructions?: string;
459
465
  /**
460
466
  * Custom logger instance. If not provided, defaults to console.
@@ -727,6 +733,11 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
727
733
  */
728
734
  logLevel?: LoggingLevel;
729
735
  };
736
+ /**
737
+ * Optional human-readable title for display in client UIs.
738
+ * Advertised via MCP `initialize` (`serverInfo.title`).
739
+ */
740
+ title?: string;
730
741
  /**
731
742
  * General utilities
732
743
  */
@@ -734,6 +745,11 @@ type ServerOptions<T extends FastMCPSessionAuth> = {
734
745
  formatInvalidParamsErrorMessage?: (issues: readonly StandardSchemaV1.Issue[]) => string;
735
746
  };
736
747
  version: `${number}.${number}.${number}`;
748
+ /**
749
+ * Optional URL of the website for this server.
750
+ * Advertised via MCP `initialize` (`serverInfo.websiteUrl`).
751
+ */
752
+ websiteUrl?: string;
737
753
  };
738
754
  type Tool<T extends FastMCPSessionAuth, Params extends ToolParameters = ToolParameters, OutputParams extends ToolParameters = ToolParameters> = {
739
755
  /**
@@ -870,8 +886,9 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
870
886
  get server(): Server;
871
887
  get sessionId(): string | undefined;
872
888
  set sessionId(value: string | undefined);
873
- constructor({ auth, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, tools, transportType, utils, version, }: {
889
+ constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
874
890
  auth?: T;
891
+ icons?: Icon[];
875
892
  instructions?: string;
876
893
  logger: Logger;
877
894
  name: string;
@@ -884,10 +901,12 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
884
901
  sessionId?: string;
885
902
  stateless?: boolean;
886
903
  streamKeepalive?: ServerOptions<T>["streamKeepalive"];
904
+ title?: string;
887
905
  tools: Tool<T>[];
888
906
  transportType?: "httpStream" | "stdio";
889
907
  utils?: ServerOptions<T>["utils"];
890
908
  version: string;
909
+ websiteUrl?: string;
891
910
  });
892
911
  close(): Promise<void>;
893
912
  connect(transport: Transport): Promise<void>;
package/dist/FastMCP.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  audioContent,
12
12
  imageContent,
13
13
  jsonSchemaAdapter
14
- } from "./chunk-YAU737SP.js";
14
+ } from "./chunk-3YTVMLYE.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -508,6 +508,7 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
508
508
  #utils;
509
509
  constructor({
510
510
  auth,
511
+ icons,
511
512
  instructions,
512
513
  logger,
513
514
  name,
@@ -520,10 +521,12 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
520
521
  sessionId,
521
522
  stateless = false,
522
523
  streamKeepalive,
524
+ title,
523
525
  tools,
524
526
  transportType,
525
527
  utils,
526
- version
528
+ version,
529
+ websiteUrl
527
530
  }) {
528
531
  super();
529
532
  this.#auth = auth;
@@ -550,7 +553,13 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
550
553
  this.#capabilities.logging = {};
551
554
  this.#capabilities.completions = {};
552
555
  this.#server = new Server(
553
- { name, version },
556
+ {
557
+ ...icons !== void 0 ? { icons } : {},
558
+ name,
559
+ ...title !== void 0 ? { title } : {},
560
+ version,
561
+ ...websiteUrl !== void 0 ? { websiteUrl } : {}
562
+ },
554
563
  { capabilities: this.#capabilities, instructions }
555
564
  );
556
565
  this.#utils = utils;
@@ -1923,6 +1932,7 @@ var FastMCP = class extends FastMCPEventEmitter {
1923
1932
  }
1924
1933
  const session = new FastMCPSession({
1925
1934
  auth,
1935
+ icons: this.#options.icons,
1926
1936
  instructions: this.#options.instructions,
1927
1937
  logger: this.#logger,
1928
1938
  name: this.#options.name,
@@ -1933,10 +1943,12 @@ var FastMCP = class extends FastMCPEventEmitter {
1933
1943
  resourcesTemplates: this.#resourcesTemplates,
1934
1944
  roots: this.#options.roots,
1935
1945
  streamKeepalive: this.#options.streamKeepalive,
1946
+ title: this.#options.title,
1936
1947
  tools: this.#tools,
1937
1948
  transportType: "stdio",
1938
1949
  utils: this.#options.utils,
1939
- version: this.#options.version
1950
+ version: this.#options.version,
1951
+ websiteUrl: this.#options.websiteUrl
1940
1952
  });
1941
1953
  await session.connect(transport);
1942
1954
  let stdinClosed = false;
@@ -2121,6 +2133,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2121
2133
  ) : this.#tools;
2122
2134
  return new FastMCPSession({
2123
2135
  auth,
2136
+ icons: this.#options.icons,
2124
2137
  instructions: this.#options.instructions,
2125
2138
  logger: this.#logger,
2126
2139
  name: this.#options.name,
@@ -2133,10 +2146,12 @@ var FastMCP = class extends FastMCPEventEmitter {
2133
2146
  sessionId,
2134
2147
  stateless,
2135
2148
  streamKeepalive: this.#options.streamKeepalive,
2149
+ title: this.#options.title,
2136
2150
  tools: allowedTools,
2137
2151
  transportType: "httpStream",
2138
2152
  utils: this.#options.utils,
2139
- version: this.#options.version
2153
+ version: this.#options.version,
2154
+ websiteUrl: this.#options.websiteUrl
2140
2155
  });
2141
2156
  }
2142
2157
  /**
@@ -2747,4 +2762,4 @@ export {
2747
2762
  FastMCPSession,
2748
2763
  FastMCP
2749
2764
  };
2750
- //# sourceMappingURL=chunk-YAU737SP.js.map
2765
+ //# sourceMappingURL=chunk-3YTVMLYE.js.map