Skip to content

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

Description

@serge-ivo

Gap found while wiring the lead-finder (2026-08-02). query_records/list_collections/insert_record are template(agent)-scoped only — calling them with an instance id returns `{"error":"Agent not found"}`. So there is no MCP path to read or write a subscribed instance's collections, even though the console does it via `/v1/instances/:id/collections/*`.

Why it matters

  • An external process (e.g. the lead-finder's standalone sweep Worker, or Coder) cannot push records into an instance collection via MCP — it must hand-roll auth against the REST route. That's the difference between "call an MCP tool" and "write bespoke plumbing + a token."
  • Agents/automation can't inspect a live instance's data programmatically (the /data tab is human-only).

Ask

Add instance-scoped collection tools to the MCP server (or make the existing ones accept an instance id):

  • list_instance_collections(instance_id)
  • query_instance_records(instance_id, collection, where?, limit?, order_by?)
  • insert_instance_record(instance_id, collection, data) (respect the collection's unique/dedup constraints)
  • Owner-scoped + audited like the other instance MCP tools; gate writes behind the write scope.

Acceptance

  • An owner can read/insert into /v1/instances/:id/collections/leads via MCP.
  • The lead-finder sweep can sync leads into its PAGS instance collection by calling MCP instead of bespoke REST auth.

Motivating case: #58 program / the small-business-website-lead-finder agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions