mcp-use 1.2.0-canary.5 → 1.2.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.
|
@@ -918,17 +918,17 @@ if (container && Component) {
|
|
|
918
918
|
});
|
|
919
919
|
for (const widget of widgets) {
|
|
920
920
|
const type = "appsSdk";
|
|
921
|
-
let
|
|
921
|
+
let metadata = {};
|
|
922
922
|
let props = {};
|
|
923
923
|
let description = widget.description;
|
|
924
924
|
try {
|
|
925
925
|
const mod = await viteServer.ssrLoadModule(widget.entry);
|
|
926
926
|
if (mod.widgetMetadata) {
|
|
927
|
-
|
|
928
|
-
description =
|
|
929
|
-
if (
|
|
927
|
+
metadata = mod.widgetMetadata;
|
|
928
|
+
description = metadata.description || widget.description;
|
|
929
|
+
if (metadata.inputs) {
|
|
930
930
|
try {
|
|
931
|
-
props =
|
|
931
|
+
props = metadata.inputs.shape || {};
|
|
932
932
|
} catch (error) {
|
|
933
933
|
console.warn(`[WIDGET] Failed to extract props schema for ${widget.name}:`, error);
|
|
934
934
|
}
|
|
@@ -937,6 +937,7 @@ if (container && Component) {
|
|
|
937
937
|
} catch (error) {
|
|
938
938
|
console.warn(`[WIDGET] Failed to load metadata for ${widget.name}:`, error);
|
|
939
939
|
}
|
|
940
|
+
console.log("[WIDGET dev] Metadata:", metadata);
|
|
940
941
|
let html = "";
|
|
941
942
|
try {
|
|
942
943
|
html = (0, import_node_fs2.readFileSync)((0, import_node_path.join)(tempDir, widget.name, "index.html"), "utf8");
|
|
@@ -966,42 +967,45 @@ if (container && Component) {
|
|
|
966
967
|
}
|
|
967
968
|
this.uiResource({
|
|
968
969
|
name: widget.name,
|
|
969
|
-
title:
|
|
970
|
+
title: metadata.title || widget.name,
|
|
970
971
|
description,
|
|
971
972
|
type,
|
|
972
973
|
props,
|
|
973
974
|
_meta: {
|
|
974
975
|
"mcp-use/widget": {
|
|
975
976
|
name: widget.name,
|
|
976
|
-
title:
|
|
977
|
+
title: metadata.title || widget.name,
|
|
977
978
|
description,
|
|
978
979
|
type,
|
|
979
980
|
props,
|
|
980
981
|
html,
|
|
981
982
|
dev: true
|
|
982
983
|
},
|
|
983
|
-
...
|
|
984
|
+
...metadata._meta || {}
|
|
984
985
|
},
|
|
985
986
|
htmlTemplate: html,
|
|
986
987
|
appsSdkMetadata: {
|
|
987
988
|
"openai/widgetDescription": description,
|
|
988
|
-
"openai/toolInvocation/invoking":
|
|
989
|
-
"openai/toolInvocation/invoked":
|
|
989
|
+
"openai/toolInvocation/invoking": `Loading ${widget.name}...`,
|
|
990
|
+
"openai/toolInvocation/invoked": `${widget.name} ready`,
|
|
990
991
|
"openai/widgetAccessible": true,
|
|
991
992
|
"openai/resultCanProduceWidget": true,
|
|
993
|
+
...metadata.appsSdkMetadata || {},
|
|
992
994
|
"openai/widgetCSP": {
|
|
993
995
|
connect_domains: [
|
|
994
|
-
|
|
996
|
+
// always also add the base url of the server
|
|
997
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
998
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.connect_domains || []
|
|
995
999
|
],
|
|
996
1000
|
resource_domains: [
|
|
997
1001
|
"https://*.oaistatic.com",
|
|
998
1002
|
"https://*.oaiusercontent.com",
|
|
999
1003
|
// always also add the base url of the server
|
|
1000
|
-
...this.serverBaseUrl ? [this.serverBaseUrl] : []
|
|
1004
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
1005
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.resource_domains || []
|
|
1001
1006
|
]
|
|
1002
1007
|
}
|
|
1003
|
-
}
|
|
1004
|
-
...widgetMetadata.appsSdkMetadata || {}
|
|
1008
|
+
}
|
|
1005
1009
|
});
|
|
1006
1010
|
}
|
|
1007
1011
|
}
|
|
@@ -1109,14 +1113,16 @@ if (container && Component) {
|
|
|
1109
1113
|
...metadata.appsSdkMetadata || {},
|
|
1110
1114
|
"openai/widgetCSP": {
|
|
1111
1115
|
connect_domains: [
|
|
1112
|
-
|
|
1116
|
+
// always also add the base url of the server
|
|
1117
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
1118
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.connect_domains || []
|
|
1113
1119
|
],
|
|
1114
1120
|
resource_domains: [
|
|
1115
1121
|
"https://*.oaistatic.com",
|
|
1116
1122
|
"https://*.oaiusercontent.com",
|
|
1117
1123
|
// always also add the base url of the server
|
|
1118
1124
|
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
1119
|
-
...metadata.appsSdkMetadata?.resource_domains || []
|
|
1125
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.resource_domains || []
|
|
1120
1126
|
]
|
|
1121
1127
|
}
|
|
1122
1128
|
}
|
package/dist/src/server/index.js
CHANGED
|
@@ -880,17 +880,17 @@ if (container && Component) {
|
|
|
880
880
|
});
|
|
881
881
|
for (const widget of widgets) {
|
|
882
882
|
const type = "appsSdk";
|
|
883
|
-
let
|
|
883
|
+
let metadata = {};
|
|
884
884
|
let props = {};
|
|
885
885
|
let description = widget.description;
|
|
886
886
|
try {
|
|
887
887
|
const mod = await viteServer.ssrLoadModule(widget.entry);
|
|
888
888
|
if (mod.widgetMetadata) {
|
|
889
|
-
|
|
890
|
-
description =
|
|
891
|
-
if (
|
|
889
|
+
metadata = mod.widgetMetadata;
|
|
890
|
+
description = metadata.description || widget.description;
|
|
891
|
+
if (metadata.inputs) {
|
|
892
892
|
try {
|
|
893
|
-
props =
|
|
893
|
+
props = metadata.inputs.shape || {};
|
|
894
894
|
} catch (error) {
|
|
895
895
|
console.warn(`[WIDGET] Failed to extract props schema for ${widget.name}:`, error);
|
|
896
896
|
}
|
|
@@ -899,6 +899,7 @@ if (container && Component) {
|
|
|
899
899
|
} catch (error) {
|
|
900
900
|
console.warn(`[WIDGET] Failed to load metadata for ${widget.name}:`, error);
|
|
901
901
|
}
|
|
902
|
+
console.log("[WIDGET dev] Metadata:", metadata);
|
|
902
903
|
let html = "";
|
|
903
904
|
try {
|
|
904
905
|
html = readFileSync(join(tempDir, widget.name, "index.html"), "utf8");
|
|
@@ -928,42 +929,45 @@ if (container && Component) {
|
|
|
928
929
|
}
|
|
929
930
|
this.uiResource({
|
|
930
931
|
name: widget.name,
|
|
931
|
-
title:
|
|
932
|
+
title: metadata.title || widget.name,
|
|
932
933
|
description,
|
|
933
934
|
type,
|
|
934
935
|
props,
|
|
935
936
|
_meta: {
|
|
936
937
|
"mcp-use/widget": {
|
|
937
938
|
name: widget.name,
|
|
938
|
-
title:
|
|
939
|
+
title: metadata.title || widget.name,
|
|
939
940
|
description,
|
|
940
941
|
type,
|
|
941
942
|
props,
|
|
942
943
|
html,
|
|
943
944
|
dev: true
|
|
944
945
|
},
|
|
945
|
-
...
|
|
946
|
+
...metadata._meta || {}
|
|
946
947
|
},
|
|
947
948
|
htmlTemplate: html,
|
|
948
949
|
appsSdkMetadata: {
|
|
949
950
|
"openai/widgetDescription": description,
|
|
950
|
-
"openai/toolInvocation/invoking":
|
|
951
|
-
"openai/toolInvocation/invoked":
|
|
951
|
+
"openai/toolInvocation/invoking": `Loading ${widget.name}...`,
|
|
952
|
+
"openai/toolInvocation/invoked": `${widget.name} ready`,
|
|
952
953
|
"openai/widgetAccessible": true,
|
|
953
954
|
"openai/resultCanProduceWidget": true,
|
|
955
|
+
...metadata.appsSdkMetadata || {},
|
|
954
956
|
"openai/widgetCSP": {
|
|
955
957
|
connect_domains: [
|
|
956
|
-
|
|
958
|
+
// always also add the base url of the server
|
|
959
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
960
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.connect_domains || []
|
|
957
961
|
],
|
|
958
962
|
resource_domains: [
|
|
959
963
|
"https://*.oaistatic.com",
|
|
960
964
|
"https://*.oaiusercontent.com",
|
|
961
965
|
// always also add the base url of the server
|
|
962
|
-
...this.serverBaseUrl ? [this.serverBaseUrl] : []
|
|
966
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
967
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.resource_domains || []
|
|
963
968
|
]
|
|
964
969
|
}
|
|
965
|
-
}
|
|
966
|
-
...widgetMetadata.appsSdkMetadata || {}
|
|
970
|
+
}
|
|
967
971
|
});
|
|
968
972
|
}
|
|
969
973
|
}
|
|
@@ -1071,14 +1075,16 @@ if (container && Component) {
|
|
|
1071
1075
|
...metadata.appsSdkMetadata || {},
|
|
1072
1076
|
"openai/widgetCSP": {
|
|
1073
1077
|
connect_domains: [
|
|
1074
|
-
|
|
1078
|
+
// always also add the base url of the server
|
|
1079
|
+
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
1080
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.connect_domains || []
|
|
1075
1081
|
],
|
|
1076
1082
|
resource_domains: [
|
|
1077
1083
|
"https://*.oaistatic.com",
|
|
1078
1084
|
"https://*.oaiusercontent.com",
|
|
1079
1085
|
// always also add the base url of the server
|
|
1080
1086
|
...this.serverBaseUrl ? [this.serverBaseUrl] : [],
|
|
1081
|
-
...metadata.appsSdkMetadata?.resource_domains || []
|
|
1087
|
+
...metadata.appsSdkMetadata?.["openai/widgetCSP"]?.resource_domains || []
|
|
1082
1088
|
]
|
|
1083
1089
|
}
|
|
1084
1090
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,oBAAoB,EAIrB,MAAM,kBAAkB,CAAA;AAGzB,OAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[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 -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../src/server/types/widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-use",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents and Clients + MCP Servers with support for MCP-UI.",
|
|
6
6
|
"author": "mcp-use, Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"ws": "^8.18.2",
|
|
113
113
|
"zod": "^3.25.48",
|
|
114
114
|
"zod-to-json-schema": "^3.24.6",
|
|
115
|
-
"@mcp-use/cli": "2.1.21
|
|
116
|
-
"@mcp-use/inspector": "0.4.9
|
|
115
|
+
"@mcp-use/cli": "2.1.21",
|
|
116
|
+
"@mcp-use/inspector": "0.4.9"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@antfu/eslint-config": "^4.13.2",
|