Skip to content

Expose services/documents.ts#listBacklinks via MCP #258

Description

@brylie

docs/prd.md's P1 "Backlinks" requirement (line 254) frames the feature as "completing the read half of the linking model the MCP write side already has in P0" — not just a UI panel. PR #257 (closing #83) shipped services/documents.ts#listBacklinks and a BacklinksPanel.svelte UI, but the manifest entry is { ui: true, mcp: false }: an MCP-connected agent reading a Document via get_document still has no way to discover what else in the workspace links to it, even though create_record/write_record can already author and retarget those same links via referencedRecordId (internal-links.md §4). The read half of that MCP-facing linking model stays incomplete until this ships.

listBacklinks already does everything a list_backlinks MCP tool needs — permission-filtered per source Document the same way listDocuments is, and audited (list_backlinks action) — so this is a thin registration following service-layer-manifest.md §3's generated-from-manifest pattern, not new service logic.

Related: #81 (durable reverse-link projection) already anticipates MCP exposure in its own scope, but as part of a durable rebuild that's unmilestoned and blocked on #70. This issue is a sooner, interim step against the current listBacklinks implementation — #81 should migrate/subsume this tool onto its durable projection once that lands, not reimplement it. See #81's own updated description for this connection.

  • Set documents.listBacklinks's manifest entry to mcp: true with a tool name (list_backlinks) and description.
  • Register the tool via the manifest-generated MCP table.
  • Add Tier A MCP-transport coverage proving a real MCP client can list backlinks for a Document it has access to, and is denied/filtered for one it doesn't.
  • Document the new tool in docs/specifications/mcp-tools.md.

Not in scope: the durable reverse-link projection itself (#81) — this ships an MCP tool against the current per-request shard fan-out, the same cost profile its UI counterpart already accepted.

Done when: an MCP client can call list_backlinks for a Document, gets the same permission-filtered results the UI's Backlinks panel shows, and the tool is documented in mcp-tools.md.


Added to 0.5.0 — Stability, Reliability, and QA (2026-09-12): the sooner interim MCP-backlinks step explicitly scoped ahead of #81 (already in this release) — closes the read half of the linking model's MCP-facing gap now rather than waiting on #81's durable rebuild.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions