Repository navigation
examples: add interactive media picker MCP app - #5281
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
…tocol sign-in Drop the static catalog: the model searches, show_media_picker takes URLs, and each link is checked with YouTube oEmbed before it renders. Setting MEDIA_PICKER_BASE_URL requires sign-in through ATProtoProvider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
show_home renders every Hue room with its live color, an on/off switch, brightness presets and saved scenes, next to the verified TV picks. Light changes go through app-only tools to the smart-home Hue server over MCP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
With a single allowed DID the server already knows who is signing in, so the login step goes straight to that account's PDS. The handle page still renders when there is an error to show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
SummaryFailed job: MCP conformance tests — What failed: The pinned
Evidence tracedThe PR (#5281) only touches:
None of these intersect with The conformance runner ( The log gives no per-assertion detail for the three failing scenarios beyond the pass/fail counts (the What remains unknown / verification neededI could not execute code or query GitHub to confirm whether this is:
I lean toward (a): unrelated pre-existing failure, given the complete lack of file overlap and the fact these are task-extension protocol scenarios untouched by this diff. But per instructions I won't label it "pre-existing" without confirming it also fails on the base commit. Concrete next actionRun (or ask CI to re-run) the same conformance job against the PR's base commit ( |
FastMCPApp.ui built its AppConfig without a CSP, so an app UI could not load images or other resources from outside the renderer's defaults, unlike tools registered with PrefabAppConfig(csp=...). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
…olor Room rows take their tint, lamp glow, switch and active-scene chip from the room's live Hue color; scene chips show each scene's palette color. Watch rows use YouTube thumbnails, which the UI's CSP now allows. Tokens and row treatment follow plyr.fm, scene swatches follow after-hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
Level, scene, power and color highlights were rendered from server data, so they stayed on the old values after a tap. Each room now holds its state client-side; taps update it before the command is sent, and the glow, readout and header count follow it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
… sign-in Handles now resolve from their own _atproto TXT record or well-known file instead of a Bluesky AppView. After the token exchange the provider resolves the DID, PDS and authorization server again and requires the same issuer, and the handle claim is set only when the handle resolves back to the DID. The docs describe handles, DIDs and hosting as separate layers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
…hooks The provider no longer carries its own AT Protocol client: the new `atproto` extra installs atproto-oauth, which handles resolution, PAR, DPoP, token exchange, re-verification and revocation. OAuthProxy's upstream callback now calls two overridable steps, the callback's transaction ID and the code exchange, so the provider plugs into them instead of replacing the callback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
The home view, Hue controls and AT Protocol sign-in moved to a separate deployment; thumbnails need FastMCPApp.ui(csp=), which lands separately. Changes outside examples/ go back to main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uN3zXKrzsKxYKNmkNK9Dz
YouTube is the only source the picker verifies, so a required setting whose one legal value is youtube only added configuration. A device that can't play an item now reports it through the actuator's error, which the picker surfaces as a playback failure; a test covers that path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185U3LZpcxFQQJnb6ABuxr1
The lifespan opened the ADB connection at startup and raised when the TV was unavailable, so a sleeping TV stopped the whole server, lights included. FireTVConnection now connects on the first tool call, reconnects on later calls, and raises a ToolError while the TV is unreachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185U3LZpcxFQQJnb6ABuxr1
…k privacy Restarting the ADB daemon only appeared to fix it because the restarted daemon inherited a different launching app's permission. Also document that a sleeping TV no longer blocks startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185U3LZpcxFQQJnb6ABuxr1
…ient-specific copy Links the picker can't parse are reported as "aren't YouTube videos" instead of "can't play on this device", which was wrong without an actuator; state carries unsupported_count. The empty state and "more like this" no longer mention Claude or a home view the example doesn't have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185U3LZpcxFQQJnb6ABuxr1
…they are The README still called the picker's input a sample catalog, and both docs described every device connection as pooled at startup; the Fire TV now connects on first use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185U3LZpcxFQQJnb6ABuxr1
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d1d82252f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def youtube_video_id(url: str) -> str | None: | ||
| """Extract a video ID from the common YouTube URL shapes.""" | ||
| parsed = urlparse(url.strip()) |
There was a problem hiding this comment.
Treat malformed URLs as unsupported links
When the model supplies a syntactically malformed URL such as https://[bad, urlparse() raises ValueError here, causing show_media_picker to fail instead of counting the bad entry and rendering the remaining candidates. This contradicts the behavior documented in examples/apps/media_picker/README.md, where links that cannot be verified or played are counted rather than shown; catch parsing errors per link and return None.
AGENTS.md reference: AGENTS.md:L176-L178
Useful? React with 👍 / 👎.
| if self._client is None: | ||
| try: | ||
| self._client = await setup_android_tv( |
There was a problem hiding this comment.
Serialize lazy Fire TV initialization
When two MCP tool calls arrive before the first setup_android_tv() await completes, both observe _client is None and create separate device connections. The later assignment overwrites one connection, so it is never closed by close(), and concurrent commands may use different clients despite this class promising one connection; protect initialization with an async lock and recheck _client inside it.
AGENTS.md reference: AGENTS.md:L180-L182
Useful? React with 👍 / 👎.
Description
Adds an interactive media picker MCP App: the model passes YouTube links it found, the server verifies each through oEmbed and renders the playable ones, and
PlayandSaverun as app-only tools without another model turn.Playcan drive a real TV by calling aplay_mediatool on another MCP server; the smart-home example's Fire TV server provides one.what's in it
examples/apps/media_picker/: theFastMCPApppicker, its CSS, README, and tests. Links that can't be verified are counted, not shown. Without an actuator configured,Playreturns a demo receipt.examples/smart_home/: aplay_media(source, source_id, url, title)tool on the Fire TV server (YouTube only), and the Fire TV connection now opens on the first tool call instead of at startup, so a sleeping TV no longer takes the lights down with it.examples/smart_home/docs/usage.md: setup and operation, including "No route to host" on macOS, which is Local Network privacy rather than an ADB problem.docs/apps/examples.mdx: an entry for the picker.design notes
Contribution type
Verification
uv run pytest examples/apps/media_picker/test_media_picker.py -q(16 passed)PYTHONPATH=src uv run --with 'androidtv[async]==0.0.75' --with pydantic-settings --with phue2==1.0.0a1 pytest -qinexamples/smart_home(12 passed)uv run pytest tests/docs -n 0(67 passed)uv run prek run --all-filesChecklist
uv run prek run --all-filesand all checks pass🤖 Generated with Claude Code