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
- instance registry: registerDevframeInstance/readDevframeInstances/
probeDevframeInstance/listLiveDevframeInstances in devframe/node —
atomic same-dir writes, prune-on-read, ghost dedup per (port, basePath),
dialable-origin adoption for family-ambiguous localhost binds;
createDevServer registers automatically and unregisters on close;
DEVFRAME_INSTANCES_DIR / DEVFRAME_DISABLE_INSTANCE_REGISTRY overrides
- first devframe bin: `devframe connect` runs the stdio MCP connector —
devframe_index (discover instances + their tools, funnel hints for
MCP-less servers) and devframe_call (proxy one tool call over
Streamable-HTTP); errors carry actionable fix payloads; missing SDK
peer throws coded DF0043
- @devframes/next: DevframeNextHost.mountMcp serves MCP in-process on the
Next app's own origin (the /_next/mcp shape); hub example wires it,
advertises it in connection meta, registers the instance, and
agent-flags its ping command; catch-all route exports POST/DELETE
- mcp adapter: drop non-object outputSchema projections (MCP requires
type object; a v.void() returns schema broke SDK clients)
- e2e: devframe-connect (files-inspector round-trip incl. gateway tool)
and minimal-next-devframe-hub (in-process discovery + command call);
hermetic per-suite registries; vitest keeps unit runs out of the
global registry
- diagnostics DF0042/DF0043 + docs pages; connect/registry docs in the
MCP adapter page
// route every method on /__mcp to mcp.fetch(request)
74
74
```
75
75
76
+
## Discovery: `devframe connect`
77
+
78
+
The `devframe` bin ships an MCP **connector** — a thin discovery + proxy server in the shape [next-devtools-mcp](https://github.com/vercel/next-devtools-mcp) validated. Configure it once in an agent client and it finds every running devframe:
-**`devframe_index`** — discover running devframe dev servers and list each one's MCP tools. Instances running without an MCP route are listed with a hint to restart with `--mcp`.
91
+
-**`devframe_call`** — invoke one tool on one instance (`{ port, tool, args }`) over its Streamable-HTTP endpoint.
92
+
93
+
Discovery reads the **instance registry**: every `createDevServer` (CLI `dev`, `viteDevBridge`, `@devframes/next`'s handler) writes a record to `~/.devframe/instances/<pid>-<port>.json` on boot and removes it on close; readers prune records whose liveness probe fails. In-process hosts register explicitly with `registerDevframeInstance` from `devframe/node` — see `createDevframeNextHost().mountMcp` for serving MCP on a Next app's own origin. `--port <n>` probes an explicit port besides the registry; `DEVFRAME_INSTANCES_DIR` relocates the registry and `DEVFRAME_DISABLE_INSTANCE_REGISTRY=1` opts a server out.
94
+
76
95
See the [Agent-Native](/guide/agent-native) page for the full API, safety model, and Claude Desktop integration example.
> Failed to update the devframe instance registry at "`{file}`": `{reason}`
10
+
11
+
## Cause
12
+
13
+
A dev server (or an in-process host calling `registerDevframeInstance`) could not write or remove its record under the instance registry directory — `~/.devframe/instances/` by default, or `$DEVFRAME_INSTANCES_DIR`. Typical causes are a read-only home directory, missing permissions, or a full disk. The server keeps running; only discovery is affected — `devframe connect` will not see this instance.
14
+
15
+
## Fix
16
+
17
+
- Check that the registry directory is writable and the disk has free space.
18
+
- Point `DEVFRAME_INSTANCES_DIR` at a writable directory.
19
+
- Set `DEVFRAME_DISABLE_INSTANCE_REGISTRY=1` to opt out of registration entirely.
20
+
21
+
## Source
22
+
23
+
-[`packages/devframe/src/node/instance-registry.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/node/instance-registry.ts) — `registerDevframeInstance()` reports this on a failed write and its `unregister()` on a failed removal.
> `devframe connect` requires the optional peer dependency @modelcontextprotocol/sdk: `{reason}`
10
+
11
+
## Cause
12
+
13
+
`devframe connect` was started but `@modelcontextprotocol/sdk` could not be imported. The SDK is an optional peer dependency of `devframe` — the MCP surface stays opt-in, so the SDK only needs to be installed where MCP features are used.
14
+
15
+
## Fix
16
+
17
+
Install the SDK next to devframe and run the connector again:
18
+
19
+
```sh
20
+
npm install @modelcontextprotocol/sdk
21
+
devframe connect
22
+
```
23
+
24
+
## Source
25
+
26
+
-[`packages/devframe/src/cli/connect.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/cli/connect.ts) — `startConnectServer()` throws this when the dynamic SDK import fails.
Copy file name to clipboardExpand all lines: docs/guide/agent-native.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,4 +176,6 @@ Agents can act on `fix` directly and follow `docs` for detail — prefer throwin
176
176
177
177
| Command | Description |
178
178
|---------|-------------|
179
-
|`devframe mcp`| Start an MCP server on `stdio`. |
179
+
|`<your-app> mcp`| Start your app's MCP server on `stdio` (from the `createCac` shell). |
180
+
|`<your-app> dev --mcp`| Serve the agent surface on the dev server's `/__mcp` route. |
181
+
|`devframe connect`| Run the app-independent MCP connector: discover running devframes and proxy their tools — see [MCP adapter](/adapters/mcp#discovery-devframe-connect). |
// Single-user localhost demo — skip the trust handshake so the served
23
23
// SPA can call RPC without an OTP round-trip.
24
24
auth: false,
25
+
// Serve the agent surface over the dev server's `/__mcp` route and
26
+
// register the instance for `devframe connect` discovery.
27
+
mcp: true,
25
28
},
26
29
spa: {loader: 'none'},
27
30
setup(ctx){
28
31
// A scoped context auto-namespaces every registered id with `NAMESPACE:`.
29
32
constmy=ctx.scope(NAMESPACE)
30
33
for(constfnofserverFunctions)
31
34
my.rpc.register(fn)
35
+
36
+
// Gateway tool: returns the location of this tool's own docs instead of
37
+
// proxying their content — the agent reads the files with its own tools.
38
+
ctx.agent.registerTool({
39
+
id: `${NAMESPACE}:docs`,
40
+
description: 'Locate the Files Inspector\'s documentation on disk. Call before answering questions about how this tool works, then read the returned files directly.',
0 commit comments