Commit graph

109 commits

Author SHA1 Message Date
Jonathan Hefner
d511eab059 Fix broken API documentation links in README
Update all API doc links to use correct paths:
- Add missing /api/ path segment (TypeDoc outputs to docs/api/)
- Fix module names to match actual generated files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 16:35:06 -06:00
Matthew Wang
192d29f2ba
Fix zod" (#42)
Co-authored-by: Matthew Wang <matt8p@Matthews-MacBook-Pro.local>
2025-11-27 22:14:21 +00:00
Jonathan Hefner
16a9e6f034
Add API docs (#29)
* Refactor types.ts to use explicit interfaces with JSDoc

Replace z.infer<typeof Schema> patterns with explicit interface
definitions for all MCP UI types. Add VerifySchemaMatches helper
type to ensure compile-time verification that schemas match their
interfaces.

Add comprehensive JSDoc documentation to all exported types including:
- Clear descriptions of purpose and usage
- @see references to related types and methods
- Code examples where helpful
- @internal markers for implementation details

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add JSDoc documentation and TypeDoc tooling

Add comprehensive JSDoc documentation to:
- AppBridge class and all methods
- App class and all methods
- PostMessageTransport class and callbacks
- React hooks (useApp, useAutoResize)
- React module index

Set up TypeDoc for API documentation generation:
- Add typedoc.json configuration
- Add docs and docs:watch npm scripts
- Add typedoc dev dependency
- Update .gitignore to exclude generated docs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add JSDoc documentation for callback handler setters

Document all notification and request handler setters in AppBridge
and App classes with comprehensive JSDoc comments including:
- Clear descriptions of when handlers are called
- Parameter documentation and types
- Practical code examples with error handling
- Cross-references to related types and methods
- Security considerations where relevant

Also update types.ts to document optional isError fields in result
types and make McpUiInitializedNotification params optional.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add JSDoc for new App methods and fix result type compatibility

Document new public APIs introduced in merge commit 74a7b1f:
- getHostCapabilities() - getter for host capabilities after connect
- getHostVersion() - getter for host implementation info after connect
- oncalltool setter - convenience handler for tool call requests
- onlisttools setter - convenience handler for tool listing requests
- RESOURCE_URI_META_KEY constant - metadata key for resource URIs

Add index signatures to McpUiMessageResult and McpUiOpenLinkResult
for MCP SDK Protocol class compatibility, matching the existing
pattern in McpUiInitializeResult.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add comprehensive JSDoc documentation across library

- Document App methods with detailed descriptions and examples
- Add JSDoc to AppBridge methods including getters and setters
- Document PostMessageTransport callback properties
- Improve React hook documentation (useApp, useAutoResize)
- Add documentation for types.ts result and notification types
- Add @see cross-references between related methods
- Fix code examples to use correct syntax and patterns
- Clarify error handling behavior in method descriptions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Fix TypeDoc cross-module link resolution warnings

Replace unqualified @link references with module-qualified syntax to fix
"Failed to resolve link" warnings during docs generation. TypeDoc cannot
resolve links like {@link App.sendOpenLink} without imports, so use the
module-qualified format {@link app.App.sendOpenLink} instead.

Changes:
- types.ts: Fix 9 cross-module links to App and AppBridge methods
- app-bridge.ts: Fix 2 references to App.sendSizeChange
- message-transport.ts: Fix 2 references to App.connect and AppBridge.connect

This eliminates all "Failed to resolve link" warnings without requiring
circular imports or removing documentation cross-references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Remove TypeDoc links to undocumented external types

Remove @link references to types that are either:
- Not exported (AppOptions) - internal implementation detail
- From external packages (@modelcontextprotocol/sdk) - not included in docs

This eliminates warnings about resolved but undocumented types. The type
information is still available through TypeScript's type system and parameter
documentation, but without broken links in the generated documentation.

Removed links to:
- AppOptions (internal type)
- Implementation, CallToolRequest, CallToolResult (MCP SDK types)
- ListToolsRequest, LoggingMessageNotification (MCP SDK types)

Reduces warnings from 12 to 4 (remaining are about missing example files).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Bump @modelcontextprotocol/sdk to ^1.23.0

Update SDK dependency to fix CI build failures caused by version
mismatch. CI was installing 1.23.0 (latest compatible with ^1.22.0)
while local builds used 1.22.0.

Note: package-lock.json is gitignored, which prevents reproducible
builds. Consider committing it to ensure CI uses the same versions
as local development.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Fix Zod type compatibility with @modelcontextprotocol/sdk

The SDK imports Zod from 'zod/v4' while this package imported from
'zod'. Although both resolve to the same version (3.25.x), TypeScript
sees them as separate modules with incompatible type declarations.

This caused type errors when:
- Extending SDK schemas like RequestSchema.extend()
- Passing SDK schemas to setRequestHandler/setNotificationHandler
- Using ZodObject/ZodLiteral types from different import paths

Changes:
- Import zod from 'zod/v4' to match SDK import path
- Update z.record() calls to use Zod v4 signature (requires both
  key and value schemas)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add GitHub Actions workflow to deploy docs to gh-pages

Adds a workflow with manual trigger (workflow_dispatch) that generates
TypeDoc documentation and publishes it to the gh-pages branch using
peaceiris/actions-gh-pages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Add docs index.html redirect to API documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Revise README for clarity and audience focus

- Add API documentation badge linking to GitHub Pages
- Reorganize content around two audiences: App Developers and Host Developers
- Convert relative links to absolute GitHub URLs for better portability
- Simplify installation and examples sections
- Add Resources section with links to docs, spec, and discussion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* Update src/app-bridge.ts

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Olivier Chafik <ochafik@anthropic.com>
2025-11-27 22:09:22 +00:00
Jonathan Hefner
e6b1e640ab
Update package.json homepage and description (#30)
Replace placeholder values with proper metadata:
- Set homepage to GitHub repository URL
- Add descriptive package description

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-27 17:11:42 +00:00
Anton Pidkuiko
1fa95a3b83
Merge pull request #39 from modelcontextprotocol/fix/csp-camelcase-naming
fix: use camelCase for CSP domain fields in specification
2025-11-27 16:51:21 +00:00
Anton Pidkuiko MacBook
a446e80b5f
fix: use camelCase for CSP domain fields in specification
Change connect_domains and resource_domains to connectDomains and
resourceDomains for consistency with the rest of the specification
which uses camelCase naming convention.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 16:48:07 +00:00
Liad Yosef
34316a2180
minor: renumber mermaid diagrams (#36) 2025-11-27 03:14:26 +02:00
Olivier Chafik
8ac79a9731
lib: add capabilities & version getters (#24)
* add App{,Bridge}.get{App,Host}{Version,Capabilities}()

* Add App.{oncalltool,onlisttools}
2025-11-25 04:05:33 +00:00
Guangya Liu
1311fe8479
Updated ext-apps readme (#22) 2025-11-25 03:19:30 +00:00
Olivier Chafik
3e5ec1ae0b
build: use workspaces for example subfolders (#23)
* use npm workspaces

* Update package.json
2025-11-25 03:14:14 +00:00
Olivier Chafik
b4c6019d47
example-host: fix sandboxing setup (#21)
* example-host: prevent accidental non-iframing of sandbox (or iframing in prod)

* fix sandbox isolation + "test in prod"

* Update package.json

* Update sandbox.ts
2025-11-25 02:45:55 +00:00
Olivier Chafik
ca09c415bf
setup ci & presubmit (#20)
* ci & presubmit

* Update ci.yml
2025-11-25 02:40:48 +00:00
Olivier Chafik
3df49c38dc
fix iframe resizing (#19)
* reshuffle build / start scripts

* fix resize logic

* prettier

* extract RESOURCE_URI_META_KEY constant

* Update message-transport.ts

* Update package.json
2025-11-25 02:39:33 +00:00
Olivier Chafik
0e62ceca92
Merge pull request #5 from modelcontextprotocol/sep-fixes
Various SEP fixes
2025-11-25 02:24:18 +00:00
Olivier Chafik
1fc5e3439e
Merge pull request #18 from modelcontextprotocol/fix/resources-requests
Add ReadResourceRequestSchema forwarding for resources capability
2025-11-25 00:53:45 +00:00
Olivier Chafik
807c9a1df5
Merge pull request #17 from modelcontextprotocol/fix/optional-params-initialized-notification
Make params optional in McpUiInitializedNotificationSchema
2025-11-25 00:53:16 +00:00
Anton Pidkuiko MacBook
a5e47b2e13
Add ReadResourceRequestSchema forwarding for resources capability
The resources capability was forwarding ListResourcesRequestSchema and
ListResourceTemplatesRequestSchema, but missing ReadResourceRequestSchema.
This meant clients could list resources but not actually read them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 22:58:31 +00:00
Anton Pidkuiko MacBook
8b0c34cda9
Make params optional in McpUiInitializedNotificationSchema
Notifications sent without params (e.g., `{ method: "ui/notifications/initialized" }`)
were being rejected by the schema validation because params was required.
This makes params optional so notifications without explicit params are accepted.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 22:48:24 +00:00
Olivier Chafik
123b74090c
Merge pull request #15 from modelcontextprotocol/ochafik/simple-host-example
Add simple host example
2025-11-24 17:27:38 +00:00
Olivier Chafik
c800b34635
format 2025-11-24 17:27:06 +00:00
Olivier Chafik
fb6e772942
Update README.md 2025-11-24 17:15:21 +00:00
Olivier Chafik
f2fd0e596e
Update README.md 2025-11-24 17:12:19 +00:00
Olivier Chafik
b77f68dac7
Update README.md 2025-11-24 16:59:45 +00:00
Olivier Chafik
e4e7edf284
reshuffle, use -vanilla consistently 2025-11-24 16:59:41 +00:00
Olivier Chafik
24dd9691de
fix mcp sdk refs 2025-11-24 16:53:55 +00:00
Olivier Chafik
eab25b6821
serve.py -> server.ts 2025-11-24 16:52:05 +00:00
Olivier Chafik
3c438c29c4
Update example-host.ts 2025-11-24 16:26:57 +00:00
Olivier Chafik
1a4c0180eb
nit: rm unused type 2025-11-24 16:21:22 +00:00
Olivier Chafik
54a48a4a13
rename: AppRenderer 2025-11-24 16:20:45 +00:00
Olivier Chafik
d32e43aaf5
tweaks 2025-11-24 16:14:17 +00:00
Olivier Chafik
bc6458d3fb
tweaks 2025-11-24 16:12:55 +00:00
Olivier Chafik
14740aacea
fix build 2025-11-24 16:07:10 +00:00
Olivier Chafik
b738294458
fix build 2025-11-24 16:03:24 +00:00
Olivier Chafik
85816d80ce
Merge branch 'main' into ochafik/simple-host-example 2025-11-24 16:01:24 +00:00
Olivier Chafik
1f3bc52142
add simple-host example 2025-11-24 16:01:10 +00:00
Olivier Chafik
39d84a9260
Merge pull request #13 from modelcontextprotocol/ochafik/easier-notification-handlers
sdk: add notification handlers (App.ontoolinput, .ontoolresult, AppBridge.onsizechange...)
2025-11-24 15:45:29 +00:00
Jonathan Hefner
120a673904 Fix UIResource \_meta type to match actual usage pattern
The UIResource interface incorrectly specified `_meta?: UIResourceMeta`
when it should be `_meta?: { ui?: UIResourceMeta }` to match the
resources/read response format and all usage examples throughout the
document.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 09:06:02 -06:00
Olivier Chafik
ac3863092a
setup notification handlers in App & AppBridge 2025-11-24 14:59:58 +00:00
Jonathan Hefner
9aa129fe34 Fix indentation of domain and prefersBorder in UiResourceMeta example
The domain and prefersBorder properties are now properly indented to be
at the same hierarchical level as csp within the ui object.

Addresses PR comment:
https://github.com/modelcontextprotocol/ext-apps/pull/5#discussion_r2553064940

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:58:48 -06:00
Jonathan Hefner
ae9d87f530 Convert UIResource documentation to TypeDoc comments
Replace inline comments with comprehensive TypeDoc comments that explain
the purpose and usage of each property. Add examples and clarify
constraints (MUST/SHOULD) for better developer understanding.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:58:48 -06:00
Jonathan Hefner
a8107a6733 Convert UiResourceMeta documentation to TypeDoc comments
Move metadata field documentation from separate prose section into
TypeDoc comments on the UiResourceMeta interface properties. This
consolidates the documentation and eliminates duplication while making
it more maintainable and IDE-friendly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:58:45 -06:00
Jonathan Hefner
0d65458552 Improve CSP example formatting and clarity in apps specification
Change CSP code block from yaml to typescript fence, add context showing
where csp variable originates (resource.\_meta?.ui?.csp), rename
cspHeader to cspValue for accuracy, and remove Content-Security-Policy:
prefix since the variable holds just the policy value, not a complete
HTTP header.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:57:05 -06:00
Jonathan Hefner
cc08467772 Complete JSON-RPC message examples in Data Passing section
The tool input and tool result examples now show fully formed JSON-RPC
messages with all required fields (jsonrpc, id/method, result/params) to
better demonstrate the protocol format. Also fixes MDX parsing error in
Client\<>Server heading by escaping angle brackets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:57:05 -06:00
Jonathan Hefner
1eaf7377ca Fix indentation in Mermaid sequence diagrams
Corrects the indentation of nested block structures (alt, opt, par,
loop) in all four Mermaid sequence diagrams. Content inside nested
blocks is now properly indented relative to the block keywords, making
the hierarchical structure clearer and more readable.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:57:01 -06:00
Jonathan Hefner
4aa2eb8dbe Remove unnecessary quotes from TypeScript property names
Unquote ui, csp, domain, and prefersBorder properties in the
resources/read response TypeScript example to follow standard TypeScript
syntax conventions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:53:00 -06:00
Jonathan Hefner
06c37b045b Convert notification examples from JSON to TypeScript format
Changes code blocks for notification examples to use `typescript` fence
instead of `json`. This properly represents TypeScript types (like
Record<string, unknown>, CallToolResult, Partial<HostContext>) without
quotes, matching the format used elsewhere in the specification.

Affected notifications:

- ui/notifications/tool-input
- ui/notifications/tool-input-partial
- ui/notifications/tool-result
- ui/tool-cancelled
- ui/resource-teardown
- ui/size-change
- ui/host-context-change
- ui/notifications/sandbox-ready
- ui/notifications/sandbox-resource-ready

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:53:00 -06:00
Jonathan Hefner
31dccb95f4 Fix resource list change notification name format
Corrected `resources/notifications/list_changed` to
`notifications/resources/list_changed` on line 208 to follow standard
MCP notification naming pattern (`notifications/{category}/{event}`).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:53:00 -06:00
Jonathan Hefner
86d72db632 Standardize notification naming and fix formatting in MCP Apps spec
Updates the MCP Apps specification to consistently use the
`ui/notifications/` prefix for all notification methods (e.g.,
`ui/notifications/sandbox-ready`, `ui/notifications/tool-result`). Also
removes trailing whitespace, fixes tab/space inconsistencies, improves
code formatting with proper backticks, and clarifies terminology
throughout the document.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 08:53:00 -06:00
Olivier Chafik
535dae6a73
Merge pull request #11 from gulbaki/patch-1
Fix broken link in README
2025-11-24 14:37:30 +00:00
Olivier Chafik
5804a41d5c
Merge branch 'main' into patch-1 2025-11-24 14:36:59 +00:00