create-mcp-use-app 0.7.5-canary.0 → 0.8.0-canary.2
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.
|
@@ -47,11 +47,13 @@ server.get("/api/fruits", (c) => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// Brand Info Tool - Returns brand information
|
|
50
|
-
server.tool(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
server.tool(
|
|
51
|
+
{
|
|
52
|
+
name: "get-brand-info",
|
|
53
|
+
description:
|
|
54
|
+
"Get information about the brand, including company details, mission, and values",
|
|
55
|
+
},
|
|
56
|
+
async () => {
|
|
55
57
|
return {
|
|
56
58
|
content: [
|
|
57
59
|
{
|
|
@@ -91,8 +93,8 @@ server.tool({
|
|
|
91
93
|
},
|
|
92
94
|
],
|
|
93
95
|
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
+
}
|
|
97
|
+
);
|
|
96
98
|
|
|
97
99
|
server.listen().then(() => {
|
|
98
100
|
console.log(`Server running`);
|
|
@@ -256,10 +256,12 @@ root.appendChild(container);
|
|
|
256
256
|
* You can mix UIResources with traditional MCP tools and resources
|
|
257
257
|
*/
|
|
258
258
|
|
|
259
|
-
server.tool(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
server.tool(
|
|
260
|
+
{
|
|
261
|
+
name: "get-widget-info",
|
|
262
|
+
description: "Get information about available UI widgets",
|
|
263
|
+
},
|
|
264
|
+
async () => {
|
|
263
265
|
const widgets = [
|
|
264
266
|
{
|
|
265
267
|
name: "kanban-board",
|
|
@@ -303,8 +305,8 @@ server.tool({
|
|
|
303
305
|
},
|
|
304
306
|
],
|
|
305
307
|
};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
+
}
|
|
309
|
+
);
|
|
308
310
|
|
|
309
311
|
server.resource({
|
|
310
312
|
name: "server-config",
|
|
@@ -28,11 +28,13 @@ const server = createMCPServer("my-mcp-server", {
|
|
|
28
28
|
* Define MCP tools
|
|
29
29
|
* Docs: https://docs.mcp-use.com/typescript/server/tools
|
|
30
30
|
*/
|
|
31
|
-
server.tool(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
server.tool(
|
|
32
|
+
{
|
|
33
|
+
name: "fetch-weather",
|
|
34
|
+
description: "Fetch the weather for a city",
|
|
35
|
+
inputs: [{ name: "city", type: "string", required: true }],
|
|
36
|
+
},
|
|
37
|
+
async (params: Record<string, any>) => {
|
|
36
38
|
const city = params.city as string;
|
|
37
39
|
const response = await fetch(`https://wttr.in/${city}?format=j1`);
|
|
38
40
|
const data: any = await response.json();
|
|
@@ -45,8 +47,8 @@ server.tool({
|
|
|
45
47
|
},
|
|
46
48
|
],
|
|
47
49
|
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
+
}
|
|
51
|
+
);
|
|
50
52
|
|
|
51
53
|
/*
|
|
52
54
|
* Define MCP resources
|
|
@@ -75,11 +77,13 @@ server.resource({
|
|
|
75
77
|
* Define MCP prompts
|
|
76
78
|
* Docs: https://docs.mcp-use.com/typescript/server/prompts
|
|
77
79
|
*/
|
|
78
|
-
server.prompt(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
server.prompt(
|
|
81
|
+
{
|
|
82
|
+
name: "review-code",
|
|
83
|
+
description: "Review code for best practices and potential issues",
|
|
84
|
+
args: [{ name: "code", type: "string", required: true }],
|
|
85
|
+
},
|
|
86
|
+
async (params: Record<string, any>) => {
|
|
83
87
|
const { code } = params;
|
|
84
88
|
return {
|
|
85
89
|
messages: [
|
|
@@ -92,8 +96,8 @@ server.prompt({
|
|
|
92
96
|
},
|
|
93
97
|
],
|
|
94
98
|
};
|
|
95
|
-
}
|
|
96
|
-
|
|
99
|
+
}
|
|
100
|
+
);
|
|
97
101
|
|
|
98
102
|
const PORT = process.env.PORT ? parseInt(process.env.PORT) : 3000;
|
|
99
103
|
console.log(`Server running on port ${PORT}`);
|