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
The dev server exposes the same MCP API over HTTP, live. Enable it with `cli.mcp` (or pass `mcp` to `createDevServer` / `initDevframe` / `initHub` when you host it programmatically):
21
+
The dev server exposes the same MCP API over HTTP, live. Whether to expose it is a hosting decision, so pass `mcp` to `createCac` when you assemble the CLI (or to `createDevServer` / `initDevframe` / `initHub` when you host it programmatically):
22
22
23
23
```ts
24
-
import { defineDevframe } from'devframe'
24
+
import { createCac } from'devframe/adapters/cac'
25
+
importmyDevframefrom'./my-tool'
25
26
26
-
exportdefaultdefineDevframe({
27
-
/** … */
28
-
cli: {
29
-
mcp: true,
30
-
},
31
-
})
27
+
createCac(myDevframe, { mcp: true }).parse()
32
28
```
33
29
34
30
The endpoint speaks Streamable-HTTP at `/__mcp` (`/__<id>/__mcp` under a host framework), sharing its origin/port. `--mcp` / `--no-mcp` override; `__connection.json` advertises it.
@@ -42,11 +38,9 @@ The **origin gate** guards every request: `Origin` must be loopback (or allow-li
42
38
`Origin` proves nothing about *who* is calling, though: a native process on the same box can send any `Origin`. When a same-machine process isn't your trust boundary (a LAN/tunnel origin, a shared/CI host, a destructive tool surface), layer on an **identity check** with `authorization`:
43
39
44
40
```ts
45
-
exportdefaultdefineDevframe({
46
-
cli: {
47
-
mcp: { authorization: process.env.MY_TOKEN },
48
-
},
49
-
})
41
+
createCac(myDevframe, {
42
+
mcp: { authorization: process.env.MY_TOKEN },
43
+
}).parse()
50
44
```
51
45
52
46
`authorization` takes a bearer token (backed by an env var, never a literal), a `(request) => boolean` callback that governs identity only and cannot relax the origin gate, or `false` for the explicit origin-only default.
0 commit comments