-
Notifications
You must be signed in to change notification settings - Fork 61
Add {AGENTS,CLAUDE}.md for AI assistant guidance
#218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ochafik
merged 1 commit into
modelcontextprotocol:main
from
jonathanhefner:add-claude-md
Jan 12, 2026
+88
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # MCP Apps SDK | ||
|
|
||
| ## Project Overview | ||
|
|
||
| MCP Apps SDK (`@modelcontextprotocol/ext-apps`) enables MCP servers to display interactive UIs in conversational clients. | ||
|
|
||
| Key abstractions: | ||
|
|
||
| - **Guest** - UI running in an iframe, uses `App` class with `PostMessageTransport` to communicate with host | ||
| - **Host** - Chat client embedding the iframe, uses `AppBridge` class to proxy MCP requests | ||
| - **Server** - MCP server that registers tools/resources with UI metadata | ||
|
|
||
| Specification (draft): `specification/draft/apps.mdx` | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Build the SDK only (generates schemas + bundles, does not build examples) | ||
| npm run build | ||
|
|
||
| # Build everything (SDK + all examples) | ||
| npm run build:all | ||
|
|
||
| # Type check + build a single example | ||
| npm run --workspace examples/<example-name> build | ||
|
|
||
| # Run all examples (starts server at http://localhost:8080) | ||
| npm start | ||
|
|
||
| # Run E2E tests (primary testing mechanism - starts examples server automatically) | ||
| npm run test:e2e | ||
|
|
||
| # Run unit tests (E2E tests have broader coverage; unit tests cover specific modules) | ||
| npm test | ||
|
|
||
| # Check JSDoc comment syntax and `{@link}` references | ||
| npm exec typedoc -- --treatValidationWarningsAsErrors --emit none | ||
|
|
||
| # Regenerate package-lock.json (especially on setups w/ custom npm registry) | ||
| rm -fR package-lock.json node_modules && \ | ||
| docker run --rm -it --platform linux/amd64 -v $PWD:/src:rw -w /src node:latest npm i && \ | ||
| rm -fR node_modules && \ | ||
| npm i --cache=~/.npm-mcp-apps --registry=https://registry.npmjs.org/ | ||
| ``` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added! |
||
|
|
||
| ## Architecture | ||
|
|
||
| ### SDK Entry Points | ||
|
|
||
| - `@modelcontextprotocol/ext-apps` - Main SDK for Apps (`App` class, `PostMessageTransport`) | ||
| - `@modelcontextprotocol/ext-apps/react` - React hooks (`useApp`, `useHostStyleVariables`, etc.) | ||
| - `@modelcontextprotocol/ext-apps/app-bridge` - SDK for hosts (`AppBridge` class) | ||
| - `@modelcontextprotocol/ext-apps/server` - Server helpers (`registerAppTool`, `registerAppResource`) | ||
|
|
||
| ### Key Source Files | ||
|
|
||
| - `src/app.ts` - `App` class extends MCP Protocol, handles guest initialization, tool calls, messaging | ||
| - `src/app-bridge.ts` - `AppBridge` class for hosts, proxies MCP requests, sends tool input/results to guests | ||
| - `src/server/index.ts` - Helpers for MCP servers to register tools/resources with UI metadata | ||
| - `src/types.ts` - Protocol types re-exported from `spec.types.ts` and Zod schemas from `generated/schema.ts` (auto-generated during build) | ||
| - `src/message-transport.ts` - `PostMessageTransport` for iframe communication | ||
| - `src/react/` - React hooks: `useApp`, `useHostStyles`, `useAutoResize`, `useDocumentTheme` | ||
|
|
||
| ### Protocol Flow | ||
|
|
||
| ``` | ||
| Guest UI (App) <--PostMessageTransport--> Host (AppBridge) <--MCP Client--> MCP Server | ||
| ``` | ||
|
|
||
| 1. Host creates iframe with Guest UI HTML | ||
| 2. Guest UI creates `App` instance and calls `connect()` with `PostMessageTransport` | ||
| 3. App sends `ui/initialize` request, receives host capabilities and context | ||
| 4. Host sends `sendToolInput()` with tool arguments after initialization | ||
| 5. Guest UI can call server tools via `app.callServerTool()` or send messages via `app.sendMessage()` | ||
| 6. Host sends `sendToolResult()` when tool execution completes | ||
| 7. Host calls `teardownResource()` before unmounting iframe | ||
|
|
||
| ## Examples | ||
|
|
||
| Uses npm workspaces. Examples in `examples/` are separate packages: | ||
|
|
||
| - `basic-server-*` - Starter templates (vanillajs, react, vue, svelte, preact, solid). Use these as the basis for new examples. | ||
| - `basic-host` - Reference host implementation | ||
| - Other examples showcase specific features (charts, 3D, video, etc.) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd mention there's also build:all to check breakages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the next line 😃: