feat(probe): App-side bridge / host SEP-1865 conformance probe#675
Closed
chelojimenez wants to merge 1 commit into
Closed
feat(probe): App-side bridge / host SEP-1865 conformance probe#675chelojimenez wants to merge 1 commit into
chelojimenez wants to merge 1 commit into
Conversation
Add `@modelcontextprotocol/ext-apps/probe` — an optional, App-side module
that lets any view snapshot which bridge methods + notifications the host
actually supports, beyond what `App.getHostCapabilities()` claims.
What it does:
- `attachBridgeProbe(app)` (call before `app.connect()`) observes the
full Host -> View notification timeline (`tool-input`,
`tool-input-partial`, `tool-result`, `tool-cancelled`,
`host-context-changed`) plus the `ui/resource-teardown` request,
without clobbering any handlers the consumer installs.
- `probe.capture({ activeProbes: true })` issues each known View -> Host
method (`ping`, `tools/*`, `resources/*`, `prompts/list`,
`sampling/createMessage`, `ui/open-link`, `ui/download-file`,
`ui/message`, `ui/request-display-mode`, `ui/update-model-context`)
with a benign payload and classifies the response:
- `-32601 Method not found` -> `not-supported`
- any other JSON-RPC error -> `supported` (host understood, refused)
- success -> `supported`
- Pure assertion helpers (`assertBridgeMethods`, `assertHostCapabilities`,
`assertHostContext`) return `{ pass, checks[] }` matching the existing
per-check shape used by adjacent tooling — no test-runner coupling.
- Named host presets (`spec-minimal`, `chatgpt`, `claude-desktop`,
`copilot`, `mcpjam-inspector`) for one-line conformance checks; values
seeded from public docs, refine after cross-host runs.
Why:
Hosts vary in which optional MCP Apps methods and notifications they
actually implement, and capability claims and reality can diverge. The
existing App SDK gives consumers no portable way to read this — they
have to write per-method probes by hand. Library-izing the probe lets
App authors verify host behavior and lets ecosystem tooling (e.g.
mcpjam-learn's host-probe) drop ad-hoc tracking.
Wiring:
- New `./probe` package export.
- New entry in `build.bun.ts`.
- 9 unit tests using `InMemoryTransport` + fake `AppBridge` cover the
claim/capability capture, one-shot notification observation,
`-32601` -> `not-supported` vs other-error classification,
no-clobber of user handlers, and the three assertion helpers.
- Existing 284 ext-apps tests pass unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Open
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
@modelcontextprotocol/ext-apps/probe— an optional, App-side module that lets any view snapshot which bridge methods and notifications the host actually supports, beyond whatApp.getHostCapabilities()claims. Hosts vary in which optional MCP Apps methods/notifications they actually implement, and capability claims can diverge from reality — this probe library makes that surface readable and assertable.What it does
attachBridgeProbe(app)(call beforeapp.connect()): observes the full Host → View notification timeline (tool-input,tool-input-partial,tool-result,tool-cancelled,host-context-changed) plus theui/resource-teardownrequest — without clobbering any handlers the consumer installs. Chains ontoonteardownand usesaddEventListenerfor notifications.probe.capture({ activeProbes: true }): issues each known View → Host method (ping,tools/list,tools/call,resources/list,resources/read,prompts/list,sampling/createMessage,ui/open-link,ui/download-file,ui/message,ui/request-display-mode,ui/update-model-context) with a benign payload and classifies the response:-32601 Method not found→not-supportedsupported (non-mnf-error)— host understood, refused this callsupportedassertBridgeMethods,assertHostCapabilities,assertHostContext) return{ pass, checks[] }. No test-runner coupling; callers decide whether failure logs/throws/uploads.spec-minimal,chatgpt,claude-desktop,copilot,mcpjam-inspector) for one-line conformance checks. Seeded from public docs; marked for refinement after cross-host runs.Usage
Wiring
Tests
Test plan
🤖 Generated with Claude Code