Repository: MCP-UI-Org/mcp-ui Branch: main Commit: af881f9eff2c Files: 165 Total size: 833.0 KB Directory structure: gitextract_f5vcxr1e/ ├── .github/ │ ├── CONTRIBUTING.md │ ├── copilot-instructions.md │ └── workflows/ │ ├── ci.yml │ └── deploy-docs.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── .releaserc.json ├── .ruby-version ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── docs/ │ ├── README.md │ ├── package.json │ └── src/ │ ├── .vitepress/ │ │ ├── config.ts │ │ └── theme/ │ │ ├── custom.css │ │ └── index.ts │ ├── about.md │ ├── guide/ │ │ ├── apps-sdk.md │ │ ├── client/ │ │ │ ├── app-renderer.md │ │ │ ├── overview.md │ │ │ └── walkthrough.md │ │ ├── embeddable-ui.md │ │ ├── getting-started.md │ │ ├── introduction.md │ │ ├── mcp-apps.md │ │ ├── protocol-details.md │ │ ├── server/ │ │ │ ├── python/ │ │ │ │ ├── overview.md │ │ │ │ ├── usage-examples.md │ │ │ │ └── walkthrough.md │ │ │ ├── ruby/ │ │ │ │ ├── overview.md │ │ │ │ ├── usage-examples.md │ │ │ │ └── walkthrough.md │ │ │ └── typescript/ │ │ │ ├── overview.md │ │ │ ├── usage-examples.md │ │ │ └── walkthrough.md │ │ └── supported-hosts.md │ ├── index.md │ └── team.md ├── eslint.config.mjs ├── examples/ │ ├── external-url-demo/ │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.css │ │ │ ├── App.tsx │ │ │ ├── index.css │ │ │ └── main.tsx │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ ├── tsconfig.node.json │ │ └── vite.config.ts │ ├── mcp-apps-demo/ │ │ ├── package.json │ │ ├── src/ │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── python-server-demo/ │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── python_server_demo.py │ ├── ruby-server-demo/ │ │ ├── Gemfile │ │ ├── README.md │ │ └── server.rb │ ├── server/ │ │ ├── .react-router/ │ │ │ └── types/ │ │ │ ├── +future.ts │ │ │ ├── +routes.ts │ │ │ ├── +server-build.d.ts │ │ │ └── app/ │ │ │ ├── +types/ │ │ │ │ └── root.ts │ │ │ └── routes/ │ │ │ └── +types/ │ │ │ ├── home.ts │ │ │ ├── task.ts │ │ │ └── user.ts │ │ ├── README.md │ │ ├── app/ │ │ │ ├── app.css │ │ │ ├── entry.server.tsx │ │ │ ├── graph/ │ │ │ │ └── graph.tsx │ │ │ ├── images.d.ts │ │ │ ├── root.tsx │ │ │ ├── routes/ │ │ │ │ ├── home.tsx │ │ │ │ ├── task.tsx │ │ │ │ └── user.tsx │ │ │ ├── routes.ts │ │ │ ├── user/ │ │ │ │ └── user.tsx │ │ │ └── utils/ │ │ │ └── messageUtils.ts │ │ ├── biome.json │ │ ├── package.json │ │ ├── pnpm-workspace.yaml │ │ ├── react-router.config.ts │ │ ├── src/ │ │ │ └── index.ts │ │ ├── tsconfig.cloudflare.json │ │ ├── tsconfig.json │ │ ├── tsconfig.node.json │ │ ├── vite.config.ts │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ └── typescript-server-demo/ │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── index.ts │ └── tsconfig.json ├── lefthook.yml ├── package.json ├── pnpm-workspace.yaml ├── sdks/ │ ├── python/ │ │ └── server/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── release.config.js │ │ ├── src/ │ │ │ └── mcp_ui_server/ │ │ │ ├── __init__.py │ │ │ ├── core.py │ │ │ ├── exceptions.py │ │ │ ├── types.py │ │ │ └── utils.py │ │ └── tests/ │ │ ├── __init__.py │ │ ├── test_create_ui_resource.py │ │ ├── test_metadata.py │ │ └── test_ui_action_results.py │ ├── ruby/ │ │ ├── .rspec │ │ ├── .rubocop.yml │ │ ├── CHANGELOG.md │ │ ├── Gemfile │ │ ├── README.md │ │ ├── Rakefile │ │ ├── lib/ │ │ │ ├── mcp_ui_server/ │ │ │ │ └── version.rb │ │ │ └── mcp_ui_server.rb │ │ ├── mcp_ui_server.gemspec │ │ ├── release.config.js │ │ └── spec/ │ │ ├── mcp_ui_server_spec.rb │ │ └── spec_helper.rb │ └── typescript/ │ ├── client/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── scripts/ │ │ │ └── proxy/ │ │ │ └── index.html │ │ ├── src/ │ │ │ ├── __tests__/ │ │ │ │ └── capabilities.test.ts │ │ │ ├── capabilities.ts │ │ │ ├── components/ │ │ │ │ ├── AppFrame.tsx │ │ │ │ ├── AppRenderer.tsx │ │ │ │ └── __tests__/ │ │ │ │ ├── AppFrame.test.tsx │ │ │ │ ├── AppRenderer.test.tsx │ │ │ │ └── ProxyScript.test.ts │ │ │ ├── index.ts │ │ │ ├── test-setup.ts │ │ │ ├── types.ts │ │ │ └── utils/ │ │ │ ├── __tests__/ │ │ │ │ ├── isUIResource.test.ts │ │ │ │ └── metadataUtils.test.ts │ │ │ ├── app-host-utils.ts │ │ │ ├── isUIResource.ts │ │ │ └── metadataUtils.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.test.json │ │ ├── vite.config.ts │ │ └── vitest.config.ts │ ├── server/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── __tests__/ │ │ │ │ ├── index.test.ts │ │ │ │ ├── test-utils.ts │ │ │ │ └── utils.test.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── tsconfig.json │ │ ├── vite.config.ts │ │ └── vitest.config.ts │ └── shared/ │ ├── package.json │ ├── src/ │ │ └── index.ts │ ├── tsconfig.json │ └── vite.config.ts ├── tsconfig.base.json ├── vitest.config.ts └── vitest.setup.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Contributing to MCP-UI First of all, thank you for your interest in contributing to MCP-UI! We appreciate the time and effort you're willing to invest in improving the project. This document provides guidelines and information to make the contribution process as smooth as possible. ## Table of Contents - [Getting Started](#getting-started) - [Local Development](#local-development) - [Prerequisites](#prerequisites) - [Setting Up Your Development Environment](#setting-up-your-development-environment) - [Running the Project Locally](#running-the-project-locally) - [Testing](#testing) - [Code Formatting](#code-formatting) - [Development Workflow](#development-workflow) - [Project Structure](#project-structure) - [How to Contribute](#how-to-contribute) - [Reporting Bugs](#reporting-bugs) - [Suggesting Enhancements](#suggesting-enhancements) - [Submitting Pull Requests](#submitting-pull-requests) - [Style Guidelines](#style-guidelines) - [Code Style](#code-style) - [Commit Messages](#commit-messages) - [Additional Resources](#additional-resources) ## Getting Started 1. Fork the repository and clone it to your local machine. 2. Set up the development environment. 3. Explore the codebase, run tests, and verify that everything works as expected. ## Local Development ### Prerequisites Before you start working on MCP-UI, make sure you have the following installed: - [Node.js](https://nodejs.org/) (version 18 or higher recommended) - [pnpm](https://pnpm.io/) (version 8.15.7 or higher) - Git ### Setting Up Your Development Environment 1. Clone your forked repository: ```bash git clone https://github.com/your-username/mcp-ui.git cd mcp-ui ``` 2. Install dependencies: ```bash pnpm install ``` 3. Set up environment variables: - Create a `.env.local` file in the root directory - Add any necessary environment variables (ask project maintainers if you need access to specific API keys) ### Running the Project Locally To start the development server: ```bash pnpm vercel dev ``` This will start the Next.js development server, typically at http://localhost:3000. For running with the MCP Inspector (useful for debugging MCP endpoints): ```bash pnpm run inspector ``` ### Testing To run tests: ```bash pnpm test ``` MCP-UI uses Vitest as the testing framework. When adding new features, please include appropriate tests. ### Code Formatting MCP-UI uses Prettier for code formatting and lint-staged to ensure code is properly formatted before committing. Pre-commit hooks are set up with Husky to run these checks automatically. To manually format your code: ```bash pnpm prettier --write . ``` ### Development Workflow 1. Create a new branch for your feature/bugfix 2. Make your changes 3. Add tests for your changes when applicable 4. Run the tests to ensure they pass 5. Commit your changes following the commit message guidelines 6. Push your branch and open a pull request ### Project Structure - `api/`: Contains the server-side code and MCP implementation - `tools/`: MCP tools implementation - `utils/`: Utility functions for the API - `app/`: Next.js app directory with React components - `pages/`: Additional Next.js pages - `public/`: Static assets - `shared/`: Shared utilities used across the codebase ## How to Contribute ### Reporting Bugs If you encounter a bug or issue while using MCP-UI, please open a new issue on the [GitHub Issues](https://github.com/idosal/mcp-ui/issues) page. Provide a clear and concise description of the problem, steps to reproduce it, and any relevant error messages or logs. ### Suggesting Enhancements We welcome ideas for improvements and new features. To suggest an enhancement, open a new issue on the [GitHub Issues](https://github.com/idosal/mcp-ui/issues) page. Describe the enhancement in detail, explain the use case, and outline the benefits it would bring to the project. ### Submitting Pull Requests 1. Create a new branch for your feature or bugfix. Use a descriptive name like `feature/your-feature-name` or `fix/your-bugfix-name`. 2. Make your changes, following the [Style Guidelines](#style-guidelines) below. 3. Test your changes and ensure that they don't introduce new issues or break existing functionality. 4. Commit your changes, following the [commit message guidelines](#commit-messages). 5. Push your branch to your fork on GitHub. 6. Open a new pull request against the `main` branch of the `mcp-ui` repository. Include a clear and concise description of your changes, referencing any related issues. ## Style Guidelines ### Code Style MCP-UI uses [ESLint](https://eslint.org/) as its code style guide. Please ensure that your code follows these guidelines. ### Commit Messages Write clear and concise commit messages that briefly describe the changes made in each commit. Use the imperative mood and start with a capitalized verb, e.g., "Add new feature" or "Fix bug in function". ## Additional Resources - [GitHub Help](https://help.github.com/) - [GitHub Pull Request Documentation](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests) - [ESLint Style Guide](https://eslint.org/) Thank you once again for your interest in contributing to MCP UI. We look forward to collaborating with you and creating an even better project together! ================================================ FILE: .github/copilot-instructions.md ================================================ # MCP-UI Development Instructions **ALWAYS follow these instructions first and fallback to additional search and context gathering only if the information here is incomplete or found to be in error.** MCP-UI is a Model Context Protocol UI SDK monorepo providing TypeScript and Ruby SDKs for building MCP enabled applications with interactive UI components. The repository includes client SDKs, server SDKs, documentation, and examples. ## Working Effectively ### Bootstrap and Build (CRITICAL - Set 60+ minute timeouts) - Install Node.js 22.x and pnpm 9+: `npm install -g pnpm` - Install Ruby 3.x and bundler: `sudo apt-get install -y ruby ruby-dev build-essential && sudo gem install bundler` - Clone repository: `git clone https://github.com/idosal/mcp-ui.git && cd mcp-ui` - Install dependencies: `pnpm install` -- takes ~60 seconds. NEVER CANCEL. - Build all packages: `pnpm build` -- takes ~15 seconds. NEVER CANCEL. Set timeout to 120+ seconds. - Build documentation: `pnpm docs:build` -- takes ~17 seconds. NEVER CANCEL. Set timeout to 180+ seconds. ### Testing (CRITICAL - Set 30+ minute timeouts) - Run TypeScript tests: `pnpm test:ts` -- takes ~6 seconds. NEVER CANCEL. Set timeout to 300+ seconds. - Run Ruby tests: `pnpm test:ruby` -- takes ~1 second. NEVER CANCEL. Set timeout to 300+ seconds. - Run all tests: `pnpm test` -- combines TypeScript and Ruby tests. NEVER CANCEL. Set timeout to 300+ seconds. - Run with coverage: `pnpm coverage` -- NEVER CANCEL. Set timeout to 600+ seconds. ### Code Quality (Always run before committing) - Lint code: `pnpm lint` -- takes ~2.4 seconds. Uses ESLint with TypeScript parser. - Fix linting issues: `pnpm lint:fix` - Format code: `pnpm format` -- Uses Prettier with single quotes, trailing commas, 100 char width. ### Development Workflow - Run TypeScript SDKs in development: `pnpm dev` -- starts all TypeScript package dev servers in parallel. - Run docs in development: `pnpm docs:dev` -- starts VitePress dev server. - Preview builds: `pnpm preview` -- preview built packages. ## Validation (CRITICAL - Always perform these after changes) ### Mandatory End-to-End Validation Scenarios 1. **Always build and test after making changes:** Run `pnpm build && pnpm test` to ensure nothing is broken. 2. **Validate examples work:** Test working examples by running: - `cd examples/remote-dom-demo && npm run build` -- takes ~1 second. Always works. - `cd examples/wc-demo && npm run build` -- takes ~1 second. Always works. - NOTE: `typescript-server-demo` may have import issues and should be tested separately after SDK changes. 3. **Test UI components:** When changing client components, manually verify React rendering works by running example applications. 4. **Validate SDK functionality:** When changing server SDKs, test resource creation with both TypeScript and Ruby implementations. 5. **Documentation validation:** When updating docs, run `pnpm docs:build` and verify no broken links or build errors. ### Ruby SDK Specific Validation - Ruby gems must be installed with `sudo bundle install` in `sdks/ruby/` directory - Run Ruby linting: `cd sdks/ruby && sudo bundle exec rubocop` - Ruby tests validate resource creation: `cd sdks/ruby && sudo bundle exec rake spec` ## Project Structure ### Key Directories - `sdks/typescript/` - TypeScript SDKs (client, server, shared) - `client/` - React components for rendering MCP-UI resources - `server/` - Utilities for creating UI resources on MCP servers - `shared/` - Common types and utilities - `sdks/ruby/` - Ruby SDK (`mcp_ui_server` gem) - `examples/` - Demo applications showcasing SDK usage - `remote-dom-demo/` - Interactive UI script testing - `typescript-server-demo/` - Complete TypeScript server example - `ruby-server-demo/` - Complete Ruby server example - `docs/` - VitePress documentation site ### Critical Files - `package.json` - Root monorepo configuration with pnpm workspaces - `pnpm-workspace.yaml` - Workspace configuration for TypeScript packages and examples - `.github/workflows/ci.yml` - CI pipeline with build, test, and release steps - `vitest.config.ts` - Test configuration for TypeScript packages - `tsconfig.base.json` - Base TypeScript configuration ## Build System Details ### Package Management - Uses pnpm workspaces for monorepo management - TypeScript packages use Vite for building with dual ESM/CJS output - Ruby uses standard gem building with bundler ### Dependencies and Versions - Node.js 22.x (required for TypeScript SDKs) - pnpm 9+ (required for workspace management) - Ruby 3.x (required for Ruby SDK) - React 18+ (peer dependency for client SDK) ### Build Outputs - TypeScript client: Builds to `dist/` with ESM, CJS, and Web Component builds - TypeScript server: Builds to `dist/` with ESM and CJS formats - Ruby gem: Standard gem structure in `lib/` - Documentation: Static site built to `docs/src/.vitepress/dist/` ## Common Development Tasks ### Adding New Features 1. Determine if change affects TypeScript SDKs, Ruby SDK, or both 2. Make changes following existing patterns 3. Add appropriate tests (Vitest for TypeScript, RSpec for Ruby) 4. Update documentation if needed 5. Run full validation workflow: `pnpm build && pnpm test && pnpm lint` ### Working with Examples - Examples use workspace dependencies and build independently - External URL demo shows partial externalUrl content type functionality - Remote DOM demo shows partial remote-dom content type functionality - The Server demo shows a full MCP server implementation with Cloudflare - The Ruby and Typescript server demos show basic MCP server implementations - WC-demo showcases the web components client implementation - Always test example builds after making SDK changes ### Documentation Updates - Documentation uses VitePress with enhanced styling - Edit files in `docs/src/` directory - Test changes with `pnpm docs:dev` before building - Always build docs to check for errors: `pnpm docs:build` ## Troubleshooting ### Common Issues - **TypeScript version warnings:** Current setup uses TypeScript 5.8.3 with ESLint plugins that support <5.4.0. This is expected and working. - **Ruby permission errors:** Use `sudo bundle install` and `sudo bundle exec` for Ruby commands in CI environment. - **Build failures:** Always run `pnpm install` first, then check individual package builds. - **Test failures:** Check if all dependencies are installed and built before running tests. ### CI/CD Pipeline - CI runs on Node.js 22.x with pnpm 10 - Separate jobs for TypeScript and Ruby testing - Path filtering prevents unnecessary builds - Semantic release handles versioning and publishing ### Performance Notes - TypeScript builds are fast (~15 seconds total) - Ruby tests run very quickly (~1 second) - Documentation builds may take longer (~17 seconds) - Full CI pipeline completes in under 5 minutes ## CRITICAL REMINDERS - **NEVER CANCEL builds or long-running commands** - Always set appropriate timeouts - **Always validate changes** with complete build and test cycle - **Test examples** after SDK changes to ensure compatibility - **Run linting and formatting** before committing changes - **Update documentation** when adding or changing features - **Use workspace commands** from root directory for consistency ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: - main - alpha pull_request: branches: - main - alpha release: types: [published] jobs: filter_changed_paths: runs-on: ubuntu-latest outputs: ts_client_files: ${{ steps.filter.outputs.ts_client_files }} ts_server_files: ${{ steps.filter.outputs.ts_server_files }} ruby_sdk_files: ${{ steps.filter.outputs.ruby_sdk_files }} python_sdk_files: ${{ steps.filter.outputs.python_sdk_files }} example_files: ${{ steps.filter.outputs.example_files }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: dorny/paths-filter@v2 id: filter with: base: ${{ github.event_name == 'push' && github.event.before || github.base_ref }} filters: | ts_client_files: - 'sdks/typescript/client/**' ts_server_files: - 'sdks/typescript/server/**' ruby_sdk_files: - 'sdks/ruby/**' python_sdk_files: - 'sdks/python/**' example_files: - 'examples/**' js_build_and_test: needs: filter_changed_paths if: needs.filter_changed_paths.outputs.ts_client_files == 'true' || needs.filter_changed_paths.outputs.ts_server_files == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup pnpm uses: pnpm/action-setup@v2 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22.x cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Lint run: pnpm lint - name: Test run: pnpm test:ts - name: Build run: pnpm build ruby_sdk_test: needs: filter_changed_paths if: needs.filter_changed_paths.outputs.ruby_sdk_files == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup pnpm uses: pnpm/action-setup@v2 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22.x cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' bundler: latest bundler-cache: true working-directory: 'sdks/ruby' - name: Lint run: bundle exec rubocop working-directory: 'sdks/ruby' - name: Run tests run: pnpm test:ruby python_sdk_test: needs: filter_changed_paths if: needs.filter_changed_paths.outputs.python_sdk_files == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Set up uv uses: astral-sh/setup-uv@v3 with: enable-cache: true - name: Install dependencies run: uv sync --dev working-directory: sdks/python/server - name: Lint with ruff run: uv run ruff check working-directory: sdks/python/server - name: Type check with pyright run: uv run pyright working-directory: sdks/python/server - name: Run tests run: uv run pytest working-directory: sdks/python/server - name: Build package run: uv build working-directory: sdks/python/server release_ts_client: needs: [js_build_and_test, filter_changed_paths] if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha') && needs.filter_changed_paths.outputs.ts_client_files == 'true' runs-on: ubuntu-latest permissions: contents: write pull-requests: write # to be able to comment on released pull requests issues: write id-token: write steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - name: Fetch all tags run: git fetch --tags --force - name: Setup pnpm uses: pnpm/action-setup@v2 with: { version: 10 } - name: Setup Node.js uses: actions/setup-node@v4 with: { node-version: 22.x, cache: 'pnpm' } - name: Install dependencies run: pnpm install --frozen-lockfile - name: Release working-directory: sdks/typescript/client env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx semantic-release release_ts_server: needs: [js_build_and_test, release_ts_client, filter_changed_paths] if: > always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha') && needs.filter_changed_paths.outputs.ts_server_files == 'true' && needs.js_build_and_test.result == 'success' runs-on: ubuntu-latest permissions: contents: write issues: write pull-requests: write id-token: write steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - name: Pull latest changes run: git pull --rebase origin ${{ github.ref_name }} - name: Fetch all tags run: git fetch --tags --force - name: Setup pnpm uses: pnpm/action-setup@v2 with: { version: 10 } - name: Setup Node.js uses: actions/setup-node@v4 with: { node-version: 22.x, cache: 'pnpm' } - name: Install dependencies run: pnpm install --frozen-lockfile - name: Release working-directory: sdks/typescript/server env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx semantic-release release_ruby_sdk: name: Release Ruby SDK needs: [ruby_sdk_test, filter_changed_paths, release_ts_server] if: > always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha') && needs.filter_changed_paths.outputs.ruby_sdk_files == 'true' && needs.ruby_sdk_test.result == 'success' runs-on: ubuntu-latest environment: release permissions: contents: write # to push commits and tags id-token: write # for trusted publishing issues: write # to comment on issues pull-requests: write # to comment on pull requests steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - name: Pull latest changes run: git pull --rebase origin ${{ github.ref_name }} - name: Setup pnpm uses: pnpm/action-setup@v2 with: { version: 10 } - name: Setup Node.js uses: actions/setup-node@v4 with: { node-version: 22.x, cache: 'pnpm' } - name: Install dependencies run: pnpm install --frozen-lockfile - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' bundler: latest bundler-cache: true working-directory: sdks/ruby - name: Configure RubyGems Credentials uses: rubygems/configure-rubygems-credentials@main - name: Release working-directory: sdks/ruby env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx semantic-release release_python_sdk: name: Release Python SDK needs: [python_sdk_test, filter_changed_paths, release_ruby_sdk] if: > always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha') && needs.filter_changed_paths.outputs.python_sdk_files == 'true' && needs.python_sdk_test.result == 'success' runs-on: ubuntu-latest environment: release permissions: contents: write # to push commits and tags id-token: write # for trusted publishing to PyPI issues: write # to comment on issues pull-requests: write # to comment on pull requests steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - name: Pull latest changes run: git pull --rebase origin ${{ github.ref_name }} - name: Fetch all tags run: git fetch --tags --force - name: Setup pnpm uses: pnpm/action-setup@v2 with: { version: 10 } - name: Setup Node.js uses: actions/setup-node@v4 with: { node-version: 22.x, cache: 'pnpm' } - name: Install dependencies run: pnpm install --frozen-lockfile - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Set up uv uses: astral-sh/setup-uv@v3 with: enable-cache: true - name: Install Python dependencies run: uv sync --dev working-directory: sdks/python/server - name: Release working-directory: sdks/python/server env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx semantic-release ================================================ FILE: .github/workflows/deploy-docs.yml ================================================ # name: Deploy VitePress site to Pages on: # Runs on pushes targeting the `main` branch. Change this to `master` if you\'re # using the `master` branch as the default branch. push: branches: [main] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: pages cancel-in-progress: false jobs: # Build job build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # Not needed if lastUpdated is not enabled - name: Use pnpm uses: pnpm/action-setup@v3 with: version: 10 # Specify pnpm version from package.json - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Setup Pages uses: actions/configure-pages@v4 - name: Install dependencies run: pnpm install - name: Build with VitePress run: pnpm docs:build # This script is \'vitepress build docs\' - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: # Path to the output directory of 'vitepress build docs/src' path: docs/src/.vitepress/dist # Deployment job deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} needs: build runs-on: ubuntu-latest name: Deploy steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 ================================================ FILE: .gitignore ================================================ # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock examples/server/build # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # PNPM .pnpm-store/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarnclean # dotenv environment variables file .env .env.development.local .env.test.local .env.production.local .env.local # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files DynamoDBLocal_lib/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.* # Parcel cache files .cache .parcel-cache # Next.js build output .next out # Nuxt.js build output .nuxt # Svelte build output .svelte-kit # Docusaurus build output .docusaurus # Gatsby cache .cache/ # Vite build output dist # VitePress docs/src/.vitepress/dist docs/.vitepress/cache docs/src/.vitepress/cache # Monorepo specific /sdks/**/dist /sdks/**/coverage /examples/**/dist /examples/**/coverage # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db # IDEs and Editors # #################### # VSCode .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json *.code-workspace # JetBrains .idea/ *.iws *.iml *.ipr # Sublime Text *.sublime-project *.sublime-workspace # Compilation artifacts ####################### *.o *.obj *.exe *.dll *.so *.dylib # C/C++ specific *.gch *.pch # Python specific __pycache__/ *.py[cod] *$py.class # Environment variables .env* !.env.example # Husky .husky/_/ .husky/.gitignore # Auto-generated files adapter-runtime.bundled.ts ================================================ FILE: .prettierignore ================================================ # Ignore artifacts: node_modules dist build coverage venv # Ignore package manager files (if you commit them) package-lock.json yarn.lock pnpm-lock.yaml # Ignore specific configuration files if managed elsewhere or intentionally unformatted # .vscode/ # .idea/ # Ignore generated/bundled files *.generated.* *.bundled.ts docs/src/.vitepress/cache extensions/vscode/out *.log *.md ================================================ FILE: .prettierrc.json ================================================ { "semi": true, "trailingComma": "all", "singleQuote": true, "printWidth": 100, "tabWidth": 2, "plugins": ["prettier-plugin-tailwindcss"] } ================================================ FILE: .releaserc.json ================================================ { "branches": [ "main", { "name": "alpha", "prerelease": true } ], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", [ "@semantic-release/npm", { "pkgRoot": "sdks/typescript/client", "npmPublish": true } ], [ "@semantic-release/npm", { "pkgRoot": "sdks/typescript/server", "npmPublish": true } ], [ "@semantic-release/npm", { "npmPublish": false } ], [ "@semantic-release/exec", { "prepareCmd": "pnpm install --lockfile-only --ignore-scripts" } ], [ "@semantic-release/git", { "assets": [ "CHANGELOG.md", "package.json", "sdks/typescript/client/package.json", "sdks/typescript/server/package.json", "pnpm-lock.yaml" ], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ], "@semantic-release/github" ] } ================================================ FILE: .ruby-version ================================================ 3.2.2 ================================================ FILE: CHANGELOG.md ================================================ # [5.2.0](https://github.com/idosal/mcp-ui/compare/v5.1.2...v5.2.0) (2025-07-18) ### Features * support generic messages response ([#35](https://github.com/idosal/mcp-ui/issues/35)) ([10b407b](https://github.com/idosal/mcp-ui/commit/10b407b279b3ee9608ef077445f4d714f88343c5)) ## [5.1.2](https://github.com/idosal/mcp-ui/compare/v5.1.1...v5.1.2) (2025-07-18) ### Bug Fixes * use targetOrigin in the proxy message relay ([#40](https://github.com/idosal/mcp-ui/issues/40)) ([b3fb54e](https://github.com/idosal/mcp-ui/commit/b3fb54e28ca7b8eeda896b5bcf478b6343dbba47)) ## [5.1.1](https://github.com/idosal/mcp-ui/compare/v5.1.0...v5.1.1) (2025-07-18) ### Bug Fixes * add a bridge to pass messages in and out of the proxy ([#38](https://github.com/idosal/mcp-ui/issues/38)) ([30ccac0](https://github.com/idosal/mcp-ui/commit/30ccac0706ad8e02ebcd8960924ed1d58ddedf85)) # [5.1.0](https://github.com/idosal/mcp-ui/compare/v5.0.0...v5.1.0) (2025-07-18) ### Features * add proxy option to externalUrl ([#37](https://github.com/idosal/mcp-ui/issues/37)) ([7b95cd0](https://github.com/idosal/mcp-ui/commit/7b95cd0b3873fc1cde28748ec463e81c6ff1c494)) # [5.0.0](https://github.com/idosal/mcp-ui/compare/v4.1.4...v5.0.0) (2025-07-17) ### Bug Fixes * rename delivery -> encoding and flavor -> framework ([#36](https://github.com/idosal/mcp-ui/issues/36)) ([9a509ed](https://github.com/idosal/mcp-ui/commit/9a509ed80d051b0a8042b36958b401a0a7c1e138)) ### BREAKING CHANGES * The existing naming is ambiguous. Renaming delivery to encoding and flavor to framework should clarify the intent. ## [4.1.4](https://github.com/idosal/mcp-ui/compare/v4.1.3...v4.1.4) (2025-07-16) ### Bug Fixes * pass ref explicitly using iframeProps ([#33](https://github.com/idosal/mcp-ui/issues/33)) ([d01b5d1](https://github.com/idosal/mcp-ui/commit/d01b5d1e4cdaedc436ba2fa8984d866d93d59087)) ## [4.1.3](https://github.com/idosal/mcp-ui/compare/v4.1.2...v4.1.3) (2025-07-15) ### Bug Fixes * ref passing to UIResourceRenderer ([#32](https://github.com/idosal/mcp-ui/issues/32)) ([d28c23f](https://github.com/idosal/mcp-ui/commit/d28c23f9b8ee320f4e361200ae02a23f0d2a1c0c)) ## [4.1.2](https://github.com/idosal/mcp-ui/compare/v4.1.1...v4.1.2) (2025-07-10) ### Bug Fixes * validate URL ([b7c994d](https://github.com/idosal/mcp-ui/commit/b7c994dfdd947b3dfbb903fc8cb896d61004c8d8)) ## [4.1.1](https://github.com/idosal/mcp-ui/compare/v4.1.0...v4.1.1) (2025-07-06) ### Bug Fixes * text and blob support in RemoteDOM resources ([ec68eb9](https://github.com/idosal/mcp-ui/commit/ec68eb90df984da8b492cc25eafdafdeda79f299)) # [4.1.0](https://github.com/idosal/mcp-ui/compare/v4.0.0...v4.1.0) (2025-07-05) ### Features * separate html and remote-dom props ([#24](https://github.com/idosal/mcp-ui/issues/24)) ([a7f0529](https://github.com/idosal/mcp-ui/commit/a7f05299dc9cc40184f9ab25c5b648ee7077be64)) # [4.0.0](https://github.com/idosal/mcp-ui/compare/v3.0.0...v4.0.0) (2025-07-05) ### Bug Fixes * rename components and methods to fit new scope ([#22](https://github.com/idosal/mcp-ui/issues/22)) ([6bab1fe](https://github.com/idosal/mcp-ui/commit/6bab1fe3a168a18e7ba4762e23478abf4e0cc84c)) ### BREAKING CHANGES * exported names have changed # [3.0.0](https://github.com/idosal/mcp-ui/compare/v2.5.1...v3.0.0) (2025-07-04) ### Features * switch to UiResourceRenderer ([#21](https://github.com/idosal/mcp-ui/issues/21)) ([6fe3166](https://github.com/idosal/mcp-ui/commit/6fe316682675e27db914d60696754677e3783448)) ### BREAKING CHANGES * removed deprecated client API ## [2.5.1](https://github.com/idosal/mcp-ui/compare/v2.5.0...v2.5.1) (2025-06-28) ### Bug Fixes * export RemoteDomResource ([2b86f2d](https://github.com/idosal/mcp-ui/commit/2b86f2dd4506de49c69908e23d84a2a323170446)) * export UiResourceRenderer and HtmlResource ([2b841a5](https://github.com/idosal/mcp-ui/commit/2b841a556c1111ed70ccb3d3987afd21fe7df897)) # [2.5.0](https://github.com/idosal/mcp-ui/compare/v2.4.0...v2.5.0) (2025-06-27) ### Features * add remote-dom content type ([#18](https://github.com/idosal/mcp-ui/issues/18)) ([5dacf37](https://github.com/idosal/mcp-ui/commit/5dacf37c22b5ee6ae795049a8d573fc073b8a1f5)) # [2.4.0](https://github.com/idosal/mcp-ui/compare/v2.3.3...v2.4.0) (2025-06-20) ### Features * **client:** allow setting supportedContentTypes for HtmlResource ([#17](https://github.com/idosal/mcp-ui/issues/17)) ([e009ef1](https://github.com/idosal/mcp-ui/commit/e009ef10010134ba3d9893314cc4d8e1274f1f07)) ## [2.3.3](https://github.com/idosal/mcp-ui/compare/v2.3.2...v2.3.3) (2025-06-19) ### Bug Fixes * typescript types to be compatible with MCP SDK ([#10](https://github.com/idosal/mcp-ui/issues/10)) ([74365d7](https://github.com/idosal/mcp-ui/commit/74365d7ed6422beef6cd9ee0f5a97c847bd9827b)) ## [2.3.2](https://github.com/idosal/mcp-ui/compare/v2.3.1...v2.3.2) (2025-06-14) ### Bug Fixes * trigger release ([aaca831](https://github.com/idosal/mcp-ui/commit/aaca83125c3f7825ccdebf0f04f8553e953c5249)) ## [2.3.1](https://github.com/idosal/mcp-ui/compare/v2.3.0...v2.3.1) (2025-06-14) ### Bug Fixes * iframe handle ([#15](https://github.com/idosal/mcp-ui/issues/15)) ([66bd4fd](https://github.com/idosal/mcp-ui/commit/66bd4fd3d04f82e3e4557f064e701b68e1d8af11)) # [2.3.0](https://github.com/idosal/mcp-ui/compare/v2.2.0...v2.3.0) (2025-06-13) ### Features * pass iframe props down ([#14](https://github.com/idosal/mcp-ui/issues/14)) ([112539d](https://github.com/idosal/mcp-ui/commit/112539d28640a96e8375a6b416f2ba559370b312)) # [2.2.0](https://github.com/idosal/mcp-ui/compare/v2.1.0...v2.2.0) (2025-06-03) ### Features * support ui action result types ([#6](https://github.com/idosal/mcp-ui/issues/6)) ([899d152](https://github.com/idosal/mcp-ui/commit/899d1527286a281a23fbb8f3a207d435dfc3fe96)) # [2.1.0](https://github.com/idosal/mcp-ui/compare/v2.0.0...v2.1.0) (2025-05-31) ### Features * consolidate ui:// and ui-app:// ([#8](https://github.com/idosal/mcp-ui/issues/8)) ([2e08035](https://github.com/idosal/mcp-ui/commit/2e08035676bb6a46ef3c94dba916bc895f1fa3cc)) # [2.0.0](https://github.com/idosal/mcp-ui/compare/v1.1.0...v2.0.0) (2025-05-23) ### Documentation * bump ([#4](https://github.com/idosal/mcp-ui/issues/4)) ([ad4d163](https://github.com/idosal/mcp-ui/commit/ad4d1632cc1f9c99072349a8f0cdaac343236132)) ### BREAKING CHANGES * (previous one didn't take due to semantic-release misalignment) # [1.1.0](https://github.com/idosal/mcp-ui/compare/v1.0.7...v1.1.0) (2025-05-16) ### Bug Fixes * update deps ([4091ef4](https://github.com/idosal/mcp-ui/commit/4091ef47da048fab3c4feb002f5287b2ff295744)) ### Features * change onGenericMcpAction to optional onUiAction ([1913b59](https://github.com/idosal/mcp-ui/commit/1913b5977c30811f9e67659949e2d961f2eda983)) ## [1.0.7](https://github.com/idosal/mcp-ui/compare/v1.0.6...v1.0.7) (2025-05-16) ### Bug Fixes * **client:** specify iframe ([fd0b70a](https://github.com/idosal/mcp-ui/commit/fd0b70a84948d3aa5d7a79269ff7c3bcd0946689)) ## [1.0.6](https://github.com/idosal/mcp-ui/compare/v1.0.5...v1.0.6) (2025-05-16) ### Bug Fixes * support react-router ([21ffb95](https://github.com/idosal/mcp-ui/commit/21ffb95fe6d77a348b95b38dbf3741ba6442894e)) ## [1.0.5](https://github.com/idosal/mcp-ui/compare/v1.0.4...v1.0.5) (2025-05-16) ### Bug Fixes * **client:** styling ([6ff9b68](https://github.com/idosal/mcp-ui/commit/6ff9b685fd1be770fd103943e45275e9ec86905c)) ## [1.0.4](https://github.com/idosal/mcp-ui/compare/v1.0.3...v1.0.4) (2025-05-16) ### Bug Fixes * packaging ([9e6babd](https://github.com/idosal/mcp-ui/commit/9e6babd3a587213452ea7aec4cc9ae3a50fa1965)) ## [1.0.3](https://github.com/idosal/mcp-ui/compare/v1.0.2...v1.0.3) (2025-05-16) ### Bug Fixes * exports ([3a93a16](https://github.com/idosal/mcp-ui/commit/3a93a16e1b7438ba7b2ef49ca854479f755abcc6)) ## [1.0.2](https://github.com/idosal/mcp-ui/compare/v1.0.1...v1.0.2) (2025-05-16) ### Bug Fixes * remove shared dependency ([e66e8f4](https://github.com/idosal/mcp-ui/commit/e66e8f49b1ba46090db6e4682060488566f4fe41)) ## [1.0.1](https://github.com/idosal/mcp-ui/compare/v1.0.0...v1.0.1) (2025-05-16) ### Bug Fixes * publish ([0943e7a](https://github.com/idosal/mcp-ui/commit/0943e7acaf17f32aae085c2313bfbec47bc59f1f)) # 1.0.0 (2025-05-16) ### Bug Fixes * dependencies ([887f61f](https://github.com/idosal/mcp-ui/commit/887f61f827b4585c17493d4fa2dfb251ea598587)) * lint ([4487820](https://github.com/idosal/mcp-ui/commit/44878203a71c3c9173d463b809be36769e996ba9)) * lint ([d0a91f9](https://github.com/idosal/mcp-ui/commit/d0a91f9a07ec0042690240c3d8d0bad620f8c765)) * package config ([8dc1e53](https://github.com/idosal/mcp-ui/commit/8dc1e5358c3c8e641206a5e6851427d360cc1955)) ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at idosalomon@gmail.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2025 Ido Salomon Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ ## 📦 Model Context Protocol UI SDK
What's mcp-ui? • Core Concepts • Installation • Getting Started • Walkthrough • Examples • Supported Hosts • Security • Roadmap • Contributing • License
---- **`mcp-ui`** pioneered the concept of interactive UI over [MCP](https://modelcontextprotocol.io/introduction), enabling rich web interfaces for AI tools. Alongside Apps SDK, the patterns developed here directly influenced the [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) specification, which standardized UI delivery over the protocol. The `@mcp-ui/*` packages implement the MCP Apps standard. `@mcp-ui/client` is the recommended SDK for MCP Apps Hosts. > *The @mcp-ui/* packages are fully compliant with the MCP Apps specification and ready for production use.*## 💡 What's `mcp-ui`? `mcp-ui` is an SDK implementing the [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) standard for UI over MCP. It provides: * **`@mcp-ui/server` (TypeScript)**: Create UI resources with `createUIResource`. Works with `registerAppTool` and `registerAppResource` from `@modelcontextprotocol/ext-apps/server`. * **`@mcp-ui/client` (TypeScript)**: Render tool UIs with `AppRenderer` (MCP Apps) or `UIResourceRenderer` (legacy MCP-UI hosts). * **`mcp_ui_server` (Ruby)**: Create UI resources in Ruby. * **`mcp-ui-server` (Python)**: Create UI resources in Python. The MCP Apps pattern links tools to their UIs via `_meta.ui.resourceUri`. Hosts fetch and render the UI alongside tool results. ## ✨ Core Concepts ### MCP Apps Pattern (Recommended) The MCP Apps standard links tools to their UIs via `_meta.ui.resourceUri`: ```ts import { registerAppTool, registerAppResource } from '@modelcontextprotocol/ext-apps/server'; import { createUIResource } from '@mcp-ui/server'; // 1. Create UI resource const widgetUI = await createUIResource({ uri: 'ui://my-server/widget', content: { type: 'rawHtml', htmlString: '