create-mcp-use-app 0.9.1 → 0.9.3-canary.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.
@@ -88,7 +88,7 @@ const propSchema = z.object({
88
88
 
89
89
  export const widgetMetadata: WidgetMetadata = {
90
90
  description: 'My widget description',
91
- inputs: propSchema,
91
+ props: propSchema,
92
92
  };
93
93
 
94
94
  const MyWidget: React.FC = () => {
@@ -146,7 +146,7 @@ const propSchema = z.object({
146
146
 
147
147
  export const widgetMetadata: WidgetMetadata = {
148
148
  description: 'Display user information',
149
- inputs: propSchema,
149
+ props: propSchema,
150
150
  };
151
151
  ```
152
152
 
@@ -295,7 +295,7 @@ const propSchema = z.object({
295
295
 
296
296
  export const widgetMetadata: WidgetMetadata = {
297
297
  description: 'Display a message',
298
- inputs: propSchema,
298
+ props: propSchema,
299
299
  };
300
300
 
301
301
  type Props = z.infer<typeof propSchema>;
@@ -320,11 +320,13 @@ export default MyWidget;
320
320
  You can mix Apps SDK widgets with regular MCP tools:
321
321
 
322
322
  ```typescript
323
+ import { text } from 'mcp-use/server';
324
+
323
325
  server.tool({
324
326
  name: 'get-data',
325
327
  description: 'Fetch data from API',
326
328
  cb: async () => {
327
- return { content: [{ type: 'text', text: 'Data' }] };
329
+ return text('Data');
328
330
  },
329
331
  });
330
332
  ```
@@ -1,8 +1,10 @@
1
- import { createMCPServer } from "mcp-use/server";
1
+ import { MCPServer, object } from "mcp-use/server";
2
2
 
3
- const server = createMCPServer("test-app", {
3
+ const server = new MCPServer({
4
+ name: "apps-sdk-mcp-server",
4
5
  version: "1.0.0",
5
- description: "Test MCP server with automatic UI widget registration",
6
+ description: "MCP server with OpenAI Apps SDK integration",
7
+ baseUrl: process.env.MCP_URL || "http://localhost:3000", // Full base URL (e.g., https://myserver.com)
6
8
  // favicon: "favicon.ico", // Uncomment and add your favicon to public/ folder
7
9
  });
8
10
 
@@ -55,45 +57,34 @@ server.tool(
55
57
  "Get information about the brand, including company details, mission, and values",
56
58
  },
57
59
  async () => {
58
- return {
59
- content: [
60
- {
61
- type: "text",
62
- text: JSON.stringify(
63
- {
64
- name: "mcp-use",
65
- tagline: "Build MCP servers with UI widgets in minutes",
66
- description:
67
- "mcp-use is a modern framework for building Model Context Protocol (MCP) servers with automatic UI widget registration, making it easy to create interactive AI tools and resources.",
68
- founded: "2024",
69
- mission:
70
- "To simplify the development of MCP servers and make AI integration accessible for developers",
71
- values: [
72
- "Developer Experience",
73
- "Simplicity",
74
- "Performance",
75
- "Open Source",
76
- "Innovation",
77
- ],
78
- contact: {
79
- website: "https://mcp-use.com",
80
- docs: "https://docs.mcp-use.com",
81
- github: "https://github.com/mcp-use/mcp-use",
82
- },
83
- features: [
84
- "Automatic UI widget registration",
85
- "React component support",
86
- "Full TypeScript support",
87
- "Built-in HTTP server",
88
- "MCP protocol compliance",
89
- ],
90
- },
91
- null,
92
- 2
93
- ),
94
- },
60
+ return object({
61
+ name: "mcp-use",
62
+ tagline: "Build MCP servers with UI widgets in minutes",
63
+ description:
64
+ "mcp-use is a modern framework for building Model Context Protocol (MCP) servers with automatic UI widget registration, making it easy to create interactive AI tools and resources.",
65
+ founded: "2025",
66
+ mission:
67
+ "To simplify the development of MCP servers and make AI integration accessible for developers",
68
+ values: [
69
+ "Developer Experience",
70
+ "Simplicity",
71
+ "Performance",
72
+ "Open Source",
73
+ "Innovation",
95
74
  ],
96
- };
75
+ contact: {
76
+ website: "https://mcp-use.com",
77
+ docs: "https://docs.mcp-use.com",
78
+ github: "https://github.com/mcp-use/mcp-use",
79
+ },
80
+ features: [
81
+ "Automatic UI widget registration",
82
+ "React component support",
83
+ "Full TypeScript support",
84
+ "Built-in HTTP server",
85
+ "MCP protocol compliance",
86
+ ],
87
+ });
97
88
  }
98
89
  );
99
90
 
@@ -13,13 +13,13 @@ import "../styles.css";
13
13
  export const widgetMetadata: WidgetMetadata = {
14
14
  description:
15
15
  "Display product search results with filtering, state management, and tool interactions",
16
- inputs: propSchema,
16
+ props: propSchema,
17
17
  };
18
18
 
19
19
  const ProductSearchResult: React.FC = () => {
20
20
  const { props, mcp_url } = useWidget<ProductSearchResultProps>();
21
21
 
22
- console.log(props);
22
+ console.log(props); // the widget props
23
23
 
24
24
  const accordionItems = [
25
25
  {
@@ -76,9 +76,10 @@ npm start
76
76
  ### Simple Widget Registration
77
77
 
78
78
  ```typescript
79
- import { createMCPServer } from 'mcp-use/server'
79
+ import { MCPServer } from 'mcp-use/server'
80
80
 
81
- const server = createMCPServer('my-server', {
81
+ const server = new MCPServer({
82
+ name: 'my-server',
82
83
  version: '1.0.0',
83
84
  description: 'Server with UIResource widgets',
84
85
  })
@@ -1,11 +1,12 @@
1
- import { createMCPServer } from "mcp-use/server";
1
+ import { MCPServer } from "mcp-use/server";
2
2
  import type { RawHtmlUIResource, RemoteDomUIResource } from "mcp-use/server";
3
3
 
4
4
  // Create an MCP server with MCP-UI UIResource support
5
- const server = createMCPServer("uiresource-mcp-server", {
5
+ const server = new MCPServer({
6
+ name: "uiresource-mcp-server",
6
7
  version: "1.0.0",
7
8
  description: "MCP server demonstrating all UIResource types",
8
- baseUrl: process.env.MCP_URL, // Full base URL (e.g., https://myserver.com)
9
+ baseUrl: process.env.MCP_URL || "http://localhost:3000", // Full base URL (e.g., https://myserver.com)
9
10
  // favicon: "favicon.ico", // Uncomment and add your favicon to public/ folder
10
11
  });
11
12
 
@@ -26,14 +26,16 @@ This starter template demonstrates all major MCP features:
26
26
  ### 1. Traditional Tools
27
27
 
28
28
  ```typescript
29
+ import { text } from 'mcp-use/server';
30
+
29
31
  server.tool({
30
32
  name: 'greet',
31
33
  description: 'Greet someone by name',
32
- inputs: [{ name: 'name', type: 'string', required: true }],
33
- cb: async ({ name }) => {
34
- return { content: [{ type: 'text', text: `Hello, ${name}!` }] }
34
+ schema: z.object({name:z.string()}),
35
+ }, async ({ name }) => {
36
+ return text(`Hello, ${name}!`)
35
37
  },
36
- })
38
+ )
37
39
  ```
38
40
 
39
41
  ### 2. Resources
@@ -265,14 +267,14 @@ await client.getPrompt('review-code', { code: 'const x = 1;' })
265
267
  server.tool({
266
268
  name: 'my-tool',
267
269
  description: 'My custom tool',
268
- inputs: [{ name: 'param', type: 'string', required: true }],
269
- cb: async ({ param }) => {
270
+ schema: z.object({
271
+ param: z.string(),
272
+ })
273
+ }, async ({ param }) => {
270
274
  // Your logic here
271
- return {
272
- content: [{ type: 'text', text: `Result: ${param}` }],
273
- }
275
+ return text(param)
274
276
  },
275
- })
277
+ )
276
278
  ```
277
279
 
278
280
  ### Adding New React Widgets
@@ -1,7 +1,9 @@
1
- import { createMCPServer } from "mcp-use/server";
1
+ import { MCPServer } from "mcp-use/server";
2
+ import { z } from "zod";
2
3
 
3
4
  // Create MCP server instance
4
- const server = createMCPServer("my-mcp-server", {
5
+ const server = new MCPServer({
6
+ name: "my-mcp-server",
5
7
  version: "1.0.0",
6
8
  description: "My first MCP server with all features",
7
9
  baseUrl: process.env.MCP_URL || "http://localhost:3000", // Full base URL (e.g., https://myserver.com)
@@ -33,10 +35,11 @@ server.tool(
33
35
  {
34
36
  name: "fetch-weather",
35
37
  description: "Fetch the weather for a city",
36
- inputs: [{ name: "city", type: "string", required: true }],
38
+ schema: z.object({
39
+ city: z.string().describe("The city to fetch the weather for"),
40
+ }),
37
41
  },
38
- async (params: Record<string, any>) => {
39
- const city = params.city as string;
42
+ async ({ city }) => {
40
43
  const response = await fetch(`https://wttr.in/${city}?format=j1`);
41
44
  const data: any = await response.json();
42
45
  const current = data.current_condition[0];
@@ -23,7 +23,7 @@ const propSchema = z.object({
23
23
 
24
24
  export const widgetMetadata: WidgetMetadata = {
25
25
  description: "Display weather for a city",
26
- inputs: propSchema,
26
+ props: propSchema,
27
27
  };
28
28
 
29
29
  type WeatherProps = z.infer<typeof propSchema>;
@@ -32,7 +32,7 @@ const WeatherWidget: React.FC = () => {
32
32
  // Use the useWidget hook to get props from OpenAI Apps SDK
33
33
  const { props, theme } = useWidget<WeatherProps>();
34
34
 
35
- console.log(props);
35
+ console.log(props); // the widget props
36
36
 
37
37
  const { city, weather, temperature } = props;
38
38
  const getWeatherIcon = (weatherType: string) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mcp-use-app",
3
- "version": "0.9.1",
3
+ "version": "0.9.3-canary.0",
4
4
  "type": "module",
5
5
  "description": "Create MCP-Use apps with one command",
6
6
  "author": "mcp-use, Inc.",