Skip to content

Use approved MCP servers for selected document sources - #1227

Draft
zlareb1 wants to merge 30 commits into
mainfrom
feat/mcp-source-control-plane
Draft

zlareb1 wants to merge 30 commits into
mainfrom
feat/mcp-source-control-plane

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 23, 2026

Copy link
Copy Markdown
Member

Closes: #1189
Closes: #1190
Closes: #1191
Closes: #1192
Related: #1194
Related: #1209
Related: #1068

Changelog category

  • Backward Incompatible Change

Changelog entry

Read selected documents through approved MCP servers with owner-bound connections, live retrieval, selected imports and refresh, ordinary collection destinations and an access preview. Native gdrive, notion and linear document-source setup and execution are removed; retained registrations and content require explicit retirement or owner-led reconfiguration.

Why

Document sources need one bounded read protocol and declarative service configuration. Adding another service should normally require an approved MCP profile and validated resource or tool mappings. Descriptions, model output and read-only hints cannot grant authority.

The design is in docs/architecture/mcp-document-sources.md. It specifies exact resource identity, stable local citations, account and tenant bindings, capability limits, current-read proof, storage authority, lifecycle and the fleet admission floor. Existing live search, knowledge writes, originals, chunks, revisions, collection grants, protected publication, accounting and erasure remain the shared paths.

Scope and risk

  • Operator approval fixes the HTTPS endpoint, token origin/audience, allowed organizations, read mappings, schemas and work limits. The supported transport profile is remote Streamable HTTP with anonymous access or an existing bearer. OAuth enrollment/refresh, local commands/stdio, legacy SSE, binary imports and inferred tool semantics are unsupported.
  • Connections belong to the authenticated canonical owner. Selected IDs and caller arguments cannot choose another connection, tenant, namespace, endpoint or tool. Schema refusal stops the exact current binding without deleting its credential or history.
  • Live lookup saves no document or memory. Snapshot and selected refresh use the existing knowledge pipeline and retain per-document scope/read proof. Listings are bounded metadata windows, never deletion or ACL evidence. An unchanged document refreshes access metadata without rewriting its original or content revision.
  • Owner-only copies require both the owner and destination access. A team copy requires operator approval, destination administrator authority and explicit confirmation for the exact selection. Its disclosure does not claim upstream ACL equivalence. A shared collection does not make its owner's connection shareable.
  • API, SDK, CLI and dashboard controls reuse the same authority. Participating clients must install durable observation and retained automatic-write guards before declaring source readiness. Missing, replaced, pending or unverifiable proof fails closed. Trusted host/storage and no-rollback requirements, unsupported platforms and nonparticipating applications are explicit limits.
  • The recording lane remains separate. Generic account cleanup, retained history, erasure, publication and existing unrelated integrations are preserved. No stored documents, originals, uploads, secrets, account history or checkpoints are deleted as upgrade cleanup.

PR1068 remains open at 2abfe6a2477c976e151d4efba516b559ae618b93. This change reuses its owner-scoped setup, stale-check invalidation, ordered selection, focus refresh and uncertain-save recovery design. Its provider-specific fields and routes are replaced by the generic connection, selection, destination and preview flow. Its reported cleanup assertion is not counted as resolved by this PR, and that foreign branch is not merged or closed here.

Compatibility, rollout and rollback

  • Added connection operations: knowledge.connection.mcp_profiles, mcp_connect, mcp_list, mcp_inspect, mcp_discover, mcp_browse and mcp_disconnect under the same prefix.
  • Added source operations: knowledge.source.mcp_preview, mcp_add, mcp_update, mcp_list, mcp_inspect, mcp_pause, mcp_resume, mcp_refresh, mcp_read and mcp_remove under the same prefix. Ordinary collection and grant operations manage destinations. SDK calls confer no additional authority.
  • Removed connection.list, connection.disconnect, knowledge.source.update, knowledge.source.parse_links, knowledge.source.push_configure, knowledge.source.push_status, knowledge.source.push_confirm and native consent/callback/notification routes. The native CLI account-connect command and provider-specific source UI are removed.
  • knowledge.source.add now admits recordings. Removed add inputs items, links, include and credential_mode are reported through ignored_args. Native selection/output items/include and probe checked/sampled fields are removed. Native probe, rotation and execution refuse retained unsupported kinds.
  • Operator steps: complete the lifecycle preparation, deploy the admission-floor build across the fleet, configure approved profiles, qualify participating clients and perform the normal source-feature cutover. The additive lifecycle columns and no-op admission journal entry do not enable a connection. Bounded scheduling and catalog settings are documented in the generated configuration reference.
  • Builds below the admission floor preserve opaque registrations and block admission while live. Unknown/current retained bytes are not interpreted through a native codec. Rollback keeps those bytes and refuses unsupported access; it does not translate registrations or use retired credentials. Reconfiguration requires a fresh owner-approved binding, selection and access preview.

Tests

This is a draft implementation. Exact-head hosted qualification and fresh independent review remain required before merge. The source SDK wire-argument join is being corrected; no client parity or feature-readiness claim follows from authored tests.

Focused local checks used the unchanged admission controls, with no local native, integration, database, model or paid execution. Selected server authority, scheduler, read/publication, schema-refusal and opaque-retention cases passed as recorded in the linked issue. The CLI boundary selection passed 33 cases; its actual two-case surface snapshot updater passed. Strict CLI typing passed four source files. Actual Python SDK, CLI and documentation generators ran; some other generator/formatter outputs remain hosted dependencies after preserved capacity/tooling refusals.

Hosted functional qualification is authored for owned ClickHouse and Postgres 16 stores with a synchronous standby and originals bucket. Its 34 fixed cases use real official-SDK resource and mapped-tool servers, actual API/JWT/grants/knowledge writes, two users, privacy/readback, refresh, partial listings, schema drift, revocation, cancellation and installed CLI subprocesses. Remote ASGI routing and local fake embeddings are disclosed; these are synthetic tests, not external-service qualification.

The separate frozen scale qualification uses 10,000 registrations and at least 1,000 eligible sources, bounded fair scheduling and exact work/latency/cancellation/residue limits. Native SDK, frontend, format, schema, mixed-version, storage, privacy and ordinary CI results must be reported at the exact final head. No assertions, floors or limits are relaxed and no unchanged rerun or merge waiver is requested.

No runtime configuration, deployment or production source activation is included. The activation handoff follows qualified source delivery and normal operator cutover.

AI assistance in the code

  • AI-generated: Codex authored the implementation with independent workers. Focused checks and source reviews are recorded on GitHub; complete hosted qualification and final review remain pending.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Focused format, lint, typing and tests pass; full and native results are reported by hosted CI.
  • Generated contracts, configuration, references, reach, schema and snapshots are current through actual generators.
  • Additive migration numbering is current against main.
  • Frontend and maintained SDK builds and tests pass.
  • Documentation describes the supported contract and operator steps without claiming external-service qualification.
  • Commits are signed off.

Configure one remote read engine for resources and explicitly approved tools. Keep protocol evidence separate from source authorization and publication, and qualify transport limits, revocation and cancellation with synthetic SDK servers.

Signed-off-by: zlareb1 <[email protected]>
A cancelled response waiter leaves the SDK HTTP task alive. Give each open client a lifecycle owner, join its shutdown before returning cancellation, and retain the session deadline through idle time. Verify stream cleanup, repeated cancellation and isolation from other clients.

Signed-off-by: zlareb1 <[email protected]>
Join the SDK lifecycle owner after every operation failure, including request
deadlines and cancellation after a background refusal. Preserve the first
caller cancellation while draining stream finalizers and the HTTP pool.

Signed-off-by: zlareb1 <[email protected]>
Reject schema keywords outside their declared type and validate with an
explicit registry that cannot retrieve external resources. Retain response
cleanup through authority checks and join its finalizer outside the work
deadline when handoff fails or is cancelled.

Signed-off-by: zlareb1 <[email protected]>
Check session state and total expiry around authority callbacks and publication
so background HTTP failures cannot yield successful read evidence. Scope issued
cursors by operation and query and accept an absent optional final-page cursor.

Signed-off-by: zlareb1 <[email protected]>
Record HTTP status and media failures before the SDK can consume background
errors. Preserve optional GET and DELETE responses with status 405. Distinguish
omitted mapped cursors from present invalid values during page normalization.

Signed-off-by: zlareb1 <[email protected]>
Use the HTTP client normalization for audience and endpoint checks and refuse pin helpers that change the authorized Host or TLS name.

Signed-off-by: zlareb1 <[email protected]>
Keep versioned payloads opaque, include source-only history in scoped erasure and qualify restore and key rotation on isolated hosted stores.

Signed-off-by: zlareb1 <[email protected]>
Count every retained connection generation before cleanup, preserve strict UUID identity checks with the normal row conversion and record the hosted schema output.

Signed-off-by: zlareb1 <[email protected]>
Preserve the unregistered catalog operation and destination component for later integration and hosted qualification.

Signed-off-by: zlareb1 <[email protected]>
Checkpoint source controls and scope revisions while per-document protected read admission is completed. Generic source execution and public surfaces remain unfinished.

Signed-off-by: zlareb1 <[email protected]>
Use successful per-document read evidence, guarded metadata refresh and the existing private live-publication and worker paths. Checkpoint the implementation while public surfaces, native removal and hosted privacy qualification remain in progress.

Signed-off-by: zlareb1 <[email protected]>
Use the actual analyzer generator artifact from the lifecycle prerequisite head. The ordinary analyzer gate remains required, and later source changes need their own generated manifest.

Signed-off-by: zlareb1 <[email protected]>
Keep foreground closed-session calls terminal while joining pending SDK notification work. Cover discovery-only resource and action-only servers without extra RPCs.

Signed-off-by: zlareb1 <[email protected]>
Preserve retained registrations while removing their native HTTP and OAuth execution paths. Reuse knowledge publication and recording work, and refuse stale selected-read authority.

Signed-off-by: zlareb1 <[email protected]>
Observe protected responses before release and retain publication guards across later requests. Expose source setup through the SDKs, CLI and dashboard, with owned synthetic qualification workflows.

Signed-off-by: zlareb1 <[email protected]>
Use the hosted owned source fixture and built SDK wheel for cross-command protection checks. Remove the retired native account command and describe source setup and retained registrations.

Signed-off-by: zlareb1 <[email protected]>
Keep durable monotonic proof across clients and tasks, observe bounded raw responses before typed results, and exercise owned HTTP cancellation and publication boundaries in hosted tests. Native qualification remains pending.

Signed-off-by: zlareb1 <[email protected]>
Bind durable application-owned proof to the shared HTTP boundary, retain contributing families across tasks and process resume, and add owned HTTP fixtures for hosted race qualification. Native execution remains pending.

Signed-off-by: zlareb1 <[email protected]>
Exercise native protected-client fixtures on declared toolchains and export actual generator candidates without replacing failed checks. Remove obsolete consent-link tests and keep explicit retired-command refusal coverage.

Signed-off-by: zlareb1 <[email protected]>
Reconcile document-source, live-search and retained push-state architecture with selected MCP reads while preserving protected publication, recording, storage and erasure rules.

Signed-off-by: zlareb1 <[email protected]>
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 23, 2026 7:07am UTC

Request Review

@zlareb1 zlareb1 mentioned this pull request Nov 24, 2026
2 of 4 tasks

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant