GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(devframe): add MCP resource subscriptions and templates by dvcolomban · Pull Request #292 · devframes/devframe

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Adds resource-content invalidations and RFC 6570 URI templates to Devframe's agent API while preserving the stateless MCP architecture introduced in 8d58eb5.

Devframe authors use one API: concrete resource handles call notifyUpdated(), and template handles call notifyUpdated(concreteUri). Protocol negotiation stays inside the MCP SDK adapter; MCP callers do not select a mode.

Architecture

  • HTTP list, template-list, and read requests remain stateless. The SDK builds a fresh MCP server instance for each request.
  • One endpoint-level bridge publishes Devframe resource invalidations to the SDK notification bus.
  • MCP 2026 owns the long-lived streaming POST used by subscriptions/listen and filters invalidations through each call's resourceSubscriptions.
  • Stdio keeps the SDK-owned, connection-pinned server instance and publishes MCP 2026 invalidations through that instance.
  • MCP 2025 retains list, template-list, and read access. Resource contents remain pull-based because the deprecated resources/subscribe and resources/unsubscribe methods are not registered.
  • No Mcp-Session-Id, URI subscription map, cleanup registry, or other HTTP session state is introduced.

Resources and URI templates

  • Concrete resources keep generated, custom, and nested URIs.
  • RFC 6570 templates are registered through the same registerResource() API.
  • Template readers receive the concrete URL and parsed variables.
  • resources/templates/list exposes dynamic templates; those templates remain absent from resources/list.
  • Reads resolve exact URIs before templates, and overlapping templates follow registration order.
  • Shared-state creation and removal publish catalog changes. Mutations publish the encoded devframe://state/... URI, with endpoint disposal removing every listener.

Protocol compatibility

Transport MCP 2026-07-28 MCP 2025 fallback
HTTP Stateless list/read/template requests plus resource updates through a subscriptions/listen streaming POST Stateless list/read/template requests, pull-only resource contents
stdio Connection-pinned list/read/templates plus resource updates through subscriptions/listen Connection-pinned list/read/templates, pull-only resource contents
Resource subscription methods subscriptions/listen with resourceSubscriptions resources/subscribe and resources/unsubscribe are not registered
Session state No Mcp-Session-Id or subscription map No HTTP session machinery; stdio keeps only the SDK-owned connection

Compatibility preserves resource discovery and reads across both protocol revisions. Push invalidations use the MCP 2026 subscription model.

Verification

  • pnpm lint
  • pnpm knip
  • pnpm test — 119 files passed; 1,329 tests passed and 9 skipped
  • pnpm typecheck — 38 tasks passed
  • pnpm build — 27 tasks passed

Coverage includes concrete and template registration, parsed variables, nested paths, precedence, unregistering, update events, MCP 2026 HTTP and stdio delivery, URI filtering, MCP 2025 pull access, shared-state lifecycle notifications, listener disposal, event-document parity, and API snapshots.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dvcolomban
dvcolomban commented Aug 25, 2026
View reviewed changes
Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/content/1.guide/14.agent-native.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/devframe/src/node/host-agent.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@dvcolomban
dvcolomban marked this pull request as ready for review August 25, 2026 16:44
Copilot AI lite review requested due to automatic review settings August 25, 2026 16:44
Copilot started reviewing on behalf of dvcolomban August 25, 2026 16:45
View session
Copilot AI reviewed Aug 25, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class MCP resource capabilities to Devframe’s agent surface by introducing resource templates, lazy resource providers, and per-connection resource subscriptions. This extends the existing “tools vs readable context” model so adapters (notably MCP) can advertise URI families, list concrete instances, and push invalidation updates to subscribed clients without polling.

Changes:

  • Extend the agent API/types to support concrete resources, URI templates, resource providers, and subscription lifecycle hooks (read/list/subscribe/unsubscribe + updated notifications).
  • Implement MCP server support for resources/templates/list, template-backed resources/list, resources/subscribe/resources/unsubscribe, and filtered resources/updated notifications with async disposal.
  • Add/expand tests (in-memory + stdio + HTTP) and update docs to describe the new resource model and events.

Reviewed changes

Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/snapshots/tsnapi/devframe/types.snapshot.d.ts Snapshot updates for newly exported agent resource/provider/template types.
tests/snapshots/tsnapi/devframe/internal.snapshot.d.ts Snapshot updates for DevframeAgentHost’s updated private fields and new resource APIs.
tests/snapshots/tsnapi/devframe/index.snapshot.d.ts Snapshot updates for public agent interfaces (templates/providers/subscriptions).
tests/snapshots/tsnapi/devframe/constants.snapshot.d.ts Snapshot update for the new agent:resource:updated event constant.
skills/devframe/SKILL.md Update skill docs/examples to include templates/providers/subscriptions usage.
packages/devframe/src/types/agent.ts Core type additions for templates, providers, variables, handles, and new agent host methods/events.
packages/devframe/src/node/host-agent.ts Agent host implementation for registering templates/providers and forwarding reads/subscriptions + update notifications.
packages/devframe/src/node/tests/host-agent.test.ts Unit tests covering custom URIs, templates, variables, subscriptions, handles, and providers.
packages/devframe/src/events.ts Add the agent:resource:updated event name to the central event map.
packages/devframe/src/adapters/mcp/fetch.ts Ensure MCP session disposal awaits async resource cleanup.
packages/devframe/src/adapters/mcp/build-server.ts MCP resources: list/read/templates + subscribe/unsubscribe + subscription reconciliation/disposal.
packages/devframe/src/adapters/mcp/tests/mcp-server.test.ts In-memory MCP tests for explicit URIs, templates, subscription behavior, provider churn, and stdio coverage.
packages/devframe/src/adapters/mcp/tests/mcp-http.test.ts HTTP transport test verifying session-local subscriptions and cleanup on disconnect.
packages/devframe/src/adapters/mcp/tests/fixtures/resource-stdio-server.ts Stdio fixture server wiring resources + template and emitting updates.
docs/content/1.guide/20.events.md Document agent:resource:updated and clarify registered payload types.
docs/content/1.guide/14.agent-native.md Document resource URIs, templates, subscriptions, and providers for native agent usage.
Suppressed comments (1)

packages/devframe/src/adapters/mcp/build-server.ts:430

  • During manifest reconciliation, the code removes each subscription from the subscriptions map before awaiting its cleanup. If a cleanup throws/rejects, the outer .catch() swallows the error and the subscription is permanently lost (not tracked for later disposal/retry), causing leaks and inconsistent subscription state. Keep the subscription tracked until cleanup succeeds, and handle cleanup errors per-URI so one failure doesn’t abort the entire reconciliation pass.
      for (const [uri, cleanup] of [...subscriptions]) {
        subscriptions.delete(uri)
        await cleanup()
        const resource = resolveAgentResource(ctx, uri)
        if (!resource)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@dvcolomban
dvcolomban marked this pull request as draft August 25, 2026 17:30
This was referenced Aug 25, 2026
Investigate migration to stateless MCP 2026-07-28 #293
Closed
Proposal: support MCP progress and Tasks for long-running agent tools #294
Open
@dvcolomban
dvcolomban force-pushed the dvcol/mpc-ressource branch from 37b5443 to 703d0cf Compare August 27, 2026 09:51
@dvcolomban dvcolomban changed the title feat(devframe): add MCP resource providers, templates, and subscriptions feat(devframe): add MCP resource templates, providers, and updates Aug 27, 2026
@dvcolomban dvcolomban mentioned this pull request Aug 27, 2026
feat(devframe): add request-bound tool progress #311
Draft
@dvcolomban
dvcolomban force-pushed the dvcol/mpc-ressource branch from 703d0cf to 958ec79 Compare August 27, 2026 13:46
@dvcolomban dvcolomban changed the title feat(devframe): add MCP resource templates, providers, and updates feat(devframe): add MCP resource subscriptions Aug 27, 2026
dvcolomban
dvcolomban commented Aug 27, 2026
View reviewed changes
Comment thread packages/devframe/src/adapters/mcp/__tests__/mcp-http.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@dvcolomban
feat(devframe): add MCP resource subscriptions and templates
9789d03
@dvcolomban
dvcolomban force-pushed the dvcol/mpc-ressource branch from 958ec79 to 9789d03 Compare August 27, 2026 15:15
@dvcolomban dvcolomban changed the title feat(devframe): add MCP resource subscriptions feat(devframe): add MCP resource subscriptions and templates Aug 27, 2026
@dvcolomban

dvcolomban commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

This is getting a bit sprawling, before investing more time, @antfu do you think this is something worth investigating further ?

And if so, how far (if any) should devframes support pre 2026 MCP spec for subscriptions ?

I'm struggling to reconcile api complexity with backward compatibility 🤔

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@dvcolomban
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.