@prefecthq/fastmcp-ts 1.5.2 → 1.7.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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CallToolResult as CallToolResult$1, OAuthClientProvider, OAuthClientMetadata, OAuthClientInformationContext, StoredOAuthClientInformation, StoredOAuthTokens, OAuthDiscoveryState, ClientAuthMethod, Transport, ClientCapabilities, VersionNegotiationOptions, PriorDiscovery, InputRequiredOptions, ResponseCacheStore, ProtocolEra, Implementation, ServerCapabilities } from '@modelcontextprotocol/client';
1
+ import { CallToolResult as CallToolResult$1, OAuthClientProvider, OAuthClientMetadata, OAuthClientInformationContext, StoredOAuthClientInformation, StoredOAuthTokens, OAuthDiscoveryState, ClientAuthMethod, Transport, Implementation, ClientCapabilities, VersionNegotiationOptions, PriorDiscovery, InputRequiredOptions, ResponseCacheStore, ProtocolEra, ServerCapabilities } from '@modelcontextprotocol/client';
2
2
  export { ClientCapabilities } from '@modelcontextprotocol/client';
3
3
  import { CreateMessageResult, CreateMessageResultWithTools, CreateMessageRequestParams, LoggingLevel, ElicitRequestParams, ElicitResult, Tool, Resource, Prompt, ResourceTemplateType, TextResourceContents, BlobResourceContents, GetPromptResult, OAuthClientMetadata as OAuthClientMetadata$1, Root, ContentBlock, ModelPreferences, SamplingMessage, ToolChoice } from '@modelcontextprotocol/server';
4
4
  export { BlobResourceContents, ContentBlock, CreateMessageRequestParams, CreateMessageResult, CreateMessageResultWithTools, ElicitRequestParams, ElicitResult, GetPromptResult, LoggingLevel, ModelPreferences, Prompt, PromptArgument, PromptMessage, Resource, ResourceContents, ResourceTemplateType as ResourceTemplate, Root, SamplingMessage, TextResourceContents, Tool, ToolChoice, ToolResultContent, ToolUseContent } from '@modelcontextprotocol/server';
@@ -626,6 +626,12 @@ interface ClientOptions {
626
626
  * A plain string is treated as a Bearer token.
627
627
  */
628
628
  auth?: BearerAuth | OAuth | AsyncHeaderAuth | string;
629
+ /**
630
+ * Identity to advertise to the MCP server. Defaults to `fastmcp-ts` at the
631
+ * installed package version. Set this when FastMCP is embedded in another
632
+ * application.
633
+ */
634
+ clientInfo?: Implementation;
629
635
  handlers?: ClientHandlers;
630
636
  /**
631
637
  * Additional capabilities to advertise to the server. FastMCP preserves
@@ -714,6 +720,12 @@ interface ClientOptions {
714
720
  }
715
721
 
716
722
  interface MultiServerOptions {
723
+ /**
724
+ * Identity to advertise to every MCP server. Defaults to `fastmcp-ts` at the
725
+ * installed package version. Set this when FastMCP is embedded in another
726
+ * application.
727
+ */
728
+ clientInfo?: Implementation;
717
729
  handlers?: ClientHandlers;
718
730
  /**
719
731
  * Additional capabilities to advertise to every server. FastMCP combines
@@ -742,6 +754,7 @@ declare class MultiServerClient implements IClient {
742
754
  /** URI (or namespaced template URI) → server name, populated by list calls */
743
755
  private _uriMap;
744
756
  private readonly _config;
757
+ private readonly _clientInfo;
745
758
  private readonly _handlers;
746
759
  private readonly _roots;
747
760
  private readonly _capabilities;
@@ -852,6 +865,7 @@ declare class Client implements IClient {
852
865
  private static readonly _MAX_REAUTH_ROUNDS;
853
866
  private readonly _input;
854
867
  private readonly _auth;
868
+ private readonly _clientInfo;
855
869
  private readonly _handlers;
856
870
  private readonly _roots;
857
871
  private readonly _capabilities;
package/dist/client.js CHANGED
@@ -938,6 +938,163 @@ function buildClientCapabilities(supplied, inferred) {
938
938
  return capabilities;
939
939
  }
940
940
 
941
+ // package.json
942
+ var package_default = {
943
+ name: "@prefecthq/fastmcp-ts",
944
+ version: "1.7.0",
945
+ description: "\u{1F3CE}\uFE0F The official FastMCP TypeScript library - build MCP servers and clients, fast \u{1F3CE}\uFE0F",
946
+ type: "module",
947
+ exports: {
948
+ "./server": {
949
+ types: "./dist/server.d.ts",
950
+ import: "./dist/server.js"
951
+ },
952
+ "./client": {
953
+ types: "./dist/client.d.ts",
954
+ import: "./dist/client.js"
955
+ }
956
+ },
957
+ browser: {
958
+ child_process: false,
959
+ "node:child_process": false,
960
+ fs: false,
961
+ "fs/promises": false,
962
+ "node:fs": false,
963
+ "node:fs/promises": false,
964
+ http: false,
965
+ "node:http": false,
966
+ https: false,
967
+ "node:https": false,
968
+ os: false,
969
+ "node:os": false,
970
+ path: false,
971
+ "node:path": false,
972
+ "node:url": false,
973
+ "node:process": false,
974
+ "node:stream": false,
975
+ net: false,
976
+ "node:net": false,
977
+ tls: false,
978
+ "node:tls": false,
979
+ "@modelcontextprotocol/client/stdio": false
980
+ },
981
+ sideEffects: false,
982
+ bin: {
983
+ fastmcp: "dist/cli/index.cjs"
984
+ },
985
+ files: [
986
+ "dist",
987
+ "README.md"
988
+ ],
989
+ engines: {
990
+ node: ">=22"
991
+ },
992
+ scripts: {
993
+ build: "tsup",
994
+ prepublishOnly: "npm run build && node scripts/test-dist.mjs && npm run test:browser-bundle",
995
+ test: "vitest run",
996
+ "test:browser-bundle": "node scripts/test-browser-bundle.mjs",
997
+ "test:e2e": "playwright test",
998
+ "test:watch": "vitest",
999
+ "test:coverage": "vitest run --coverage",
1000
+ typecheck: "tsc --noEmit",
1001
+ "conformance:server": "node tests/conformance/run-server.mjs",
1002
+ "conformance:client": "node tests/conformance/run-client.mjs",
1003
+ "docs:dev": "cd docs && npx --yes mint@latest dev",
1004
+ "docs:api": "typedoc && node scripts/generate-api-nav.mjs",
1005
+ "docs:links": "cd docs && npx --yes mint@latest broken-links",
1006
+ changeset: "changeset",
1007
+ "version-packages": "changeset version",
1008
+ release: "changeset publish"
1009
+ },
1010
+ devDependencies: {
1011
+ "@anthropic-ai/sdk": "^0.91.1",
1012
+ "@changesets/cli": "^3.0.0",
1013
+ "@google/genai": "^1.50.1",
1014
+ "@playwright/test": "^1.61.1",
1015
+ "@types/node": "^22.0.0",
1016
+ "@types/url-template": "^2.0.31",
1017
+ "@vitest/coverage-v8": "^4.1.8",
1018
+ arktype: "^2.2.0",
1019
+ esbuild: "^0.28.1",
1020
+ execa: "^9.6.1",
1021
+ "fake-indexeddb": "^6.2.5",
1022
+ "get-bin-path": "^11.0.1",
1023
+ jsdom: "^29.1.1",
1024
+ openai: "^6.34.0",
1025
+ tsup: "^8.5.1",
1026
+ tsx: "^4.21.0",
1027
+ typedoc: "^0.28.0",
1028
+ "typedoc-plugin-markdown": "^4.12.0",
1029
+ typescript: "^5.0.0",
1030
+ valibot: "^1.3.1",
1031
+ vitest: "^4.1.8",
1032
+ zod: "^4.3.6"
1033
+ },
1034
+ repository: {
1035
+ type: "git",
1036
+ url: "git+https://github.com/PrefectHQ/fastmcp-ts.git"
1037
+ },
1038
+ keywords: [
1039
+ "mcp",
1040
+ "mcp-tools",
1041
+ "fastmcp",
1042
+ "mcp-clients",
1043
+ "llms",
1044
+ "model-context-protocol",
1045
+ "mcp-servers",
1046
+ "typescript"
1047
+ ],
1048
+ author: "prefecthq",
1049
+ license: "Apache-2.0",
1050
+ bugs: {
1051
+ url: "https://github.com/PrefectHQ/fastmcp-ts/issues"
1052
+ },
1053
+ homepage: "https://github.com/PrefectHQ/fastmcp-ts#readme",
1054
+ peerDependencies: {
1055
+ "@anthropic-ai/sdk": ">=0.39",
1056
+ "@google/genai": ">=0.7",
1057
+ openai: ">=4"
1058
+ },
1059
+ peerDependenciesMeta: {
1060
+ "@anthropic-ai/sdk": {
1061
+ optional: true
1062
+ },
1063
+ openai: {
1064
+ optional: true
1065
+ },
1066
+ "@google/genai": {
1067
+ optional: true
1068
+ }
1069
+ },
1070
+ dependencies: {
1071
+ "@clack/prompts": "^1.2.0",
1072
+ "@modelcontextprotocol/client": "^2.0.0",
1073
+ "@modelcontextprotocol/core": "^2.0.0",
1074
+ "@modelcontextprotocol/node": "^2.0.0",
1075
+ "@modelcontextprotocol/server": "^2.0.0",
1076
+ "@modelcontextprotocol/server-legacy": "^2.0.0",
1077
+ "@standard-schema/spec": "^1.1.0",
1078
+ "@types/express": "^5.0.6",
1079
+ chalk: "^5.6.2",
1080
+ chokidar: "^5.0.0",
1081
+ citty: "^0.2.2",
1082
+ "cli-table3": "^0.6.5",
1083
+ express: "^5.2.1",
1084
+ "fastest-levenshtein": "^1.0.16",
1085
+ jose: "6.2.2",
1086
+ listr2: "^10.2.1",
1087
+ "url-template": "^3.1.1",
1088
+ yaml: "^2.8.3"
1089
+ }
1090
+ };
1091
+
1092
+ // src/client/options.ts
1093
+ var DEFAULT_CLIENT_INFO = {
1094
+ name: "fastmcp-ts",
1095
+ version: package_default.version
1096
+ };
1097
+
941
1098
  // src/client/results.ts
942
1099
  function normalizeCallToolResult(result) {
943
1100
  return {
@@ -956,6 +1113,7 @@ var MultiServerClient = class _MultiServerClient {
956
1113
  /** URI (or namespaced template URI) → server name, populated by list calls */
957
1114
  _uriMap = /* @__PURE__ */ new Map();
958
1115
  _config;
1116
+ _clientInfo;
959
1117
  _handlers;
960
1118
  _roots;
961
1119
  _capabilities;
@@ -974,6 +1132,7 @@ var MultiServerClient = class _MultiServerClient {
974
1132
  _logLevels = /* @__PURE__ */ new Map();
975
1133
  constructor(config, options) {
976
1134
  this._config = config;
1135
+ this._clientInfo = options?.clientInfo ?? DEFAULT_CLIENT_INFO;
977
1136
  this._handlers = {
978
1137
  log: options?.handlers?.log ?? defaultLogHandler,
979
1138
  progress: options?.handlers?.progress ?? defaultProgressHandler,
@@ -1392,7 +1551,7 @@ ${errors.map(String).join("\n")}`);
1392
1551
  }
1393
1552
  _buildSdkClient() {
1394
1553
  return new SdkClient(
1395
- { name: "fastmcp-ts", version: "1.0.0" },
1554
+ this._clientInfo,
1396
1555
  {
1397
1556
  capabilities: this._capabilities,
1398
1557
  versionNegotiation: this._versionNegotiation
@@ -1483,6 +1642,7 @@ var Client = class _Client {
1483
1642
  static _MAX_REAUTH_ROUNDS = 2;
1484
1643
  _input;
1485
1644
  _auth;
1645
+ _clientInfo;
1486
1646
  _handlers;
1487
1647
  _roots;
1488
1648
  _capabilities;
@@ -1503,6 +1663,7 @@ var Client = class _Client {
1503
1663
  constructor(input, options) {
1504
1664
  this._input = input;
1505
1665
  this._auth = resolveAuth(options?.auth);
1666
+ this._clientInfo = options?.clientInfo ?? DEFAULT_CLIENT_INFO;
1506
1667
  this._handlers = {
1507
1668
  log: options?.handlers?.log ?? defaultLogHandler,
1508
1669
  progress: options?.handlers?.progress ?? defaultProgressHandler,
@@ -1550,7 +1711,7 @@ var Client = class _Client {
1550
1711
  }
1551
1712
  async _doConnect() {
1552
1713
  const sdkClient = new SdkClient2(
1553
- { name: "fastmcp-ts", version: "1.0.0" },
1714
+ this._clientInfo,
1554
1715
  {
1555
1716
  capabilities: this._capabilities,
1556
1717
  listChanged: this._buildListChangedConfig(),