Skip to content

feat(mcp): expose scoped main session and memory tools - #177190

Open
naamah75 wants to merge 3 commits into
openclaw:mainfrom
naamah75:feat/mcp-main-memory
Open

naamah75 wants to merge 3 commits into
openclaw:mainfrom
naamah75:feat/mcp-main-memory

Conversation

@naamah75

@naamah75 naamah75 commented Oct 19, 2026 •

Copy link
Copy Markdown

What Problem This Solves

openclaw mcp serve currently exposes only sessions with external channel route metadata. An MCP client such as Codex therefore cannot access the local main session agent:main:main, cannot send it a turn, and cannot search or read the main agent's persistent memory. Passing either main or agent:main:main to conversation_get returns conversation not found when that session has no channel route.

Summary

Add a deliberately narrow, owner-only MCP surface:

  • sessions_history
  • sessions_send
  • memory_search
  • memory_get

The bridge fixes the target server-side to agent main and session agent:main:main. The public schemas do not accept agent or session selectors, so these tools cannot target arbitrary sessions.

Security Boundary

  • Requests Gateway admin scope and relies on authenticated Gateway authorization.
  • Hard-binds invocation to agentId: main and sessionKey: agent:main:main.
  • Does not expose agent, session, user, or owner selectors.
  • Reuses existing Gateway tools for history sanitization, memory path validation, and policy enforcement.

Evidence

Focused test command:

corepack pnpm test src/mcp/channel-server.test.ts --maxWorkers=1

Result: 12/12 tests passed locally on both the v2026.10.4 implementation and the branch rebased onto current upstream main.

Added tests verify:

  • all four calls are forced to agent main and session agent:main:main;
  • session and agent selector arguments are absent from the advertised MCP schemas;
  • the existing channel conversation tools continue to pass their prior tests.

Live observation before the change:

  • conversations_list returned an empty list;
  • conversation_get returned conversation not found for both main and agent:main:main.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: copilot-proxy Extension: copilot-proxy extensions: diagnostics-otel Extension: diagnostics-otel extensions: llm-task Extension: llm-task extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb labels Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has dependency changes awaiting review. A future dependency graph change from an external contributor requires a maintainer's /allow-dependencies-change comment after the guard notice identifies that revision.

  • Current SHA: cbc70ad22e24c6bb86678509b79c825dc984952c

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: cbc70ad22e24c6bb86678509b79c825dc984952c

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 21c6eb4bdb2ea906c02094cf7d044c097050ba83, but the PR head is now cbc70ad22e24c6bb86678509b79c825dc984952c. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-10-19T10:19:36.036Z sha 21c6eb4 :: needs real behavior proof before merge. :: [P1] Preserve existing non-admin channel bridge connections | [P2] Use a supported Gateway path for the advertised send tool | [P2] Separate external turn admission from inter-session caller identity

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. size: S triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant