Skip to content

Document subscribe on custom MCP resources - #734

Draft
kriszyp wants to merge 5 commits into
mainfrom
docs/mcp-custom-resource-subscribe
Draft

kriszyp wants to merge 5 commits into
mainfrom
docs/mcp-custom-resource-subscribe

Conversation

@kriszyp

@kriszyp kriszyp commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

⊙ Problem

Let MCP clients subscribe to custom mcpResources URIs (harper#3257) adds an optional subscribe to static mcpResources entries. Today the MCP reference says only row-backed resources are subscribable. It does not say what an author's subscribe method must return, or when Harper releases the stream.

🤔 Should the docs commit to the release order: end(), otherwise the iterator's return()?

Yes. An author cannot write a correct stream without knowing it. Clients see the refusal of a generator, or of a stream that has neither, as -32603. The implementation's tests pin that order.

💡 Solution

  • reference/mcp/tools-and-resources.md: a new "Subscribing to custom resources" section.
    • It covers the field, a table-backed example, and the contract: authorize before returning, release, access after subscribe, workers and errors.
    • The invalid-entry list now covers a bad subscribe.
  • reference/mcp/subscriptions.md:
    • Custom resources join the subscribable URIs.
    • A new table lists the JSON-RPC errors returned when a subscribe fails.
    • The statements that hold only for row-backed resources now say so: changes-only delivery and the audit-log feed.
    • Reconnect restore runs in the background. It keeps URIs whose subscribe failed or that have no match on the worker yet.
  • reference/mcp/overview.md: the feature list mentions custom subscriptions.
  • release-notes/v5-lincoln/5.4.md: an entry under Subscriptions.

🤔 Is authorizing once, at subscribe time, enough?

That is what the implementation does, and the page says so:

  • Harper ends the stream when the identity lapses.
  • Authors must enforce resource-level access after subscribe.
  • Notifications carry only the URI, and the client's re-read is authorized again.

🤔 Why does the sample's own gate answer -32603 rather than permission denied?

It reuses the page's read-example gate, which throws a plain Error. Only an AccessViolation maps to -32602 permission denied, as the Errors bullet states, and the harper package does not export that class (harper index.ts).

🤔 Should the HTTP 500 → JSON-RPC error change get its own release-note heading?

No. It lands in the same entry because one PR made both changes. The old answer was already a JSON-RPC envelope, only with status 500.

✅ Verification

  • Each behavior claim was checked against harper#3257 at ff6b85701: error strings, release order, generator handling, scoped-token lifetime and restore concurrency.
  • The example's subscribe call has the same shape as the table-backed one in the harper integration fixture, which is tested end to end. The example itself was not run as written.
  • npm run build succeeds with no broken links or anchors, and npm run format:check is clean.
  • Pre-push review: five rounds, two of them full, by Codex, Gemini, Cursor Composer and Cursor Muse, with Harper domain adjudication. Fixed along the way:
    • the example's empty get stub;
    • subscribing through the base table class;
    • the scoped-token and anonymous-session lifetimes;
    • row-backed-only statements;
    • the missing release-note entry.
    • inline version badges, now plain text per CONTRIBUTING.md (raised by Gemini on the PR).
  • One reviewer note stays open by nature. On 2026-10-17, harper had no v5.4 tag or branch, and the newest tag was v5.3.2. So v5.4.0 is the first release that can carry this; recheck the tags before merge.

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @kriszyp.

🤖 Generated with Claude Code

https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah

Related PRs: none found
Complexity: easy

Review-Coverage: authored=claude; ran=gemini,cursor-composer,codex,cursor-muse; adjudicated=domain; declined=cursor-grok,cursor-kimi,muse; rounds=5; full=2 @ c24c6a9

Review-Attention: skim ~2m (decisions: inline-version-marker-form, example-auth-via-get-override, error-shape-change-placement) @ c24c6a9

kriszyp and others added 4 commits October 17, 2026 18:55
A static mcpResources entry can name a subscribe method, so MCP clients
can watch custom URIs with resources/subscribe. Covers the method's
calling convention, how Harper releases the stream, identity lifetime,
the JSON-RPC errors a refused subscribe answers, and background restore
on reconnect.

Companion to HarperFast/harper#3257.

Dispatch-Task: harper-3250-mcp-resource-subscribe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah
… statements

The example now carries its own authorization gate and subscribes through
the exported class; the scoped-token exception, the bad-subscribe case and
the exact not-subscribable message are stated; changes-only delivery and
audit-log delivery are scoped to row-backed resources; a 5.4 release note.

Dispatch-Task: harper-3250-mcp-resource-subscribe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah
…ote does

Dispatch-Task: harper-3250-mcp-resource-subscribe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah
… streams end

Dispatch-Task: harper-3250-mcp-resource-subscribe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Harper Model Context Protocol (MCP) documentation and release notes for version 5.4.0, detailing how MCP clients can now subscribe to custom resources using a new subscribe method. The review feedback recommends avoiding the use of the <VersionBadge> component mid-sentence in running prose across several files, suggesting plain text alternatives instead to improve readability.

Comment thread reference/mcp/overview.md Outdated
Comment thread reference/mcp/subscriptions.md Outdated
Comment thread reference/mcp/subscriptions.md Outdated
@github-actions
github-actions Bot temporarily deployed to pr-734 October 18, 2026 01:24 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-734

This preview will update automatically when you push new commits.

Dispatch-Task: harper-3250-mcp-resource-subscribe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W6f2CJA6oE5ixf6S2b4Ah
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-734

This preview will update automatically when you push new commits.

This branch was successfully deployed

1 active deployment
pr-734 — c24c6a90 Deployed Oct 18, 2026 by github-actions[bot]
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.

1 participant