feat(agent-memory): add account-scoped Agent Memory MCP server - #417
Draft
jonnyparris wants to merge 2 commits into
Draft
feat(agent-memory): add account-scoped Agent Memory MCP server#417jonnyparris wants to merge 2 commits into
jonnyparris wants to merge 2 commits into
Conversation
Persistent, semantically searchable memory for agents, backed by the authenticated user's own R2 bucket and Workers AI (billed to their account via the Cloudflare REST API). - File read/write with YAML-tag and [[wikilink]] indexing - Semantic search over files and indexed conversations - Reminders - On-demand agentic reflection (opt-out; no background cron) - Generic notification webhook configured via set_config - Per-user HNSW vector index in a Durable Object (idFromName(userId)) OAuth built-in via @cloudflare/workers-oauth-provider using shared @repo/mcp-common helpers.
Align storage and index isolation with the selected account, use the shared MCP deployment account/KV, prevent R2 path escape, stage substantive reflection edits with optimistic concurrency checks, and bound resource usage.\n\nReplace the mutable HNSW prototype with a deterministic bounded vector index and add unit/DO regression coverage for storage, search, conversations, reminders, reflection, and tool schemas.
Collaborator
|
Keeping this PR in draft. Staging is deployed, but normal browser OAuth is not functional yet. Blocked until a dedicated OAuth client is provisioned with the Agent Memory staging/production callback URLs and the corresponding Worker secrets are installed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
apps/agent-memory, an account-scoped MCP server for persistent, semantically searchable agent memory.Files live in an R2 bucket (
agent-memory-mcp) in the selected Cloudflare account. Embeddings and on-demand reflection use Workers AI in that same account, so storage and inference are billed there. Search metadata lives in one Durable Object per account (idFromName(accountId)), matching the R2 isolation boundary.Tools (22)
read,write,write_many,reindex,list,list_tags,get_backlinkssearchsearch_conversations,index_conversations,expand_conversation,conversation_statsschedule_reminder,list_reminders,remove_reminder,check_remindersrun_reflection,list_pending_reflections,apply_reflection_changes,archive_reflectionget_config,set_configDesign and safety
@repo/mcp-commonOAuth/account helpers andaccountToolaccount selection...path normalization from escaping the dedicated bucket..mcp/, conversations, reminders, reflection metadata) for dedicated tools and redacts webhook secrets from config responses.reindextool.get_config.history/rollbacktools rather than advertising no-op behavior.Account members with the required permissions share the account's memory; this is documented in the server instructions and README.
Deployment
memory-staging.mcp.cloudflare.commemory.mcp.cloudflare.com/mcp) and legacy SSE (/sse) are registered inserver.json.OAuth client credentials and the cookie-encryption secret remain Wrangler secrets, consistent with the other authenticated MCP servers.
Verification
pnpm check:deps✅pnpm check:turbo— 41/41 tasks ✅pnpm check:format✅pnpm test— 29 files / 281 tests ✅