Commit graph

526 commits

Author SHA1 Message Date
Den Delimarsky
7eec75164a
Format README with prettier 2026-02-20 20:53:10 +00:00
Den Delimarsky
2af02baf46
Update README hero gif to Excalidraw, add new agent skills 2026-02-20 20:47:02 +00:00
Den Delimarsky
8543d8d5dc Lead README with agent skills for faster onboarding
Move the agent skills section to the top of the README so readers
immediately see how to install and start building. Keep Claude Code
install commands front and center with a brief pointer to the agent
skills guide for other agents. Specification section moves below
Examples.
2026-02-20 19:37:58 +00:00
Olivier Chafik
37e127034f
Add fullscreen button to threejs-server (#446)
* Add fullscreen button to threejs-server

* Simplify wrapper: pass app instance directly instead of useCallback wrappers

* Update examples/threejs-server/src/threejs-app.tsx

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>

* Update examples/threejs-server/src/threejs-app.tsx

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>

* prettier

---------

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2026-02-19 19:17:04 +00:00
Olivier Chafik
8cad9f04c0
Add PDF search feature to pdf-server (#445)
* Add PDF search feature to pdf-server

Adds full-text search functionality to the PDF viewer:

- Search button in toolbar (Ctrl/Cmd+F to open)
- Search bar with input, prev/next navigation, match count
- Text extraction and caching across all pages
- Highlight overlays using DOM Range API
- Case-insensitive search across entire document
- Keyboard shortcuts: Ctrl+F (open), Enter (next), Shift+Enter (prev), Escape (close)

Changes:
- mcp-app.html: Add search button, search bar, highlight layer
- src/mcp-app.css: Add search/highlight styles and PDF.js text layer rules
- src/mcp-app.ts: Add search state, functions, event listeners

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update screenshots

* Add fullscreen button to threejs-server

* Fix prettier formatting

* Move search bar below toolbar, right-aligned

* Make search bar compact and right-aligned

* Float search bar over page content

* Ctrl/Cmd+F toggles search; pass through to browser when empty

* Hide search nav controls until query is entered

* Skip scroll when search highlight is already visible

* Fix search bar right-edge alignment with container border

* Prevent browser find when our search is open with text

* Cmd+F when search input is focused passes through to browser find

* Fix prettier formatting in README

* Remove unrelated formatting and threejs changes from PR

* prettier

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:56:40 +00:00
Olivier Chafik
f615123711
Add double-connect guard to prevent protocol message handling errors (#450)
* fix: guard against double-connect in App and AppBridge (#429)

Calling connect() twice on the same transport instance caused the MCP
SDK's Protocol class to chain onmessage handlers, so each incoming
message was processed twice. This made incoming responses get consumed
by the first processing (resolving the handler) and then trigger a
spurious "Received a response for an unknown message ID" error on the
second processing pass, since the handler was already removed from the
response map.

Add an explicit guard in both App.connect() and AppBridge.connect() that
throws if the instance is already connected. This converts the silent
message-corruption into a clear, actionable error and prevents
downstream confusion.

Adds three regression tests:
- AppBridge.connect() throws when already connected
- App.connect() throws when already connected
- Demonstrates the double-processing root cause and verifies it is fixed

Fixes #429

https://claude.ai/code/session_01XU3FW1TpjBkyRbkBUH5gqR

* test: replace redundant regression test with cleaner same-transport guard check

The previous third test in "double-connect guard" never actually attempted
a double-connect — it created fresh instances and verified normal operation,
which every other test already covers. The stray bridge.onupdatemodelcontext
and bridgeTransport.close() at the top were leftover noise.

Replace it with a focused test that verifies the guard fires even when
the caller passes the *same* transport object (not just a different one),
which is the exact scenario described in #429.

https://claude.ai/code/session_01XU3FW1TpjBkyRbkBUH5gqR

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-17 18:15:24 +00:00
Jonathan Hefner
8dbc06a355
Merge pull request #462 from jonathanhefner/remove-typedoc-theme-css-patch
Upgrade `typedoc-github-theme` to v0.4.0 and remove local CSS workaround
2026-02-17 08:06:34 -06:00
Anton Pidkuiko
0b48dfab7d
Merge pull request #463 from modelcontextprotocol/localden/readme
README update
2026-02-17 10:45:25 +00:00
Den Delimarsky
5eab6da3fc
README update 2026-02-16 23:03:52 -08:00
Den Delimarsky
62e1a5a0ae
README update 2026-02-16 23:01:59 -08:00
Den Delimarsky
512016053d
README update 2026-02-16 23:00:57 -08:00
Den Delimarsky
c2a0b5ccad
Update with media 2026-02-16 22:59:17 -08:00
Den Delimarsky
291006ab73
Update with media 2026-02-16 22:57:28 -08:00
Den Delimarsky
a427e7127d
Update with media 2026-02-16 22:52:59 -08:00
Den Delimarsky
22bffa8782
Update with media 2026-02-16 22:51:16 -08:00
Den Delimarsky
8242496f3e
Update README 2026-02-16 21:26:21 -08:00
Den Delimarsky
716d7c1c5c
Update README 2026-02-16 21:23:08 -08:00
Den Delimarsky
09e1684db4
Update README 2026-02-16 21:19:48 -08:00
Den Delimarsky
c372c1f6a1
Update README 2026-02-16 21:16:47 -08:00
Jonathan Hefner
5c4000bafd
Upgrade typedoc-github-theme to v0.4.0 and remove local CSS workaround
v0.4.0 includes the typography fixes from upstream PR
JulianWowra/typedoc-github-theme#7, so the local `customCss` override
(`scripts/typedoc-github-theme-fixes.css`) added in 0bbbfee is no
longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-16 13:27:39 -06:00
Jonathan Hefner
a8ff280145
Merge pull request #461 from Avcharov/fix/flaky-e2e-tests
fix: update e2e test snapshots for shadertoy and wiki-explorer images
2026-02-16 11:15:33 -06:00
Hryhorii Avcharov
91c135350d fix: update e2e test snapshots for shadertoy and wiki-explorer images 2026-02-15 12:01:16 +01:00
Olivier Chafik
666952980f
feat(app): throw helpful error when callServerTool is called with a string (#449)
Users frequently call callServerTool("tool_name", args) instead of the
correct callServerTool({ name: "tool_name", arguments: args }), resulting
in a silent/confusing failure. Detect this and throw immediately with
a message that shows the correct call shape.

Also fixes the incorrect example in examples/pdf-server/README.md that
demonstrated this same wrong usage pattern.

Fixes #386

https://claude.ai/code/session_01GqAyN4Ux7svWoU2HqsSLZF

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-13 21:05:21 +00:00
Jonathan Hefner
0bbbfee8c2
Merge pull request #442 from jonathanhefner/typedoc-theme-css-patch
Apply `typedoc-github-theme` typography fixes locally via `customCss`
2026-02-12 10:22:47 -06:00
Salman Chishti
a4fda18caa
Upgrade GitHub Actions for Node 24 compatibility (#392)
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2026-02-12 15:31:10 +00:00
Salman Chishti
93b619cae6
Upgrade GitHub Actions to latest versions (#393)
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2026-02-12 15:30:57 +00:00
Max Stoiber
c60ee352ae
Change Host <> Sandbox communication protocol to "SHOULD" (#435)
In ChatGPT, we have our own sandbox <> host communication protocol that doesn't match the names of the protocol enforced by the "MUST" in the spec.

This changes that by marking the specific messages sent back and forth as a "SHOULD".
2026-02-12 15:29:03 +00:00
Hryhorii (Greg) Avcharov
10d1f9dc6d
fix: align basic-host dark mode styles (#438) 2026-02-12 15:28:51 +00:00
Health Kowshik
3b15f063fe
Update theme toggle button position in CSS from top to bottom (#441) 2026-02-12 15:28:44 +00:00
Olivier Chafik
fd8cc978d4
fix(message-transport): only ignore messages that lack jsonrpc: "2.0" (#448)
Tighten the parse-failure handler: silently ignore postMessage frames
where event.data?.jsonrpc !== "2.0" (i.e. not JSON-RPC at all — null,
undefined, a primitive, or an object from the host environment that
doesn't carry the jsonrpc field). Messages that do carry jsonrpc: "2.0"
but are otherwise malformed still surface via onerror so genuine protocol
errors aren't swallowed.

https://claude.ai/code/session_01DaJpUtSJf4hA7tnu3nJz8s

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-12 15:28:32 +00:00
Jonathan Hefner
a815f31392
Merge pull request #444 from jonathanhefner/fix-migrate-oai-app-skill-name
Rename `migrate-oai-app` skill `name` to align with spec
2026-02-10 09:02:19 -06:00
Jonathan Hefner
f9c96d973c
Merge pull request #443 from vgshenoy/patch-1
Rename skill to 'create-mcp-app' to align with spec
2026-02-10 09:01:58 -06:00
Jonathan Hefner
6d79123b97
Rename migrate-oai-app skill name to align with spec
The skill name spec requires lowercase letters, numbers, and hyphens
only. Change `name` from "Migrate from OpenAI App" to `migrate-oai-app`.

Companion to #443, which does the same for the `create-mcp-app` skill.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-10 08:50:49 -06:00
Vignesh Shenoy
0ea69081a0
Rename skill to 'create-mcp-app' to align with spec
As per the spec (https://agentskills.io/specification) `name` should be:

 "Max 64 characters. *Lowercase letters*, numbers, and *hyphens* only. Must not start or end with a hyphen."
2026-02-10 11:23:20 +01:00
Jonathan Hefner
faabb6d1af
Apply typedoc-github-theme typography fixes locally via customCss
Backport the `.tsd-typography` CSS fixes from upstream PR
JulianWowra/typedoc-github-theme#7 so document pages render with
GitHub-accurate heading spacing, list bullets, line-height, and code
block overflow. The override file and `customCss` config can be removed
once the PR is merged and the dependency is updated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 11:15:30 -06:00
Olivier Chafik
bcfffb6585
Clarify spec and SDK: accept UIResourceMeta in both resources/list and resources/read (#410)
* Clarify spec and SDK: accept UIResourceMeta in both resources/list and resources/read

The spec defines UIResource with _meta.ui, implicitly as an extension of the Resource type (resources/list), but examples and practice place _meta.ui on TextResourceContents (resources/read). The registerAppResource helper accepts _meta.ui in its config (which ends up in resources/list), but examples only return said _meta.ui from resources/read — and current hosts might be just ignoring it.

This change:
- Adds a 'Metadata Location' subsection to the draft spec explicitly stating that _meta.ui is valid on both the resource listing entry AND the content item, with content-item taking precedence.
- Updates the spec example to show _meta on the resource declaration (resources/list).
- Updates the CSP construction example to reference both locations.
- Clarifies McpUiAppResourceConfig JSDoc: _meta here appears in resources/list and serves as a listing-level fallback for when content items omit _meta.ui.
- Fixes the map-server example comment that incorrectly stated _meta must only be on the content item.

* Add McpUiReadResourceResult type for UI metadata in resources/read

* basic-host: support UIResourceMeta fallback from resources/list

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-04 14:26:09 +00:00
Jonathan Hefner
2dd56c3dce
Merge pull request #422 from jonathanhefner/everything-is-external
Replace "external" with "network" in CSP documentation
2026-02-03 10:29:52 -06:00
Jonathan Hefner
78b319e29a
Merge pull request #421 from jonathanhefner/use-double-quotes-in-npm-scripts
Use escaped double quotes in npm scripts for Windows compatibility
2026-02-03 09:41:28 -06:00
Anton Pidkuiko
398f5b4e4a
Merge pull request #294 from matteo8p/create-helper-functions-tool-visibility
Add `isToolVisibilityModelOnly` and `isToolVisibilityAppOnly` helper functions
2026-02-02 23:15:46 +00:00
Jonathan Hefner
c39b40e7c8
Replace "external" with "network" in CSP documentation
The term "external" is misleading for MCP Apps because developers
typically interpret it as "third-party." However, MCP App HTML runs in
a sandboxed iframe with no same-origin server, so *all* origins must be
declared—including where your own bundled JS/CSS is served from. Using
"network" instead avoids this confusion and aligns with the detailed
explanations in `patterns.md` and `spec.types.ts`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:50:06 -06:00
Jonathan Hefner
27196b3b05
Use escaped double quotes in npm scripts for Windows compatibility
Single quotes in `concurrently` commands work on Unix shells but not on
Windows Command Shell (`cmd.exe`), causing the `INPUT` environment
variable to not be set and npm scripts to fail with errors like:

    'cross-env' is not recognized as an internal or external command
    Error: INPUT environment variable is not set

Replace single quotes with escaped double quotes (`\"`) in npm scripts
in all example `package.json` files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 09:05:40 -06:00
Jonathan Hefner
ec0f2174f3
Merge pull request #415 from jonathanhefner/csp-and-cors-example
Add CSP and CORS section to patterns docs
2026-01-30 14:47:37 -06:00
Jonathan Hefner
13b6d06399
Add CSP and CORS section to patterns docs
Adds a new section to the patterns guide explaining how to configure
Content Security Policy and CORS for MCP Apps that make network requests:

- CSP via `_meta.ui.csp` controls browser-side permissions (`connectDomains`,
  `resourceDomains`)
- CORS via `_meta.ui.domain` provides a stable origin for API servers to
  allowlist

Includes a type-checked example showing `computeAppDomainForClaude()` helper
that hashes an MCP server URL to create a stable `*.claudemcpcontent.com`
subdomain. Also adds `@see` links to `McpUiResourceMeta` and `McpUiResourceCsp`
in `registerAppResource` JSDoc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 14:33:57 -06:00
Olivier Chafik
bb4e5c57f3
Cache full PDF bodies from servers without Range support (#411)
* fix(pdf-server): handle HTTP 200 fallback in remote range requests

When a remote server ignores the Range header and returns HTTP 200
with the full body, readPdfRange previously passed the entire file
(potentially 10MB+) through as a single chunk. This bypassed the
512KB limit because:

1. The error check `!response.ok && status !== 206` short-circuits
   on 200 (ok is true), so the full body is read via arrayBuffer()
2. No Content-Range header on a 200 response leaves totalBytes at 0
3. hasMore becomes `offset + fullSize < 0` = false, so the client
   stops after one oversized message

Fix: detect HTTP 200, cache the full body in memory (to avoid
re-downloading on every subsequent chunk request), then slice to the
requested range. The 512KB per-message limit is now enforced for all
remote URLs regardless of Range request support.

* Add session-based PDF caching with timeout cleanup and size limits

- Add dual timeout strategy for cache cleanup:
  - 10s inactivity timeout (resets on each access)
  - 60s max lifetime (absolute timeout from creation)
- Add 50MB max size limit with both Content-Length and actual size checks
- Add unit tests for caching behavior including:
  - Cache on HTTP 200 response (no range support)
  - No cache on HTTP 206 response (range supported)
  - Slice cached data for subsequent range requests
  - Reject PDFs exceeding size limits
- Export getCacheSize() and clearCache() for testing

* refactor(pdf-server): make PDF cache session-local via factory pattern

- Replace module-level global cache with createPdfCache() factory
- Each server instance now gets its own isolated cache
- Export PdfCache interface for type-safe usage
- Update tests to use per-test cache instances
- Add test verifying cache isolation between sessions

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-30 20:24:18 +00:00
Ido Salomon
0278af6a2a
examples: remove arcade (#414) 2026-01-30 22:06:50 +02:00
Jonathan Hefner
5c4f4969b1
Merge pull request #406 from jonathanhefner/extract-getUiCapability-example
Extract `getUiCapability` example to type-checked examples file
2026-01-30 13:52:31 -06:00
Jonathan Hefner
d7ff999d40
Merge pull request #404 from jonathanhefner/basic-server-css-variables
Improve example CSS files to better demonstrate host style integration
2026-01-30 13:52:17 -06:00
Jonathan Hefner
d37a789693
Merge pull request #409 from jonathanhefner/spec-types-api-docs
Improve documentation for CSP and permissions types
2026-01-30 13:51:42 -06:00
Jonathan Hefner
c02eb4d006
Improve documentation for CSP and permissions types
Add detailed JSDoc comments to `McpUiResourceCsp`, `McpUiResourcePermissions`,
and `McpUiResourceMeta` interfaces:

- Document CSP directive mappings for `connectDomains`, `resourceDomains`,
  `frameDomains`, and `baseUriDomains`
- Add usage examples showing typical domain patterns
- Clarify Permission Policy mappings for `camera`, `microphone`, `geolocation`,
  and `clipboardWrite`
- Explain `domain` field's host-dependent behavior with concrete examples
- Document `prefersBorder` semantics including true/false/omitted behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:44:31 -06:00
Jonathan Hefner
c3d91a13ad
Improve example CSS files to better demonstrate host style integration
Update `mcp-app.css`, `mcp-app.module.css`, and Svelte/Vue component
styles across all `basic-server-*` examples (and `integration-server`)
to use CSS variables instead of hardcoded values:

- Remove component-local color variables (`--color-primary`, etc.)
- Add derived spacing variables to `global.css` based on `--spacing-unit`
- Replace hardcoded spacing with `--spacing-xs/sm/md/lg` variables
- Add app-defined accent color variables (`--color-accent`,
  `--color-text-on-accent`) to `global.css` for brand customization
- Use app accent colors for button styling
- Update button hover to use `color-mix()` for theme-adaptive lightening
- Change focus-visible to use `--color-ring-primary` outline

This makes the templates more instructive for users and AI coding agents
building new MCP Apps by showing how to consume host-provided variables
semantically, define app-specific accent colors, and create adaptive
styling that integrates with host themes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 09:32:26 -06:00