Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(agent-register): stop saying OpenClaw has no remote MCP client

garrytan27452e420a6d
diff --git a/TODOS.md b/TODOS.md
index 1271fa7a6a..7e81bceaeb 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -2318,12 +2318,12 @@ deferred M-effort issues above are NOT repeated here.
synthesized answers, graph annotations) contains them — catching join/
snippet/synthesis leak classes a source_id check can't see. **Where:**
`evals/brainbench/`. **Effort:** M. **Priority:** P3.
-- [ ] **P3 — OpenClaw native remote-MCP register block, when upstream ships
- remote support.** **What:** `gbrain agent register` renders the honest
- thin-client CLI block for openclaw today (`openclawThinClientBlock` in
- `src/core/mcp-registration.ts`) because OpenClaw has no native remote-MCP
- client; when upstream ships one, add a native client-credentials wiring
- block and demote the CLI block to the fallback. Blocked upstream. **Where:**
+- [ ] **P3 — OpenClaw native remote-MCP register block.** **What:**
+ `gbrain agent register` renders the honest thin-client CLI block for
+ openclaw today (`openclawThinClientBlock` in
+ `src/core/mcp-registration.ts`). OpenClaw now ships a native remote-MCP
+ client (streamable HTTP, `openclaw mcp login`; docs/mcp/OPENCLAW.md), so
+ add a native wiring block and demote the CLI block to the fallback. **Where:**
`src/core/mcp-registration.ts`, `src/commands/agent-register.ts`.
**Effort:** S. **Priority:** P3.
- [ ] **P3 — E2: `gbrain agent list` / `gbrain agent revoke` conveniences.**
diff --git a/docs/mcp/OPENCLAW.md b/docs/mcp/OPENCLAW.md
index 8f8dcc172e..7fa3a15886 100644
--- a/docs/mcp/OPENCLAW.md
+++ b/docs/mcp/OPENCLAW.md
@@ -5,8 +5,10 @@
> [INSTALL_FOR_AGENTS.md](../../INSTALL_FOR_AGENTS.md); the README covers the
> bootstrap and connect paths.
-Connect with [Option 2](#option-2-openclaw-mcp-add) (stdio). Option 1's ClawHub
-bundle is not available yet.
+Connect with [Option 2](#option-2-openclaw-mcp-add) (stdio) when the brain runs on
+the gateway's machine, or with
+[OpenClaw's own MCP client](#remote-brain-openclaws-mcp-client-over-https) when it
+runs elsewhere. Option 1's ClawHub bundle is not available yet.
## Option 1: ClawHub bundle plugin (not available yet)
@@ -78,6 +80,27 @@ Leave `GBRAIN_SOURCE` unset in the MCP env unless you deliberately want
single-source retrieval: a pin scopes every tool (search, `get_brain_identity`
counts, …) to that one source, and nothing warns on reads.
+## Remote brain: OpenClaw's MCP client over HTTPS
+
+When the brain runs on another machine, OpenClaw connects to its MCP endpoint
+itself, over streamable HTTP with OAuth. That grant is scoped and revocable on
+the brain host, while the stdio route above gives the gateway full local
+database access.
+
+```bash
+openclaw mcp add gbrain --url https://<brain-host>/mcp --transport streamable-http --auth oauth
+openclaw mcp login gbrain
+openclaw mcp doctor gbrain --probe
+```
+
+`openclaw mcp login` runs the browser sign-in (on a headless host it prints a
+`--code` command to finish with). OpenClaw registers its client through dynamic
+client registration, so the brain owner turns that on and approves the consent
+([native OAuth path](../guides/hosted-harness-access.md#native-oauth-path),
+[self-service registration](ADMIN.md#self-service-dynamic-registration)). Until
+the login succeeds, OpenClaw leaves the server out of agent turns. Publish the
+endpoint with `gbrain mcp expose` ([remote MCP](../guides/remote-mcp.md)).
+
## Brain-first instructions
Registering the server only makes the tools available. Agents seldom call a
diff --git a/src/core/mcp-registration.ts b/src/core/mcp-registration.ts
index 1812bb2c99..ba3eb88b25 100644
--- a/src/core/mcp-registration.ts
+++ b/src/core/mcp-registration.ts
@@ -253,10 +253,10 @@ export const OAUTH_SECRET_NOTE =
'short-lived, scoped access tokens; revoke with `gbrain auth revoke-client`.';
/**
- * Paste-ready OpenClaw wiring block — HONEST v1. OpenClaw has no native
- * remote-MCP client yet, so the scoped path is a thin gbrain install on the
- * OpenClaw machine (`gbrain init` in mcp-only mode), which routes brain access
- * through the OAuth client minted for it. Deliberately NOT an mcpServers/
+ * Paste-ready OpenClaw wiring block — HONEST v1. The scoped path this client
+ * serves is a thin gbrain install on the OpenClaw machine (`gbrain init` in
+ * mcp-only mode), which routes brain access through the OAuth client minted
+ * for it; OpenClaw's own remote MCP client signs in with its own OAuth login. Deliberately NOT an mcpServers/
* stdio JSON config: the stdio config in docs/mcp/OPENCLAW.md grants FULL
* local DB access and does not use this client.
*/
@@ -279,7 +279,8 @@ export function openclawThinClientBlock(opts: {
init,
'',
'Your OpenClaw reaches the brain through the scoped gbrain CLI (search/query/recall/put);',
- "native remote MCP isn't supported yet — the stdio config in docs/mcp/OPENCLAW.md grants",
+ "OpenClaw's native remote MCP client (streamable HTTP + `openclaw mcp login`) is the other scoped",
+ 'route, with its own OAuth login (docs/mcp/OPENCLAW.md); the stdio config in docs/mcp/OPENCLAW.md grants',
'FULL local DB access and does not use this client.',
].join('\n');
}
diff --git a/test/mcp-registration-blocks.test.ts b/test/mcp-registration-blocks.test.ts
index 0b9b243483..77507e5387 100644
--- a/test/mcp-registration-blocks.test.ts
+++ b/test/mcp-registration-blocks.test.ts
@@ -29,12 +29,13 @@ describe('openclawThinClientBlock', () => {
expect(block).toContain('--oauth-client-secret sekret_xyz789');
});
- test('states the honesty note: scoped-CLI path, no native remote MCP, stdio grants FULL local DB access', () => {
+ test('states the honesty note: scoped-CLI path, OpenClaw\'s native remote MCP is its own OAuth route, stdio grants FULL local DB access', () => {
const block = openclawThinClientBlock(OPTS);
expect(block).toContain(
'Your OpenClaw reaches the brain through the scoped gbrain CLI (search/query/recall/put);',
);
- expect(block).toContain("native remote MCP isn't supported yet");
+ expect(block).not.toContain("isn't supported yet");
+ expect(block).toContain("OpenClaw's native remote MCP client (streamable HTTP + `openclaw mcp login`) is the other scoped");
expect(block).toContain('the stdio config in docs/mcp/OPENCLAW.md grants');
expect(block).toContain('FULL local DB access and does not use this client.');
});