Skip to content

MCP: instance-scoped collection read/write (#91) - #101

Merged
serge-ivo merged 1 commit into
mainfrom
feat/91-instance-collection-mcp
Aug 1, 2026
Merged

MCP: instance-scoped collection read/write (#91)#101
serge-ivo merged 1 commit into
mainfrom
feat/91-instance-collection-mcp

Conversation

@serge-ivo

Copy link
Copy Markdown
Contributor

Closes #91.

Adds instance-scoped collection MCP tools — the agent-scoped storage tools 404 for instance ids, so there was no MCP path to read/write a subscribed instance's collections (external processes had to hand-roll REST auth).

Tools (in workers/mcp/src/storage-tools.ts, auto-registered via existing registerStorageTools)

  • list_instance_collections(instance_id) → GET /v1/instances/:id/collectionsread scope
  • query_instance_records(instance_id, collection, where?, order_by?, limit?) → GET records — read scope
  • insert_instance_record(instance_id, collection, data) → POST record — write scope, audited

Mirror the agent-scoped equivalents exactly; route to /v1/instances/...; owner-scoped + audited per instance-tool convention. Dedup/unique enforced by the DO (same path the console uses).

Verify

  • pnpm --filter proagentstore-mcp typecheck clean
  • vitest run workers/mcp/ → 38 pass (6 new: registration, routes/methods, query-param build, {data} body, invalid-JSON rejection, write-scope gate)

Reads are gated by read (stricter than the ungated agent-scoped reads — followed the issue + list_instance_triggers precedent).

🤖 Generated with Claude Code

Add three MCP tools so an owner can read/write a subscribed instance's
collections over MCP instead of hand-rolling auth against
/v1/instances/:id/collections/*:

- list_instance_collections(instance_id) -> GET  /v1/instances/:id/collections
- query_instance_records(instance_id, collection, where?, limit?, order_by?)
  -> GET /v1/instances/:id/collections/:name/records
- insert_instance_record(instance_id, collection, data)
  -> POST /v1/instances/:id/collections/:name/records ({data} body)

Reads gated behind the read scope, the write gated behind write, all
audited — matching the existing instance MCP tool conventions. Additive
only; agent-scoped storage tools are unchanged.

Closes #91

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serge-ivo
serge-ivo merged commit 9eed272 into main Aug 1, 2026
1 check passed
@serge-ivo
serge-ivo deleted the feat/91-instance-collection-mcp branch August 1, 2026 21:42
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.

MCP: instance-scoped collection read/write (insert_record/query_records/list_collections)

2 participants