fastmcp 4.14.4 → 4.15.1

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 _chunkMD6EC4EYcjs = require('./chunk-MD6EC4EY.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 = _chunkMD6EC4EYcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkMD6EC4EYcjs.FastMCP; exports.FastMCPError = _chunkMD6EC4EYcjs.FastMCPError; exports.FastMCPSession = _chunkMD6EC4EYcjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkMD6EC4EYcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkMD6EC4EYcjs.ServerState; exports.SessionError = _chunkMD6EC4EYcjs.SessionError; exports.UnexpectedStateError = _chunkMD6EC4EYcjs.UnexpectedStateError; exports.UserError = _chunkMD6EC4EYcjs.UserError; exports.audioContent = _chunkMD6EC4EYcjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkMD6EC4EYcjs.imageContent; exports.jsonSchemaAdapter = _chunkMD6EC4EYcjs.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-JI5H5LIK.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -23,7 +23,6 @@ import Fuse from "fuse.js";
23
23
  import { Hono } from "hono";
24
24
  import { startHTTPServer } from "mcp-proxy";
25
25
  import { setTimeout as delay } from "timers/promises";
26
- import { fetch as fetch2 } from "undici";
27
26
  import parseURITemplate from "uri-templates";
28
27
  import { strictJsonSchema, toJsonSchema } from "xsschema";
29
28
  import { z } from "zod";
@@ -204,7 +203,7 @@ var imageContent = async (input) => {
204
203
  if ("url" in input) {
205
204
  const timeoutMs = input.timeoutMs ?? MEDIA_FETCH_TIMEOUT_MS;
206
205
  try {
207
- const response = await fetch2(input.url, {
206
+ const response = await fetch(input.url, {
208
207
  signal: AbortSignal.timeout(timeoutMs)
209
208
  });
210
209
  if (!response.ok) {
@@ -265,7 +264,7 @@ var audioContent = async (input) => {
265
264
  if ("url" in input) {
266
265
  const timeoutMs = input.timeoutMs ?? MEDIA_FETCH_TIMEOUT_MS;
267
266
  try {
268
- const response = await fetch2(input.url, {
267
+ const response = await fetch(input.url, {
269
268
  signal: AbortSignal.timeout(timeoutMs)
270
269
  });
271
270
  if (!response.ok) {
@@ -508,6 +507,7 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
508
507
  #utils;
509
508
  constructor({
510
509
  auth,
510
+ icons,
511
511
  instructions,
512
512
  logger,
513
513
  name,
@@ -520,10 +520,12 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
520
520
  sessionId,
521
521
  stateless = false,
522
522
  streamKeepalive,
523
+ title,
523
524
  tools,
524
525
  transportType,
525
526
  utils,
526
- version
527
+ version,
528
+ websiteUrl
527
529
  }) {
528
530
  super();
529
531
  this.#auth = auth;
@@ -550,7 +552,13 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
550
552
  this.#capabilities.logging = {};
551
553
  this.#capabilities.completions = {};
552
554
  this.#server = new Server(
553
- { name, version },
555
+ {
556
+ ...icons !== void 0 ? { icons } : {},
557
+ name,
558
+ ...title !== void 0 ? { title } : {},
559
+ version,
560
+ ...websiteUrl !== void 0 ? { websiteUrl } : {}
561
+ },
554
562
  { capabilities: this.#capabilities, instructions }
555
563
  );
556
564
  this.#utils = utils;
@@ -1923,6 +1931,7 @@ var FastMCP = class extends FastMCPEventEmitter {
1923
1931
  }
1924
1932
  const session = new FastMCPSession({
1925
1933
  auth,
1934
+ icons: this.#options.icons,
1926
1935
  instructions: this.#options.instructions,
1927
1936
  logger: this.#logger,
1928
1937
  name: this.#options.name,
@@ -1933,10 +1942,12 @@ var FastMCP = class extends FastMCPEventEmitter {
1933
1942
  resourcesTemplates: this.#resourcesTemplates,
1934
1943
  roots: this.#options.roots,
1935
1944
  streamKeepalive: this.#options.streamKeepalive,
1945
+ title: this.#options.title,
1936
1946
  tools: this.#tools,
1937
1947
  transportType: "stdio",
1938
1948
  utils: this.#options.utils,
1939
- version: this.#options.version
1949
+ version: this.#options.version,
1950
+ websiteUrl: this.#options.websiteUrl
1940
1951
  });
1941
1952
  await session.connect(transport);
1942
1953
  let stdinClosed = false;
@@ -2121,6 +2132,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2121
2132
  ) : this.#tools;
2122
2133
  return new FastMCPSession({
2123
2134
  auth,
2135
+ icons: this.#options.icons,
2124
2136
  instructions: this.#options.instructions,
2125
2137
  logger: this.#logger,
2126
2138
  name: this.#options.name,
@@ -2133,10 +2145,12 @@ var FastMCP = class extends FastMCPEventEmitter {
2133
2145
  sessionId,
2134
2146
  stateless,
2135
2147
  streamKeepalive: this.#options.streamKeepalive,
2148
+ title: this.#options.title,
2136
2149
  tools: allowedTools,
2137
2150
  transportType: "httpStream",
2138
2151
  utils: this.#options.utils,
2139
- version: this.#options.version
2152
+ version: this.#options.version,
2153
+ websiteUrl: this.#options.websiteUrl
2140
2154
  });
2141
2155
  }
2142
2156
  /**
@@ -2747,4 +2761,4 @@ export {
2747
2761
  FastMCPSession,
2748
2762
  FastMCP
2749
2763
  };
2750
- //# sourceMappingURL=chunk-YAU737SP.js.map
2764
+ //# sourceMappingURL=chunk-JI5H5LIK.js.map