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
- ctx.agent.registerToolProvider(() => AgentToolInput[]): a lazy tool
source queried at list/getTool/invoke time — the same on-demand
projection applied to agent-flagged RPCs; earlier sources win on id
collision; handle.notifyChanged() drives tools/list_changed
- hub commands host derives its agent projection through one provider:
the commands map is the single source of truth, replacing the
registerAgentTools/unregisterAgentTools mirror and its handle map
- built-in and connector tool names follow the devframe:<area>:<fn>
convention: read_state -> devframe:state:read, devframe_index ->
devframe:connect:list-instances, devframe_call ->
devframe:connect:call-tool
Copy file name to clipboardExpand all lines: docs/adapters/mcp.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,8 +87,8 @@ The `devframe` bin ships an MCP **connector** — a thin discovery + proxy serve
87
87
88
88
It exposes two gateway tools:
89
89
90
-
-**`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.
90
+
-**`devframe:connect:list-instances`** — 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:connect:call-tool`** — invoke one tool on one instance (`{ port, tool, args }`) over its Streamable-HTTP endpoint.
92
92
93
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.
When tools derive from state you already maintain — a command registry, a plugin catalog — register a **provider** instead of mirroring registrations. The host queries it at list/invoke time (the same lazy projection it applies to `agent`-flagged RPCs), so your source of truth stays the only copy:
The hub's commands host uses exactly this to project agent-flagged palette commands.
82
+
66
83
## Registering a resource
67
84
68
85
Resources surface readable snapshots of state, identified by URI:
@@ -79,7 +96,7 @@ ctx.agent.registerResource({
79
96
80
97
Every `ctx.rpc.sharedState` key is also automatically exposed to MCP as `devframe://state/<key>`. Pass `exposeSharedState: false` (or a filter function) to `createMcpServer` to opt out.
81
98
82
-
Shared state is additionally reachable through the built-in **`read_state` tool** — call it without arguments for the key list, with a `key` for that value — since many MCP clients only consume tools. It honors the same `exposeSharedState` filter as the resource projection.
99
+
Shared state is additionally reachable through the built-in **`devframe:state:read` tool** — call it without arguments for the key list, with a `key` for that value — since many MCP clients only consume tools. It honors the same `exposeSharedState` filter as the resource projection.
Copy file name to clipboardExpand all lines: packages/devframe/src/cli/connect.ts
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -38,19 +38,19 @@ interface IndexedInstance {
38
38
hint?: string
39
39
}
40
40
41
-
constINDEX_TOOL='devframe_index'
42
-
constCALL_TOOL='devframe_call'
41
+
constINDEX_TOOL='devframe:connect:list-instances'
42
+
constCALL_TOOL='devframe:connect:call-tool'
43
43
44
44
constMCP_DISABLED_HINT
45
-
='This instance runs without an MCP route. Restart it with the --mcp flag (or set `cli.mcp: true` on its definition) to expose its tools, then call devframe_index again.'
45
+
='This instance runs without an MCP route. Restart it with the --mcp flag (or set `cli.mcp: true` on its definition) to expose its tools, then list instances again.'
46
46
47
47
/**
48
48
* Start the devframe MCP connector on stdio: a thin discovery + proxy server
49
49
* in the shape next-devtools-mcp validated. It exposes two gateway tools —
50
-
* `devframe_index` (discover running devframe instances via the instance
51
-
* registry and list each one's MCP tools) and `devframe_call` (invoke one
52
-
* toolon one instance over its Streamable-HTTP endpoint) — and holds no
53
-
* domain knowledge of its own.
50
+
* `devframe:connect:list-instances` (discover running devframe instances via
51
+
* the instance registry and list each one's MCP tools) and
52
+
* `devframe:connect:call-tool` (invoke one tool on one instance over its
53
+
* Streamable-HTTP endpoint) — and holds no domain knowledge of its own.
description: 'Discover every running devframe dev server on this machine and list each one\'s MCP tools. Call this FIRST, before assuming which devtools are available — the result names the instance (id, project root, origin) and the port to pass to devframe_call. Safe to call freely.',
70
+
description: 'Discover every running devframe dev server on this machine and list each one\'s MCP tools. Call this FIRST, before assuming which devtools are available — the result names the instance (id, project root, origin) and the port to pass to the call tool. Safe to call freely.',
description: 'Invoke one MCP tool on one running devframe instance discovered via devframe_index. Pass the instance\'s port, the tool name, and the tool\'s arguments object.',
77
+
description: 'Invoke one MCP tool on one running devframe instance discovered via the list-instances tool. Pass the instance\'s port, the tool name, and the tool\'s arguments object.',
78
78
inputSchema: {
79
79
type: 'object',
80
80
properties: {
81
-
port: {type: 'number',description: 'The instance\'s port, from devframe_index.'},
81
+
port: {type: 'number',description: 'The instance\'s port, from the list-instances tool.'},
82
82
tool: {type: 'string',description: 'Tool name, from the instance\'s tool list.'},
83
83
args: {type: 'object',description: 'Arguments object for the tool. Omit for zero-argument tools.'},
0 commit comments