create-mcp-use-app 2.0.0-beta.3 → 2.0.0-beta.4
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 +68 -37
- package/dist/index.js +10 -8
- package/dist/templates/blank/tsconfig.json +2 -1
- package/dist/templates/mcp-apps/index.ts +71 -101
- package/dist/templates/mcp-apps/public/logo-mcp-use.svg +8 -0
- package/dist/templates/mcp-apps/tsconfig.json +2 -1
- package/dist/templates/mcp-apps/views/my-view/MeshGradient.tsx +299 -0
- package/dist/templates/mcp-apps/views/my-view/Tooltip.tsx +75 -0
- package/dist/templates/mcp-apps/views/my-view/icons.tsx +142 -0
- package/dist/templates/mcp-apps/views/my-view/view.css +5 -0
- package/dist/templates/mcp-apps/views/my-view/view.tsx +396 -0
- package/dist/templates/{starter → mcp-server}/README.md +1 -1
- package/dist/templates/{starter → mcp-server}/index.ts +0 -18
- package/dist/templates/{starter → mcp-server}/tsconfig.json +2 -1
- package/package.json +2 -2
- package/dist/templates/mcp-apps/public/fruits/apple.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/apricot.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/avocado.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/banana.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/blueberry.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/cherries.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/coconut.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/grapes.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/lemon.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/mango.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/orange.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/pear.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/pineapple.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/plum.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/strawberry.webp +0 -0
- package/dist/templates/mcp-apps/public/fruits/watermelon.webp +0 -0
- package/dist/templates/mcp-apps/views/product-search-result/components/Accordion.tsx +0 -35
- package/dist/templates/mcp-apps/views/product-search-result/components/AccordionItem.tsx +0 -35
- package/dist/templates/mcp-apps/views/product-search-result/components/Carousel.tsx +0 -52
- package/dist/templates/mcp-apps/views/product-search-result/components/CarouselItem.tsx +0 -91
- package/dist/templates/mcp-apps/views/product-search-result/components/CarouselSkeleton.tsx +0 -18
- package/dist/templates/mcp-apps/views/product-search-result/hooks/useCarouselAnimation.ts +0 -72
- package/dist/templates/mcp-apps/views/product-search-result/view.css +0 -81
- package/dist/templates/mcp-apps/views/product-search-result/view.tsx +0 -371
- /package/dist/templates/{starter → mcp-server}/gitignore +0 -0
- /package/dist/templates/{starter → mcp-server}/package.json +0 -0
- /package/dist/templates/{starter → mcp-server}/public/icon.svg +0 -0
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<img src="https://dcbadge.limes.pink/api/server/XkNkSkMz3V?style=flat" /></a>
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
|
-
🚀 **Create mcp-use App**
|
|
24
|
+
🚀 **Create mcp-use App** scaffolds a TypeScript MCP project with hot reload, the inspector, and MCP Apps view support.
|
|
25
25
|
|
|
26
26
|
## 📦 Related Packages
|
|
27
27
|
|
|
@@ -48,22 +48,20 @@ That's it! Your MCP server is running at `http://localhost:3000` with the inspec
|
|
|
48
48
|
|
|
49
49
|
## 🎯 What It Creates
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The `mcp-apps` template creates this MCP development environment:
|
|
52
52
|
|
|
53
53
|
### Project Structure
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
my-mcp-server/
|
|
57
|
-
├──
|
|
58
|
-
├──
|
|
59
|
-
├── .
|
|
60
|
-
├── .
|
|
61
|
-
├──
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
│ └── example-widget.tsx # Example React widget
|
|
66
|
-
└── dist/ # Build output (generated)
|
|
57
|
+
├── index.ts # MCP server entry point
|
|
58
|
+
├── package.json # Scripts and dependencies
|
|
59
|
+
├── tsconfig.json # TypeScript configuration
|
|
60
|
+
├── mcp-env.d.ts # Generated view typing bridge
|
|
61
|
+
├── public/ # Static assets
|
|
62
|
+
└── views/ # Included by the mcp-apps template
|
|
63
|
+
└── product-search-result/
|
|
64
|
+
└── view.tsx # React view entry point
|
|
67
65
|
```
|
|
68
66
|
|
|
69
67
|
### Pre-configured Features
|
|
@@ -73,7 +71,7 @@ my-mcp-server/
|
|
|
73
71
|
| **📝 TypeScript** | Full TypeScript setup with proper types |
|
|
74
72
|
| **🔥 Hot Reload** | Auto-restart on code changes during development |
|
|
75
73
|
| **🔍 Auto Inspector** | Inspector UI opens automatically in dev mode |
|
|
76
|
-
| **🎨
|
|
74
|
+
| **🎨 MCP Apps Views** | React views discovered and bundled by the CLI |
|
|
77
75
|
| **🛠️ Example Tools** | Sample MCP tools, resources, and prompts |
|
|
78
76
|
| **📦 Build Scripts** | Ready-to-use development and production scripts |
|
|
79
77
|
| **🚀 Production Ready** | Optimized build configuration |
|
|
@@ -139,17 +137,16 @@ npx create-mcp-use-app --list-templates
|
|
|
139
137
|
|
|
140
138
|
## 🎨 Available Templates
|
|
141
139
|
|
|
142
|
-
###
|
|
140
|
+
### MCP Server Template
|
|
143
141
|
|
|
144
|
-
The
|
|
142
|
+
The `mcp-server` template includes:
|
|
145
143
|
|
|
146
|
-
-
|
|
147
|
-
- Example tool
|
|
148
|
-
-
|
|
149
|
-
- Full TypeScript configuration
|
|
144
|
+
- MCP server setup with TypeScript configuration
|
|
145
|
+
- Example tool (`fetch-weather`) with structured output
|
|
146
|
+
- Example prompt (`review-code`)
|
|
150
147
|
- Development and production scripts
|
|
151
148
|
|
|
152
|
-
|
|
149
|
+
Ideal for building MCP servers with tools and prompts (no widgets or resources).
|
|
153
150
|
|
|
154
151
|
### MCP Apps Template
|
|
155
152
|
|
|
@@ -157,7 +154,7 @@ The mcp-apps template includes:
|
|
|
157
154
|
|
|
158
155
|
- MCP server setup focused on OpenAI Apps SDK integration
|
|
159
156
|
- OpenAI Apps SDK compatible views under `views/<name>/view.tsx`
|
|
160
|
-
- Example `
|
|
157
|
+
- Example `my-view` view with mesh gradient card and interactive demo hooks
|
|
161
158
|
- Optimized for OpenAI assistant integration
|
|
162
159
|
|
|
163
160
|
Ideal for building MCP servers that integrate with OpenAI's Apps SDK.
|
|
@@ -268,7 +265,7 @@ After creating your app, here's what to do next:
|
|
|
268
265
|
|
|
269
266
|
### 1. Explore the Example Server
|
|
270
267
|
|
|
271
|
-
Open `
|
|
268
|
+
Open `index.ts` to see how to:
|
|
272
269
|
|
|
273
270
|
- Define MCP tools with Zod schemas
|
|
274
271
|
- Create resources for data access
|
|
@@ -283,28 +280,62 @@ The inspector automatically opens at `http://localhost:3000/inspector` where you
|
|
|
283
280
|
- Debug tool executions
|
|
284
281
|
- Monitor server status
|
|
285
282
|
|
|
286
|
-
### 3. Create
|
|
283
|
+
### 3. Create an MCP Apps view
|
|
287
284
|
|
|
288
|
-
|
|
285
|
+
Bind a tool to a view with the tool definition's `view` field:
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
server.tool(
|
|
289
|
+
{
|
|
290
|
+
name: "show-analytics",
|
|
291
|
+
description: "Show analytics for a reporting period",
|
|
292
|
+
inputSchema: z.object({ period: z.string() }),
|
|
293
|
+
outputSchema: z.object({ period: z.string(), visitors: z.number() }),
|
|
294
|
+
view: { name: "analytics-dashboard" },
|
|
295
|
+
},
|
|
296
|
+
async ({ period }) => {
|
|
297
|
+
const analytics = { period, visitors: 1_024 };
|
|
298
|
+
return {
|
|
299
|
+
content: [{ type: "text", text: JSON.stringify(analytics) }],
|
|
300
|
+
structuredContent: analytics,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Create the component at `views/analytics-dashboard/view.tsx`. Read the bound
|
|
307
|
+
tool result with `useToolContext`; call a server tool with `useCallTool`:
|
|
289
308
|
|
|
290
309
|
```tsx
|
|
291
|
-
import
|
|
292
|
-
|
|
310
|
+
import { useCallTool, useToolContext } from "mcp-use/react";
|
|
311
|
+
|
|
312
|
+
interface Analytics {
|
|
313
|
+
period: string;
|
|
314
|
+
visitors: number;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export default function AnalyticsDashboard() {
|
|
318
|
+
const view = useToolContext();
|
|
319
|
+
const refresh = useCallTool<{ period: string }, Analytics>(
|
|
320
|
+
"show-analytics"
|
|
321
|
+
);
|
|
293
322
|
|
|
294
|
-
|
|
295
|
-
|
|
323
|
+
if (view.status === "pending") return <p>Loading analytics…</p>;
|
|
324
|
+
if (view.status === "error") return <p>{view.error.message}</p>;
|
|
296
325
|
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
param: "value",
|
|
300
|
-
});
|
|
301
|
-
console.log(result);
|
|
302
|
-
};
|
|
326
|
+
const analytics =
|
|
327
|
+
refresh.data?.structuredContent ?? (view.toolOutput as Analytics);
|
|
303
328
|
|
|
304
329
|
return (
|
|
305
|
-
<
|
|
306
|
-
<
|
|
307
|
-
|
|
330
|
+
<main>
|
|
331
|
+
<h1>{analytics.visitors} visitors</h1>
|
|
332
|
+
<button
|
|
333
|
+
disabled={refresh.isPending}
|
|
334
|
+
onClick={() => void refresh.callTool({ period: analytics.period })}
|
|
335
|
+
>
|
|
336
|
+
Refresh
|
|
337
|
+
</button>
|
|
338
|
+
</main>
|
|
308
339
|
);
|
|
309
340
|
}
|
|
310
341
|
```
|
package/dist/index.js
CHANGED
|
@@ -1735,7 +1735,8 @@ function validateTemplateName(template) {
|
|
|
1735
1735
|
return sanitized;
|
|
1736
1736
|
}
|
|
1737
1737
|
const aliases = {
|
|
1738
|
-
"apps-sdk": "mcp-apps"
|
|
1738
|
+
"apps-sdk": "mcp-apps",
|
|
1739
|
+
starter: "mcp-server"
|
|
1739
1740
|
};
|
|
1740
1741
|
const resolvedTemplate = aliases[sanitized] || sanitized;
|
|
1741
1742
|
if (resolvedTemplate.includes("..") || resolvedTemplate.includes("/") || resolvedTemplate.includes("\\")) {
|
|
@@ -1794,7 +1795,7 @@ async function copyTemplate(projectPath, template, versions, isDevelopment = fal
|
|
|
1794
1795
|
console.log("No templates directory found");
|
|
1795
1796
|
}
|
|
1796
1797
|
console.log(
|
|
1797
|
-
'\u{1F4A1} Tip: Use "
|
|
1798
|
+
'\u{1F4A1} Tip: Use "mcp-server" template for an MCP server with an example tool and prompt'
|
|
1798
1799
|
);
|
|
1799
1800
|
console.log(
|
|
1800
1801
|
'\u{1F4A1} Tip: Use "mcp-apps" template for a MCP server that displays Widgets on ChatGPT, Claude, and other mcp-apps compatible clients'
|
|
@@ -1965,7 +1966,7 @@ async function main() {
|
|
|
1965
1966
|
if (interactive) {
|
|
1966
1967
|
selectedTemplate = await promptForTemplate();
|
|
1967
1968
|
} else {
|
|
1968
|
-
selectedTemplate = "
|
|
1969
|
+
selectedTemplate = "mcp-server";
|
|
1969
1970
|
}
|
|
1970
1971
|
}
|
|
1971
1972
|
const trimmedProjectName = projectName.trim();
|
|
@@ -2154,19 +2155,20 @@ async function main() {
|
|
|
2154
2155
|
} else if (validatedTemplate === "mcp-apps") {
|
|
2155
2156
|
console.log(" \u251C\u2500\u2500 public/");
|
|
2156
2157
|
console.log(" \u2502 \u251C\u2500\u2500 icon.svg");
|
|
2157
|
-
console.log(" \u2502 \u2514\u2500\u2500
|
|
2158
|
+
console.log(" \u2502 \u2514\u2500\u2500 logo-mcp-use.svg");
|
|
2158
2159
|
console.log(" \u251C\u2500\u2500 views/");
|
|
2159
|
-
console.log(" \u2502 \u2514\u2500\u2500
|
|
2160
|
+
console.log(" \u2502 \u2514\u2500\u2500 my-view/");
|
|
2160
2161
|
console.log(" \u2502 \u251C\u2500\u2500 view.tsx");
|
|
2161
2162
|
console.log(" \u2502 \u251C\u2500\u2500 view.css");
|
|
2162
|
-
console.log(" \u2502 \u251C\u2500\u2500
|
|
2163
|
-
console.log(" \u2502 \
|
|
2163
|
+
console.log(" \u2502 \u251C\u2500\u2500 icons.tsx");
|
|
2164
|
+
console.log(" \u2502 \u251C\u2500\u2500 Tooltip.tsx");
|
|
2165
|
+
console.log(" \u2502 \u2514\u2500\u2500 MeshGradient.tsx");
|
|
2164
2166
|
console.log(" \u251C\u2500\u2500 mcp-env.d.ts");
|
|
2165
2167
|
console.log(" \u251C\u2500\u2500 index.ts (server entry point)");
|
|
2166
2168
|
console.log(" \u251C\u2500\u2500 package.json");
|
|
2167
2169
|
console.log(" \u251C\u2500\u2500 tsconfig.json");
|
|
2168
2170
|
console.log(" \u2514\u2500\u2500 README.md");
|
|
2169
|
-
} else if (validatedTemplate === "
|
|
2171
|
+
} else if (validatedTemplate === "mcp-server") {
|
|
2170
2172
|
console.log(" \u251C\u2500\u2500 index.ts (server entry point)");
|
|
2171
2173
|
console.log(" \u251C\u2500\u2500 package.json");
|
|
2172
2174
|
console.log(" \u251C\u2500\u2500 tsconfig.json");
|
|
@@ -1,57 +1,14 @@
|
|
|
1
1
|
import { MCPServer } from "mcp-use";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
|
-
const fruits = [
|
|
5
|
-
{ fruit: "mango", color: "bg-[#FBF1E1] dark:bg-[#FBF1E1]/10" },
|
|
6
|
-
{ fruit: "pineapple", color: "bg-[#f8f0d9] dark:bg-[#f8f0d9]/10" },
|
|
7
|
-
{ fruit: "cherries", color: "bg-[#E2EDDC] dark:bg-[#E2EDDC]/10" },
|
|
8
|
-
{ fruit: "coconut", color: "bg-[#fbedd3] dark:bg-[#fbedd3]/10" },
|
|
9
|
-
{ fruit: "apricot", color: "bg-[#fee6ca] dark:bg-[#fee6ca]/10" },
|
|
10
|
-
{ fruit: "blueberry", color: "bg-[#e0e6e6] dark:bg-[#e0e6e6]/10" },
|
|
11
|
-
{ fruit: "grapes", color: "bg-[#f4ebe2] dark:bg-[#f4ebe2]/10" },
|
|
12
|
-
{ fruit: "watermelon", color: "bg-[#e6eddb] dark:bg-[#e6eddb]/10" },
|
|
13
|
-
{ fruit: "orange", color: "bg-[#fdebdf] dark:bg-[#fdebdf]/10" },
|
|
14
|
-
{ fruit: "avocado", color: "bg-[#ecefda] dark:bg-[#ecefda]/10" },
|
|
15
|
-
{ fruit: "apple", color: "bg-[#F9E7E4] dark:bg-[#F9E7E4]/10" },
|
|
16
|
-
{ fruit: "pear", color: "bg-[#f1f1cf] dark:bg-[#f1f1cf]/10" },
|
|
17
|
-
{ fruit: "plum", color: "bg-[#ece5ec] dark:bg-[#ece5ec]/10" },
|
|
18
|
-
{ fruit: "banana", color: "bg-[#fdf0dd] dark:bg-[#fdf0dd]/10" },
|
|
19
|
-
{ fruit: "strawberry", color: "bg-[#f7e6df] dark:bg-[#f7e6df]/10" },
|
|
20
|
-
{ fruit: "lemon", color: "bg-[#feeecd] dark:bg-[#feeecd]/10" },
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
const fruitRowSchema = z.object({
|
|
24
|
-
fruit: z.string(),
|
|
25
|
-
color: z.string(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const searchOutputSchema = z.object({
|
|
29
|
-
query: z.string(),
|
|
30
|
-
results: z.array(fruitRowSchema),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const detailsOutputSchema = z.object({
|
|
34
|
-
fruit: z.string(),
|
|
35
|
-
color: z.string(),
|
|
36
|
-
facts: z.array(z.string()),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
function renderAsMarkdownTable(
|
|
40
|
-
results: Array<{ fruit: string; color: string }>
|
|
41
|
-
): string {
|
|
42
|
-
const header = "| Fruit | Color |\n| --- | --- |";
|
|
43
|
-
const rows = results.map((r) => `| ${r.fruit} | ${r.color} |`).join("\n");
|
|
44
|
-
return `${header}\n${rows}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
4
|
const server = new MCPServer({
|
|
48
5
|
name: "{{PROJECT_NAME}}",
|
|
49
|
-
title: "{{PROJECT_NAME}}",
|
|
6
|
+
title: "{{PROJECT_NAME}}", // Human readable name of the server
|
|
50
7
|
version: "1.0.0",
|
|
51
|
-
description: "
|
|
52
|
-
instructions:
|
|
53
|
-
"Use search-fruits to find fruit matches before calling get-fruit-details. Prefer the view result when the user wants to browse or compare options visually.",
|
|
8
|
+
description: "an mcp-use app",
|
|
9
|
+
instructions: "use show-app to open the app view", // Model-facing guidance — surfaced to the LLM by compatible clients.
|
|
54
10
|
websiteUrl: "https://mcp-use.com",
|
|
11
|
+
// Icons for your MCP Server, from public/ (or absolute URLs).
|
|
55
12
|
icons: [
|
|
56
13
|
{
|
|
57
14
|
src: "icon.svg",
|
|
@@ -59,87 +16,100 @@ const server = new MCPServer({
|
|
|
59
16
|
sizes: ["512x512"],
|
|
60
17
|
},
|
|
61
18
|
],
|
|
19
|
+
|
|
20
|
+
// The MCP server is by default served at /mcp, to customise
|
|
21
|
+
// basePath: "/mcp",
|
|
22
|
+
|
|
23
|
+
// mcp-use has 1 line adapter for OAuth, import from mcp-use/oauth/*
|
|
24
|
+
// oauth: oauthClerkProvider(), // zero-config via MCP_USE_OAUTH_CLERK_FRONTEND_API_URL, import from mcp-use/oauth/*
|
|
25
|
+
|
|
26
|
+
// When OAuth is on, the HTML landing page (/mcp) is protected by default, set to true to keep the landing page public while /mcp stays bearer-protected.
|
|
27
|
+
// publicLandingPage: true,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// TOOLS
|
|
31
|
+
|
|
32
|
+
// tool inputs are zod schemas. Important: set decriptions for the model to understand the input.
|
|
33
|
+
const showAppInputSchema = z.object({
|
|
34
|
+
appName: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe(
|
|
38
|
+
"Optional title shown in the MCP App card instead of the default"
|
|
39
|
+
),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// tool outputs are zod schemas. Important: set descriptions for the model to understand the output.
|
|
43
|
+
const showAppOutputSchema = z.object({
|
|
44
|
+
message: z.string().describe("Message to display in the MCP App"),
|
|
62
45
|
});
|
|
63
46
|
|
|
64
|
-
export const
|
|
47
|
+
export const showApp = server.tool(
|
|
65
48
|
{
|
|
66
|
-
name: "
|
|
67
|
-
title: "
|
|
68
|
-
description: "
|
|
69
|
-
inputSchema:
|
|
70
|
-
|
|
71
|
-
}),
|
|
72
|
-
outputSchema: searchOutputSchema,
|
|
49
|
+
name: "show-app", // Unique tool id on the wire.
|
|
50
|
+
title: "Show MCP App", // Short label in inspector and client UIs (falls back to name).
|
|
51
|
+
description: "Display the MCP App starter view", // LLM-facing summary of what the tool does.
|
|
52
|
+
inputSchema: showAppInputSchema, // Validated before the handler runs; .describe() text becomes LLM hints.
|
|
53
|
+
outputSchema: showAppOutputSchema, // Required when binding a view — the view reads structuredContent typed by this.
|
|
73
54
|
view: {
|
|
74
|
-
name: "
|
|
75
|
-
description: "
|
|
76
|
-
prefersBorder:
|
|
55
|
+
name: "my-view", // directory under views/
|
|
56
|
+
description: "MCP App starter card with interactive demo hooks",
|
|
57
|
+
prefersBorder: false, // ask the host to skip a card border around the view
|
|
58
|
+
csp: {
|
|
59
|
+
resourceDomains: [
|
|
60
|
+
"https://fonts.googleapis.com",
|
|
61
|
+
"https://fonts.gstatic.com",
|
|
62
|
+
],
|
|
63
|
+
},
|
|
77
64
|
},
|
|
65
|
+
// Behavioral hints for clients (readOnly / destructive / open-world).
|
|
78
66
|
annotations: {
|
|
79
67
|
readOnlyHint: true,
|
|
80
68
|
destructiveHint: false,
|
|
81
69
|
openWorldHint: false,
|
|
82
70
|
},
|
|
83
71
|
},
|
|
84
|
-
async ({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// Emulate a delay to show the loading state in the view
|
|
90
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
91
|
-
|
|
92
|
-
const data = { query, results };
|
|
72
|
+
async ({ appName }, ctx) => {
|
|
73
|
+
// Brief delay so the pending skeleton is visible during dev/inspector demos.
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
93
75
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
content: [{ type: "text", text: renderAsMarkdownTable(results) }],
|
|
97
|
-
structuredContent: data,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
76
|
+
console.log(`The app name was: ${appName}`);
|
|
77
|
+
const data = { message: `The MCP App starter for ${appName} is ready!` };
|
|
100
78
|
|
|
101
79
|
return {
|
|
102
|
-
content: [
|
|
103
|
-
{
|
|
104
|
-
type: "text",
|
|
105
|
-
text: `Found ${results.length} fruits matching "${query || "all"}"`,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
80
|
+
content: [{ type: "text", text: data.message }],
|
|
108
81
|
structuredContent: data,
|
|
109
82
|
};
|
|
110
83
|
}
|
|
111
84
|
);
|
|
112
85
|
|
|
113
|
-
|
|
86
|
+
// say-hello — plain tool (no view); used by the Say Hello button in my-view
|
|
87
|
+
const sayHelloInputSchema = z.object({
|
|
88
|
+
name: z.string().describe("Name to greet"),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const sayHelloOutputSchema = z.object({
|
|
92
|
+
greeting: z.string().describe("Greeting to display"),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const sayHello = server.tool(
|
|
114
96
|
{
|
|
115
|
-
name: "
|
|
116
|
-
title: "
|
|
117
|
-
description: "
|
|
118
|
-
inputSchema:
|
|
119
|
-
|
|
120
|
-
}),
|
|
121
|
-
outputSchema: detailsOutputSchema,
|
|
97
|
+
name: "say-hello",
|
|
98
|
+
title: "Say hello",
|
|
99
|
+
description: "Returns a greeting for the Say Hello button demo",
|
|
100
|
+
inputSchema: sayHelloInputSchema,
|
|
101
|
+
outputSchema: sayHelloOutputSchema,
|
|
122
102
|
annotations: {
|
|
123
103
|
readOnlyHint: true,
|
|
124
104
|
destructiveHint: false,
|
|
125
105
|
openWorldHint: false,
|
|
126
106
|
},
|
|
127
107
|
},
|
|
128
|
-
async ({
|
|
129
|
-
const
|
|
130
|
-
(f) => f.fruit.toLowerCase() === fruit.toLowerCase()
|
|
131
|
-
);
|
|
132
|
-
const details = {
|
|
133
|
-
fruit: found?.fruit ?? fruit,
|
|
134
|
-
color: found?.color ?? "unknown",
|
|
135
|
-
facts: [
|
|
136
|
-
`${fruit} is a delicious fruit`,
|
|
137
|
-
`Color: ${found?.color ?? "unknown"}`,
|
|
138
|
-
],
|
|
139
|
-
};
|
|
108
|
+
async ({ name }) => {
|
|
109
|
+
const data = { greeting: `Hello, ${name}!` };
|
|
140
110
|
return {
|
|
141
|
-
content: [{ type: "text", text:
|
|
142
|
-
structuredContent:
|
|
111
|
+
content: [{ type: "text", text: data.greeting }],
|
|
112
|
+
structuredContent: data,
|
|
143
113
|
};
|
|
144
114
|
}
|
|
145
115
|
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="2476" height="480" viewBox="0 0 2476 480" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M793.5 245.5C793.5 218.167 790 198.5 783 186.5C776.333 174.167 763.667 168 745 168C738.333 168 731 168.5 723 169.5C715 170.5 709 171.333 705 172V383H644.5V130C656.167 126.667 671.333 123.5 690 120.5C709 117.5 729 116 750 116C768 116 782.667 118.333 794 123C805.667 127.667 815.333 133.833 823 141.5C826.667 138.833 831.333 136 837 133C842.667 130 849 127.333 856 125C863 122.333 870.333 120.167 878 118.5C886 116.833 894 116 902 116C922.333 116 939 119 952 125C965.333 130.667 975.667 138.833 983 149.5C990.667 159.833 995.833 172.5 998.5 187.5C1001.5 202.167 1003 218.333 1003 236V383H942.5V245.5C942.5 218.167 939.167 198.5 932.5 186.5C925.833 174.167 913 168 894 168C884.333 168 875.167 169.667 866.5 173C857.833 176 851.333 179 847 182C849.667 190.333 851.5 199.167 852.5 208.5C853.5 217.833 854 227.833 854 238.5V383H793.5V245.5ZM1052.62 252.5C1052.62 233.167 1055.62 215.167 1061.62 198.5C1067.62 181.5 1076.12 166.833 1087.12 154.5C1098.45 142.167 1112.12 132.5 1128.12 125.5C1144.12 118.5 1162.12 115 1182.12 115C1206.78 115 1230.12 119.5 1252.12 128.5L1239.12 178C1232.12 175 1224.12 172.5 1215.12 170.5C1206.45 168.5 1197.12 167.5 1187.12 167.5C1163.45 167.5 1145.45 175 1133.12 190C1120.78 204.667 1114.62 225.5 1114.62 252.5C1114.62 278.5 1120.45 299.167 1132.12 314.5C1143.78 329.5 1163.45 337 1191.12 337C1201.45 337 1211.62 336 1221.62 334C1231.62 332 1240.28 329.5 1247.62 326.5L1256.12 376.5C1249.45 379.833 1239.28 382.833 1225.62 385.5C1212.28 388.167 1198.45 389.5 1184.12 389.5C1161.78 389.5 1142.28 386.167 1125.62 379.5C1109.28 372.5 1095.62 363 1084.62 351C1073.95 338.667 1065.95 324.167 1060.62 307.5C1055.28 290.5 1052.62 272.167 1052.62 252.5ZM1466.46 253.5C1466.46 226.5 1460.29 205.5 1447.96 190.5C1435.96 175.5 1416.46 168 1389.46 168C1383.79 168 1377.79 168.333 1371.46 169C1365.46 169.333 1359.46 170.333 1353.46 172V321.5C1358.79 325.167 1365.79 328.667 1374.46 332C1383.46 335 1392.96 336.5 1402.96 336.5C1424.96 336.5 1440.96 329 1450.96 314C1461.29 299 1466.46 278.833 1466.46 253.5ZM1528.46 252.5C1528.46 272.5 1525.79 290.833 1520.46 307.5C1515.46 324.167 1508.12 338.5 1498.46 350.5C1488.79 362.5 1476.62 371.833 1461.96 378.5C1447.62 385.167 1431.29 388.5 1412.96 388.5C1400.62 388.5 1389.29 387 1378.96 384C1368.62 381 1360.12 377.667 1353.46 374V475.5H1292.96V130C1305.29 126.667 1320.46 123.5 1338.46 120.5C1356.46 117.5 1375.46 116 1395.46 116C1416.12 116 1434.62 119.167 1450.96 125.5C1467.29 131.833 1481.12 141 1492.46 153C1504.12 164.667 1512.96 179 1518.96 196C1525.29 212.667 1528.46 231.5 1528.46 252.5ZM1553.81 212.5H1688.31V268H1553.81V212.5ZM1943.02 375C1931.36 378 1916.19 381 1897.52 384C1878.86 387.333 1858.36 389 1836.02 389C1815.02 389 1797.36 386 1783.02 380C1769.02 374 1757.69 365.667 1749.02 355C1740.69 344.333 1734.69 331.667 1731.02 317C1727.36 302 1725.52 285.667 1725.52 268V121.5H1786.02V258.5C1786.02 286.5 1790.02 306.5 1798.02 318.5C1806.36 330.5 1820.69 336.5 1841.02 336.5C1848.36 336.5 1856.02 336.167 1864.02 335.5C1872.36 334.833 1878.52 334 1882.52 333V121.5H1943.02V375ZM2075.53 339.5C2091.53 339.5 2103.19 337.667 2110.53 334C2117.86 330 2121.53 323.333 2121.53 314C2121.53 305.333 2117.53 298.167 2109.53 292.5C2101.86 286.833 2089.03 280.667 2071.03 274C2060.03 270 2049.86 265.833 2040.53 261.5C2031.53 256.833 2023.69 251.5 2017.03 245.5C2010.36 239.5 2005.03 232.333 2001.03 224C1997.36 215.333 1995.53 204.833 1995.53 192.5C1995.53 168.5 2004.36 149.667 2022.03 136C2039.69 122 2063.69 115 2094.03 115C2109.36 115 2124.03 116.5 2138.03 119.5C2152.03 122.167 2162.53 124.833 2169.53 127.5L2158.53 176.5C2151.86 173.5 2143.36 170.833 2133.03 168.5C2122.69 165.833 2110.69 164.5 2097.03 164.5C2084.69 164.5 2074.69 166.667 2067.03 171C2059.36 175 2055.53 181.333 2055.53 190C2055.53 194.333 2056.19 198.167 2057.53 201.5C2059.19 204.833 2061.86 208 2065.53 211C2069.19 213.667 2074.03 216.5 2080.03 219.5C2086.03 222.167 2093.36 225 2102.03 228C2116.36 233.333 2128.53 238.667 2138.53 244C2148.53 249 2156.69 254.833 2163.03 261.5C2169.69 267.833 2174.53 275.167 2177.53 283.5C2180.53 291.833 2182.03 301.833 2182.03 313.5C2182.03 338.5 2172.69 357.5 2154.03 370.5C2135.69 383.167 2109.36 389.5 2075.03 389.5C2052.03 389.5 2033.53 387.5 2019.53 383.5C2005.53 379.833 1995.69 376.833 1990.03 374.5L2000.53 324C2009.53 327.667 2020.19 331.167 2032.53 334.5C2045.19 337.833 2059.53 339.5 2075.53 339.5ZM2214.04 253.5C2214.04 230.5 2217.38 210.333 2224.04 193C2231.04 175.667 2240.21 161.333 2251.54 150C2262.88 138.333 2275.88 129.667 2290.54 124C2305.21 118 2320.21 115 2335.54 115C2371.54 115 2399.54 126.167 2419.54 148.5C2439.88 170.833 2450.04 204.167 2450.04 248.5C2450.04 251.833 2449.88 255.667 2449.54 260C2449.54 264 2449.38 267.667 2449.04 271H2276.54C2278.21 292 2285.54 308.333 2298.54 320C2311.88 331.333 2331.04 337 2356.04 337C2370.71 337 2384.04 335.667 2396.04 333C2408.38 330.333 2418.04 327.5 2425.04 324.5L2433.04 374C2429.71 375.667 2425.04 377.5 2419.04 379.5C2413.38 381.167 2406.71 382.667 2399.04 384C2391.71 385.667 2383.71 387 2375.04 388C2366.38 389 2357.54 389.5 2348.54 389.5C2325.54 389.5 2305.54 386.167 2288.54 379.5C2271.54 372.5 2257.54 363 2246.54 351C2235.54 338.667 2227.38 324.333 2222.04 308C2216.71 291.333 2214.04 273.167 2214.04 253.5ZM2389.54 226.5C2389.54 218.167 2388.38 210.333 2386.04 203C2383.71 195.333 2380.21 188.833 2375.54 183.5C2371.21 177.833 2365.71 173.5 2359.04 170.5C2352.71 167.167 2345.04 165.5 2336.04 165.5C2326.71 165.5 2318.54 167.333 2311.54 171C2304.54 174.333 2298.54 178.833 2293.54 184.5C2288.88 190.167 2285.21 196.667 2282.54 204C2279.88 211.333 2278.04 218.833 2277.04 226.5H2389.54Z" fill="black"/>
|
|
3
|
+
<g transform="scale(0.96)">
|
|
4
|
+
<path d="M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z" fill="black"/>
|
|
5
|
+
<circle cx="100.426" cy="399.575" r="100.426" fill="black"/>
|
|
6
|
+
<path d="M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z" fill="black"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|