sunpeak 0.16.1 → 0.16.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.
Files changed (47) hide show
  1. package/README.md +2 -1
  2. package/bin/commands/build.mjs +106 -2
  3. package/bin/commands/dev.mjs +104 -8
  4. package/bin/commands/start.mjs +215 -0
  5. package/bin/sunpeak.js +11 -1
  6. package/dist/chatgpt/index.cjs +2 -2
  7. package/dist/chatgpt/index.js +2 -2
  8. package/dist/claude/index.cjs +1 -1
  9. package/dist/claude/index.js +1 -1
  10. package/dist/{index-BvQ_ZuOO.cjs → index-Bll1bszc.cjs} +2 -2
  11. package/dist/{index-BvQ_ZuOO.cjs.map → index-Bll1bszc.cjs.map} +1 -1
  12. package/dist/{index-CTGEqlgk.js → index-CACtnwu2.js} +2 -2
  13. package/dist/{index-CTGEqlgk.js.map → index-CACtnwu2.js.map} +1 -1
  14. package/dist/{index-BjnAsaqp.js → index-CLcr8IyR.js} +2 -2
  15. package/dist/index-CLcr8IyR.js.map +1 -0
  16. package/dist/{index-C9CVbGFt.cjs → index-CaQmwZJc.cjs} +2 -2
  17. package/dist/index-CaQmwZJc.cjs.map +1 -0
  18. package/dist/index.cjs +5 -5
  19. package/dist/index.js +6 -6
  20. package/dist/mcp/index.cjs +1579 -3
  21. package/dist/mcp/index.cjs.map +1 -1
  22. package/dist/mcp/index.d.ts +2 -0
  23. package/dist/mcp/index.js +1580 -4
  24. package/dist/mcp/index.js.map +1 -1
  25. package/dist/mcp/production-server.d.ts +156 -0
  26. package/dist/platform/chatgpt/index.cjs +1 -1
  27. package/dist/platform/chatgpt/index.js +1 -1
  28. package/dist/{protocol-DFbsCx7E.js → protocol-BD5jDQEx.js} +8 -1
  29. package/dist/{protocol-DFbsCx7E.js.map → protocol-BD5jDQEx.js.map} +1 -1
  30. package/dist/{protocol-CL4_Npj5.cjs → protocol-BOjXuK6l.cjs} +8 -1
  31. package/dist/{protocol-CL4_Npj5.cjs.map → protocol-BOjXuK6l.cjs.map} +1 -1
  32. package/dist/simulator/index.cjs +1 -1
  33. package/dist/simulator/index.js +1 -1
  34. package/dist/{simulator-C0H_k092.js → simulator-B7rw83zP.js} +2 -2
  35. package/dist/{simulator-C0H_k092.js.map → simulator-B7rw83zP.js.map} +1 -1
  36. package/dist/{simulator-B56j5P8W.cjs → simulator-DjZNa1MI.cjs} +2 -2
  37. package/dist/{simulator-B56j5P8W.cjs.map → simulator-DjZNa1MI.cjs.map} +1 -1
  38. package/dist/{use-app-BuufpXTQ.cjs → use-app-BpAJqzdE.cjs} +2 -2
  39. package/dist/{use-app-BuufpXTQ.cjs.map → use-app-BpAJqzdE.cjs.map} +1 -1
  40. package/dist/{use-app-BThbgFFT.js → use-app-WOUdh1PR.js} +2 -2
  41. package/dist/{use-app-BThbgFFT.js.map → use-app-WOUdh1PR.js.map} +1 -1
  42. package/package.json +1 -1
  43. package/template/README.md +13 -12
  44. package/template/package.json +1 -0
  45. package/template/src/server.ts +7 -5
  46. package/dist/index-BjnAsaqp.js.map +0 -1
  47. package/dist/index-C9CVbGFt.cjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sunpeak",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Local-first MCP Apps framework. Quickstart, build, test, and ship your Claude or ChatGPT App!",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,7 +18,8 @@ That's it! Edit the resource files in [./src/resources/](./src/resources/) to bu
18
18
  pnpm test # Run tests with Vitest.
19
19
  pnpm test:e2e # Run end-to-end tests with Playwright.
20
20
  sunpeak dev # Start dev server + MCP endpoint.
21
- sunpeak build # Build all resources for production.
21
+ sunpeak build # Build resources and compile tools for production.
22
+ sunpeak start # Start the production MCP server.
22
23
  sunpeak upgrade # Upgrade sunpeak to latest version.
23
24
  ```
24
25
 
@@ -62,31 +63,31 @@ Once your app is connected, send the name of the app and a tool, like `/sunpeak
62
63
 
63
64
  ## Build & Deploy
64
65
 
65
- Build your app for production:
66
+ Build and start your app for production:
66
67
 
67
68
  ```bash
68
- sunpeak build
69
+ sunpeak build && sunpeak start
69
70
  ```
70
71
 
71
- This creates optimized builds in `dist/`, organized by resource:
72
+ `sunpeak build` creates optimized builds in `dist/`:
72
73
 
73
74
  ```bash
74
75
  dist/
75
76
  ├── albums/
76
77
  │ ├── albums.html # Built resource bundle.
77
78
  │ └── albums.json # ResourceConfig (extracted from .tsx).
78
- ├── review/
79
- │ ├── review.html
80
- │ └── review.json
79
+ ├── tools/
80
+ │ ├── show-albums.js # Compiled tool handler + schema.
81
+ │ └── ...
82
+ ├── server.js # Compiled server entry (if src/server.ts exists).
81
83
  └── ...
82
84
  ```
83
85
 
84
- Each resource folder contains:
86
+ `sunpeak start` loads the compiled tools and resources, then starts a production MCP server with real handlers, Zod input validation, and optional auth.
85
87
 
86
- - **`.html` file**: Self-contained bundle with JS and CSS inlined
87
- - **`.json` file**: Resource metadata (extracted from the `resource` export in your `.tsx` file) with a generated `uri` for cache-busting
88
-
89
- Host these files and reference them as resources in your production MCP server.
88
+ ```bash
89
+ sunpeak start --port 3000 # Custom port (default: 8000)
90
+ ```
90
91
 
91
92
  ## Add a new UI (Resource)
92
93
 
@@ -6,6 +6,7 @@
6
6
  "scripts": {
7
7
  "dev": "sunpeak dev",
8
8
  "build": "sunpeak build",
9
+ "start": "sunpeak start",
9
10
  "test": "vitest run",
10
11
  "test:e2e": "playwright test"
11
12
  },
@@ -4,12 +4,14 @@ import type { AuthInfo } from 'sunpeak/mcp';
4
4
  /**
5
5
  * Optional server entry point.
6
6
  *
7
- * The `auth` function extracts authentication info from incoming HTTP requests.
8
- * The returned `AuthInfo` is available as `extra.authInfo` in tool handlers.
7
+ * Called on every MCP request. Return AuthInfo to authenticate, null to reject (401).
8
+ * The returned AuthInfo is available as `extra.authInfo` in tool handlers.
9
9
  */
10
- export function auth(req: IncomingMessage): AuthInfo {
11
- const token = req.headers.authorization?.replace('Bearer ', '') ?? '';
12
- return { token, clientId: 'my-app', scopes: [] };
10
+ export async function auth(req: IncomingMessage): Promise<AuthInfo | null> {
11
+ const token = req.headers.authorization?.replace('Bearer ', '');
12
+ // Allow unauthenticated requests (no token = anonymous access).
13
+ // To require auth, return null here instead.
14
+ return { token: token ?? '', clientId: 'anonymous', scopes: [] };
13
15
  }
14
16
 
15
17
  export const server = { name: 'Sunpeak', version: '1.0.0' };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-BjnAsaqp.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-C9CVbGFt.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}