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
{{ message }}
Repository navigation
Host-implemented tools in the session (claude SDK MCP, codex dynamic tools, pi custom tools) #341
Found by Lookout's comparison with the Claude Agent SDK 0.3.296: the SDK can give the agent tools implemented in the host process (createSdkMcpServer({ tools: [tool(...)] })), with no separate server. OAR only attaches stdio and http MCP servers (#170), so a host that wants one in-process tool has to run a server.
Several runtimes have a native channel for host-implemented tools: claude's SDK MCP servers over the control protocol (mcp_message control requests), codex app-server dynamic tools, pi custom tools. Earlier design notes list this as a per-runtime capability.
Design first: one SessionOptions shape for host tools (name, description, JSON schema, handler), mapped to each runtime's native channel and refused where there is none; how calls and results appear in the record stream; cancellation and errors. No compatibility layer: each runtime through its own first-party channel.
Adding measured evidence from a host that needs this channel, since the Codex path is the one currently blocking a real consumer.
Consumer: Sprout (an application embedding OAR as its engine substrate) 1. It injects a run-scoped tool catalog — remote workspace read / search / edit / patch / command bound to a pinned Worker origin — and must dispatch those calls itself. That is exactly the "host-implemented tools" shape this issue describes.
Measured against published packages. I compared @botiverse/oar 0.35.0 and 0.59.1 (latest at time of writing) by unpacking both tarballs and grepping the shipped dist:
Control
0.35.0
0.59.1
SessionOptions.disallowedTools (codex, with config/read pre-thread resolution)
On the last row, both versions carry the same code path in runtimes/codex/session.js:
constonServerRequest=(id,method,params)=>{kernel.request("toApp",{kind: "native",type: method,native: params},{ id });};
with the 0.35.0 comment stating it plainly — server-initiated requests are "recorded as toApp requests, unanswered". Session exposes no typed custom-tool result callback, so rawEvents lets a host observe the request but not serve it. The design doc also lists codex item/tool/call as deliberately left unknown: "a dynamic tool the app runs, neither a question nor served by the adapter".
Why it is worth doing soon.thread/start accepts dynamicTools, so the runtime is already advertising a catalog the host is expected to serve; today an OAR host that registers one gets a request it cannot answer. For an embedding application this is the difference between "the agent can operate on the remote workspace" and "the agent stalls on a tool call", which is why the consumer above currently treats MCP attachment as its only portable external-tool channel.
Two smaller observations from the same comparison, if useful:
Claude:--disallowed-tools and a dedicated environment.js (removing the inherited parent-session markers) both landed after 0.35.0 and are good improvements. But --dangerously-skip-permissions remains hard-coded and launch-args.js now refuses a host --permission-mode, so a host cannot express a permission posture through OAR at all. Given the stated position that "isolation is the sandbox's job", documenting the intended host-side mechanism (OS sandbox profile / container) in docs/runtimes/claude.md would help hosts that need enforcement rather than a preference.
Pi: nothing blocking — noting only that the package list is antigravity claude codex cursor grok kimi opencode pi pi-durable, i.e. pi-durable is now a separate runtime ID from pi.
Happy to supply a repro or a fixture description if that helps scope the SessionOptions shape. No expectation that this is picked up on any particular schedule — recording it here so the evidence is attached to the right issue.
Footnotes
Sprout is a self-hosted multi-agent workspace application; the relevant seam is documented in its src/engine/port.ts (EngineAdapter / EngineSession). Evidence above is a source comparison of the published packages, not a claim about your CI. ↩
Thanks for the measurements and the context on Sprout; they match the source.
For host-served tools, the supported channel today is SessionOptions.mcpServers. The host serves its tools from an MCP server, for example a small streamable HTTP server on localhost inside its own process. OAR attaches it through each runtime's own MCP channel: claude, codex, pi, grok, kimi, opencode and antigravity take it, and cursor refuses it. The mapping and evidence are in docs/spec/runtime-matrix.md#refused-session-options. A codex item/tool/call only comes after a client registers dynamicTools on thread/start. OAR never registers any, so an OAR session does not receive one.
To make this as easy as the Agent SDK's createSdkMcpServer, we plan a helper that serves host-defined tools (name, description, input schema, handler) from a localhost MCP server inside the host process. It returns a ready mcpServers entry, so one implementation works across those runtimes. That is the route we are taking for this issue, rather than per-runtime native channels such as codex dynamicTools.
On claude permissions, OAR always runs claude with --dangerously-skip-permissions. It refuses --permission-mode because that flag would be silently overridden. Enforcement is meant to come from an OS sandbox or container around the session, and we will document that in docs/runtimes/claude.md.
Discussion is welcome here, including the shape of the helper and anything MCP does not cover for Sprout.
This shipped in @botiverse/oar 0.60.0 (#376). serveMcpTools({ name, tools }) serves tools the host implements (name, description, input schema, handler) from an MCP server inside the host process. It listens on localhost behind a random bearer token. Pass served.server in SessionOptions.mcpServers; it works on claude, codex, pi, grok, kimi and opencode.
A handler can return text or MCP content.
A thrown error becomes an isError result the model sees.
The handler's signal aborts when the runtime cancels the call.
One served set can back several sessions.
Usage is in the package README, and details are in docs/spec/runtime-matrix.md#host-served-tools. The claude permissions note is in docs/runtimes/claude.md.
Discussion is welcome here, including anything this does not cover for Sprout.
Activity
tinysnake commentedon Oct 12, 2026
Adding measured evidence from a host that needs this channel, since the Codex path is the one currently blocking a real consumer.
Consumer: Sprout (an application embedding OAR as its engine substrate) 1. It injects a run-scoped tool catalog — remote workspace
read/search/edit/patch/commandbound to a pinned Worker origin — and must dispatch those calls itself. That is exactly the "host-implemented tools" shape this issue describes.Measured against published packages. I compared
@botiverse/oar0.35.0 and 0.59.1 (latest at time of writing) by unpacking both tarballs and grepping the shippeddist:SessionOptions.disallowedTools(codex, withconfig/readpre-thread resolution)runtimes/codex/tool-denials.js)SessionOptions.launchArgs(codex)-coverridesSessionOptions.additionalDirectories(codex →runtimeWorkspaceRoots)item/tool/callOn the last row, both versions carry the same code path in
runtimes/codex/session.js:with the 0.35.0 comment stating it plainly — server-initiated requests are "recorded as
toApprequests, unanswered".Sessionexposes no typed custom-tool result callback, sorawEventslets a host observe the request but not serve it. The design doc also lists codexitem/tool/callas deliberately leftunknown: "a dynamic tool the app runs, neither a question nor served by the adapter".Why it is worth doing soon.
thread/startacceptsdynamicTools, so the runtime is already advertising a catalog the host is expected to serve; today an OAR host that registers one gets a request it cannot answer. For an embedding application this is the difference between "the agent can operate on the remote workspace" and "the agent stalls on a tool call", which is why the consumer above currently treats MCP attachment as its only portable external-tool channel.Two smaller observations from the same comparison, if useful:
--disallowed-toolsand a dedicatedenvironment.js(removing the inherited parent-session markers) both landed after 0.35.0 and are good improvements. But--dangerously-skip-permissionsremains hard-coded andlaunch-args.jsnow refuses a host--permission-mode, so a host cannot express a permission posture through OAR at all. Given the stated position that "isolation is the sandbox's job", documenting the intended host-side mechanism (OS sandbox profile / container) indocs/runtimes/claude.mdwould help hosts that need enforcement rather than a preference.antigravity claude codex cursor grok kimi opencode pi pi-durable, i.e.pi-durableis now a separate runtime ID frompi.Happy to supply a repro or a fixture description if that helps scope the
SessionOptionsshape. No expectation that this is picked up on any particular schedule — recording it here so the evidence is attached to the right issue.Footnotes
Sprout is a self-hosted multi-agent workspace application; the relevant seam is documented in its
src/engine/port.ts(EngineAdapter/EngineSession). Evidence above is a source comparison of the published packages, not a claim about your CI. ↩xxchan commentedon Oct 13, 2026
Thanks for the measurements and the context on Sprout; they match the source.
For host-served tools, the supported channel today is
SessionOptions.mcpServers. The host serves its tools from an MCP server, for example a small streamable HTTP server on localhost inside its own process. OAR attaches it through each runtime's own MCP channel: claude, codex, pi, grok, kimi, opencode and antigravity take it, and cursor refuses it. The mapping and evidence are indocs/spec/runtime-matrix.md#refused-session-options. A codexitem/tool/callonly comes after a client registersdynamicToolsonthread/start. OAR never registers any, so an OAR session does not receive one.To make this as easy as the Agent SDK's
createSdkMcpServer, we plan a helper that serves host-defined tools (name, description, input schema, handler) from a localhost MCP server inside the host process. It returns a readymcpServersentry, so one implementation works across those runtimes. That is the route we are taking for this issue, rather than per-runtime native channels such as codexdynamicTools.On claude permissions, OAR always runs claude with
--dangerously-skip-permissions. It refuses--permission-modebecause that flag would be silently overridden. Enforcement is meant to come from an OS sandbox or container around the session, and we will document that indocs/runtimes/claude.md.Discussion is welcome here, including the shape of the helper and anything MCP does not cover for Sprout.
feat: serveMcpTools serves host-implemented tools over MCP (#376)
chore: release v0.60.0 (#377)
xxchan commentedon Oct 13, 2026
This shipped in
@botiverse/oar0.60.0 (#376).serveMcpTools({ name, tools })serves tools the host implements (name, description, input schema, handler) from an MCP server inside the host process. It listens on localhost behind a random bearer token. Passserved.serverinSessionOptions.mcpServers; it works on claude, codex, pi, grok, kimi and opencode.isErrorresult the model sees.signalaborts when the runtime cancels the call.Usage is in the package README, and details are in
docs/spec/runtime-matrix.md#host-served-tools. The claude permissions note is indocs/runtimes/claude.md.Discussion is welcome here, including anything this does not cover for Sprout.