GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(devframe): add MCP resource subscriptions and templates by dvcolomban · Pull Request #292 · devframes/devframe Conversation
|
| 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.
pnpm lintpnpm knippnpm test — 119 files passed; 1,329 tests passed and 9 skippedpnpm typecheck — 38 tasks passedpnpm build — 27 tasks passedCoverage 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.
There was an error while loading. Please reload this page.
|
@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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:
resources/templates/list, template-backed resources/list, resources/subscribe/resources/unsubscribe, and filtered resources/updated notifications with async disposal.Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.
| 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. |
packages/devframe/src/adapters/mcp/build-server.ts:430
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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
37b5443 to
703d0cf
Compare
703d0cf to
958ec79
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
958ec79 to
9789d03
Compare
|
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 🤔 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.