@foldkit/devtools-mcp 0.1.0 → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +14 -12
- package/dist/server.js +0 -0
- package/dist/tools.js +2 -2
- package/package.json +11 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Devin Jameson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ With it attached, agents can:
|
|
|
7
7
|
- Read the current Model
|
|
8
8
|
- List and inspect the Message history
|
|
9
9
|
- Replay to any past state and resume
|
|
10
|
-
- Dispatch Messages into the runtime,
|
|
10
|
+
- Dispatch Messages into the runtime, decoded against your `Message` Schema
|
|
11
11
|
|
|
12
12
|
## Quick Start
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ export default defineConfig({
|
|
|
44
44
|
})
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
In your `Runtime.makeProgram` call, pass your `Message` Schema.
|
|
47
|
+
In your `Runtime.makeProgram` call, pass your `Message` Schema. The runtime decodes every dispatched payload against it, returning a clean error if the shape does not match before it reaches your update function:
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
Runtime.makeProgram({
|
|
@@ -57,20 +57,22 @@ Runtime.makeProgram({
|
|
|
57
57
|
|
|
58
58
|
Restart your dev server, then restart your AI agent. The MCP server will appear with the eight `foldkit_*` tools attached.
|
|
59
59
|
|
|
60
|
+
The browser bridge runs inside your app, so the MCP server only sees a runtime while the app is open in a browser tab. Close the tab and the runtime disappears from `foldkit_list_runtimes`.
|
|
61
|
+
|
|
60
62
|
## Tools
|
|
61
63
|
|
|
62
64
|
Each tool accepts an optional `runtime_id`. When omitted, the most recently connected runtime is used.
|
|
63
65
|
|
|
64
|
-
| Tool | Description
|
|
65
|
-
| ---------------------------- |
|
|
66
|
-
| `foldkit_list_runtimes` | Returns metadata for every connected browser tab
|
|
67
|
-
| `foldkit_get_model` | Snapshots the current Model.
|
|
68
|
-
| `foldkit_list_messages` | Lists recent Message history entries with pagination. Each entry carries the Message body, command names triggered, timestamp, and a path-level diff.
|
|
69
|
-
| `foldkit_get_message` | Reads one entry at a given index, including the Model before and after the Message was applied.
|
|
70
|
-
| `foldkit_list_keyframes` | Returns the indices Foldkit can replay back to. Index `-1` is the initial Model.
|
|
71
|
-
| `foldkit_replay_to_keyframe` | Time-travels the runtime to a previous state. The runtime is paused at that snapshot until `foldkit_resume` is called.
|
|
72
|
-
| `foldkit_resume` | Resumes normal execution after a replay.
|
|
73
|
-
| `foldkit_dispatch_message` | Enqueues a Message into the runtime as if your application produced it. The
|
|
66
|
+
| Tool | Description |
|
|
67
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| `foldkit_list_runtimes` | Returns metadata for every connected browser tab. Agents call this first to discover which runtime to target. |
|
|
69
|
+
| `foldkit_get_model` | Snapshots the current Model. |
|
|
70
|
+
| `foldkit_list_messages` | Lists recent Message history entries with pagination. Each entry carries the Message body, command names triggered, timestamp, and a path-level diff. |
|
|
71
|
+
| `foldkit_get_message` | Reads one entry at a given index, including the Model before and after the Message was applied. |
|
|
72
|
+
| `foldkit_list_keyframes` | Returns the indices Foldkit can replay back to. Index `-1` is the initial Model. |
|
|
73
|
+
| `foldkit_replay_to_keyframe` | Time-travels the runtime to a previous state. The runtime is paused at that snapshot until `foldkit_resume` is called. |
|
|
74
|
+
| `foldkit_resume` | Resumes normal execution after a replay. |
|
|
75
|
+
| `foldkit_dispatch_message` | Enqueues a Message into the runtime as if your application produced it. The runtime decodes the payload against your Schema and returns a clean error if it does not match. |
|
|
74
76
|
|
|
75
77
|
## Architecture
|
|
76
78
|
|
package/dist/server.js
CHANGED
|
File without changes
|
package/dist/tools.js
CHANGED
|
@@ -40,7 +40,7 @@ const ResumeInput = S.Struct({
|
|
|
40
40
|
const DispatchMessageInput = S.Struct({
|
|
41
41
|
runtime_id: RuntimeIdField,
|
|
42
42
|
message: S.Unknown.annotations({
|
|
43
|
-
description: "A Foldkit Message object to dispatch into the runtime. Must match the runtime's Message Schema
|
|
43
|
+
description: "A Foldkit Message object to dispatch into the runtime. Must match the runtime's Message Schema — read the application's source to see the exact shape. At minimum it has a `_tag` field naming the variant. The runtime decodes the payload and returns a clean error if it doesn't match.",
|
|
44
44
|
}),
|
|
45
45
|
});
|
|
46
46
|
/**
|
|
@@ -146,7 +146,7 @@ export const buildTools = (wsClient) => [
|
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
name: 'foldkit_dispatch_message',
|
|
149
|
-
description: "Dispatch a Message into a Foldkit runtime's message queue, as if the application itself produced it. Requires the runtime to have configured DevToolsConfig.Message; without it, dispatch is rejected.
|
|
149
|
+
description: "Dispatch a Message into a Foldkit runtime's message queue, as if the application itself produced it. Requires the runtime to have configured DevToolsConfig.Message; without it, dispatch is rejected. Read the application's Message Schema source to construct a valid Message object. The runtime decodes the payload and returns a clean error if it doesn't match.",
|
|
150
150
|
inputSchema: JSONSchema.make(DispatchMessageInput),
|
|
151
151
|
handle: runRuntimeTool(DispatchMessageInput, ({ message }) => RequestDispatchMessage({ message }), wsClient),
|
|
152
152
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/devtools-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MCP server exposing Foldkit DevTools to AI agents (Claude Code, Cursor, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -15,15 +15,9 @@
|
|
|
15
15
|
"import": "./dist/server.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"clean": "rimraf dist *.tsbuildinfo",
|
|
20
|
-
"build": "pnpm run clean && tsc -b",
|
|
21
|
-
"watch": "tsc -b --watch",
|
|
22
|
-
"typecheck": "tsc -b --noEmit"
|
|
23
|
-
},
|
|
24
18
|
"peerDependencies": {
|
|
25
19
|
"effect": "^3.18.2",
|
|
26
|
-
"foldkit": "
|
|
20
|
+
"foldkit": "^0"
|
|
27
21
|
},
|
|
28
22
|
"dependencies": {
|
|
29
23
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -33,9 +27,9 @@
|
|
|
33
27
|
"@types/node": "^22.0.0",
|
|
34
28
|
"@types/ws": "^8.5.13",
|
|
35
29
|
"effect": "^3.19.19",
|
|
36
|
-
"foldkit": "workspace:*",
|
|
37
30
|
"rimraf": "^6.0.0",
|
|
38
|
-
"typescript": "^6.0.2"
|
|
31
|
+
"typescript": "^6.0.2",
|
|
32
|
+
"foldkit": "0.77.0"
|
|
39
33
|
},
|
|
40
34
|
"files": [
|
|
41
35
|
"dist"
|
|
@@ -59,5 +53,11 @@
|
|
|
59
53
|
},
|
|
60
54
|
"engines": {
|
|
61
55
|
"node": ">=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"clean": "rimraf dist *.tsbuildinfo",
|
|
59
|
+
"build": "pnpm run clean && tsc -b",
|
|
60
|
+
"watch": "tsc -b --watch",
|
|
61
|
+
"typecheck": "tsc -b --noEmit"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|