You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,32 +50,42 @@ npm install
50
50
51
51
### Working on the MCP Apps (ChatGPT Apps) UI widgets
52
52
53
-
The MCP server uses UI widgets from the `src/web/` directory that need to be built before running the server. To build everything, including the UI widgets, run:
53
+
The MCP server uses UI widgets from the `src/web/` directory.
54
+
54
55
See the [OpenAI Apps SDK documentation](https://developers.openai.com/apps-sdk) for background on MCP Apps and widgets.
55
56
57
+
### Production build
58
+
59
+
If you need the compiled assets copied into the top-level `dist/web` for packaging or integration tests, build everything:
60
+
56
61
```bash
57
62
npm run build
58
63
```
59
64
60
65
This command builds the core project and the `src/web/` widgets, then copies the widgets into the `dist/` directory.
61
66
62
-
If you only want to work on the React UI widgets, all widget code lives in the self-contained `src/web/` React project. The widgets (MCP Apps) are rendered based on the structured output returned by MCP tools. If you need to add specific data to a widget, you will need to modify the corresponding MCP tool's output since widgets can only render data returned by the MCP tool call result.
67
+
All widget code lives in the self-contained `src/web/` React project. The widgets (MCP Apps) are rendered based on the structured output returned by MCP tools. If you need to add specific data to a widget, modify the corresponding MCP tool's output, since widgets can only render data returned by the MCP tool call result.
63
68
64
69
> **Important (UI mode):** Widget rendering is enabled only when the server runs in UI mode. Use the `ui=openai` query parameter (e.g., `/mcp?ui=openai`) or set `UI_MODE=openai`. Currently, `openai` is the only supported `ui` value.
65
70
66
-
> **Important:** After changing widgets, you must rebuild the project with `npm run build` to refresh the React widgets in the `dist/` directory.
71
+
### Hot-reload development
67
72
68
-
### Running the MCP server locally
69
-
70
-
Start the MCP server locally using:
73
+
Run the orchestrator, which starts the web widgets builder in watch mode and the MCP server in standby mode:
71
74
72
75
```bash
73
-
APIFY_TOKEN='your-apify-token' npm run start
76
+
APIFY_TOKEN='your-apify-token' npm run dev
74
77
```
75
78
76
-
This will spawn the MCP server at port `3001`.
77
-
The HTTP server implementation used here is the standby Actor server in `src/actor/server.ts` (used by `src/main.ts` in STANDBY mode).
78
-
The hosted production server behind [mcp.apify.com](https://mcp.apify.com) is located in the internal Apify repository.
79
+
What happens:
80
+
- The `src/web` project runs `npm run dev` and continuously writes compiled files to `src/web/dist`.
81
+
- The MCP server reads widget assets directly from `src/web/dist` (compiled JS/HTML only; no TypeScript or JSX at runtime).
82
+
- Editing files under `src/web/src/widgets/*.tsx` triggers a rebuild; the next widget render will use the updated code without restarting the server.
83
+
84
+
Notes:
85
+
- Widget discovery happens when the server connects. Changing widget code is hot-reloaded; adding brand-new widget filenames typically requires reconnecting the MCP client (or restarting the server) to expose the new resource.
86
+
- You can preview widgets quickly via the local esbuild dev server at `http://localhost:3000/index.html`.
87
+
88
+
The MCP server listens on port `3001`. The HTTP server implementation used here is the standby Actor server in `src/actor/server.ts` (used by `src/main.ts` in STANDBY mode). The hosted production server behind [mcp.apify.com](https://mcp.apify.com) is located in the internal Apify repository.
0 commit comments