Skip to content

feat: add user-owned MCP agent connections - #147

Merged
LeoStehlik merged 1 commit into
masterfrom
feat/mcp-v1
Nov 21, 2026
Merged

LeoStehlik merged 1 commit into
masterfrom
feat/mcp-v1

Conversation

@LeoStehlik

Copy link
Copy Markdown
Contributor

WrenLore can now be used by an agent through MCP under an existing user's account, with changes attributed as User, via Agent. Previously the workspace MCP setting had no working server or user-token management surface.

Behavior

  • Add /mcp Streamable HTTP and the same scoped operations at /api/agent/tools/:name: browse/search/read/create/edit pages, read/add comments and inspect history.
  • Add once-only user tokens with hashed storage, expiry/revocation, read-only/read-write access and optional selected-space restrictions. Current account and page permissions remain authoritative; the general browser API does not accept these tokens.
  • Edit the live collaborative document using revision/block references. Preserve untouched rich blocks, save before/after history, acknowledge database persistence and deduplicate retries with durable operation records and signed CRDT receipts.
  • Add workspace enablement, account token settings, and agent attribution in comments, history and audit records. Keep permission checks on the transaction connection so concurrent retries cannot exhaust a small DB pool.
  • Document OpenCode V2 and OpenClaw configuration, errors/retries, API scope and provenance in docs/MCP.md.

Validation

  • Server and client builds passed.
  • 43 existing/extended page, comment and SAML tests; four native document/queue regression tests passed.
  • Full MCP SDK integration passed with two application processes, Redis document-owner routing and a two-connection database pool. Covers live browser edits, stale revisions, rich-block preservation, concurrent retries, injected save failure, receipt tampering, permission changes, token expiry/revocation and API boundaries.
  • OpenCode 2.3.2 completed create/read/edit/comment/history through the MCP tools.
  • OpenClaw 2026.11.5-beta.1 discovered all ten tools and completed create/read/comment through an isolated embedded agent, with no tool failures.
  • Chromium and WebKit tested token creation, once-only display and revocation.
  • Add a GitHub Actions workflow for the document, authorization and multi-process integration regressions.

Scope and rollout

The migration is additive. MCP remains disabled until a workspace administrator enables it. Content editing is supported; service accounts, moves, deletion, sharing, permission changes and metadata editing remain outside V1. Operation receipts are retained for reliable retries. Notifications/indexing remain asynchronous after a successful content commit.

Validated against disposable instances; this PR has not been deployed to production.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant