Skip to content

@W-22571806 Set up MCP Apps dependencies and basic server structure#365

Open
jarhun88 wants to merge 4 commits into
mainfrom
mcpapps-server
Open

@W-22571806 Set up MCP Apps dependencies and basic server structure#365
jarhun88 wants to merge 4 commits into
mainfrom
mcpapps-server

Conversation

@jarhun88
Copy link
Copy Markdown
Contributor

@jarhun88 jarhun88 commented May 28, 2026

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Pull Request Template

Description

New Tool Type: App Tools

  • Added AppDetails type containing name, resourceUri, and html fields
  • Extended WebTool class with optional app property for storing UI metadata
  • When a tool has an app property and the feature flag is enabled, it registers as an MCP App tool

Registration Flow

Added _registerAppTool() method that:

  • Registers the tool with _meta.ui.resourceUri metadata via registerAppTool
  • Registers the HTML/JavaScript resource via registerAppResource
  • Uses tool.name as the resource name for clarity
  • Added _registerTool() method for standard tool registration
  • Exposed registerAppTool and registerAppResource from @modelcontextprotocol/ext-apps/server

Feature Flag Gating

  • Tools with app property are checked against the mcp-apps feature flag
  • When enabled: registers as app tool with UI capabilities
  • When disabled: registers as standard tool (backward compatible)

No tools are registered as app tools yet.

Motivation and Context

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

How Has This Been Tested?

Related Issues

Checklist

  • I have updated the version in the package.json file by using npm run version. For example,
    use npm run version:patch for a patch version bump.
  • I have made any necessary changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have documented any breaking changes in the PR description. For example, renaming a config
    environment variable or changing its default value.

Contributor Agreement

By submitting this pull request, I confirm that:

jarhun88 added 3 commits May 27, 2026 15:56
Refactors tool registration to support both standard MCP tools and MCP Apps
tools with interactive UIs. Tools can now optionally declare an `app` property
with UI metadata, enabling rich client-side interactions.

Changes:
- Add `AppDetails` type with `name` and `resourceUri` fields
- Extend `WebToolParams` to include optional `app` field
- Extract `_registerTool` and `_registerAppTool` helper methods for clarity
- Conditionally register tools based on presence of `app` property
- Import and assign `registerAppTool` from @modelcontextprotocol/ext-apps
- Add test coverage for app tool registration flow

When a tool defines `app`, it's registered via `registerAppTool` with
`_meta.ui.resourceUri` pointing to the app resource. Standard tools continue
to use the existing `registerTool` path.
Completes MCP Apps infrastructure by implementing resource registration
alongside tool registration. When a tool has an `app` property, both the
tool metadata and its HTML/JS bundle are registered with the MCP server.

Changes:
- Add `html` field to `AppDetails` type for UI bundle content
- Implement `registerAppResource` call in `_registerAppTool` helper
- Register app resources with RESOURCE_MIME_TYPE from ext-apps SDK
- Add `invariant` check for app details presence (programming error guard)
- Assign `registerAppResource` from ext-apps to make it available
- Export `AppDetails` type for external reuse
- Add test coverage for resource registration
- Remove unused `McpUiReadResourceCallback` import

Resource registration uses the same `resourceUri` as the tool's `_meta.ui`
field, creating the link between tool invocation and UI rendering. The
resource callback returns the HTML bundle when the host requests it.

Type suppression note: CJS/ESM module resolution conflict in SDK causes
harmless type error. Code works correctly at runtime.
Gate the registration of tools with app properties behind the 'mcp-apps'
feature flag. When the feature flag is enabled and a tool has an app
property, it is registered as an app tool via registerAppTool. Otherwise,
it is registered as a standard tool.

Changes:
- Check 'mcp-apps' feature flag before registering app tools
- Register as standard tool when feature flag is off
- Use tool.name as resource name instead of resourceUri for better clarity
- Add tests for both feature flag enabled and disabled scenarios
- Use stable mock instance pattern for feature gate testing
@jarhun88 jarhun88 changed the title Mcpapps server @W-22571806 Set up MCP Apps dependencies and basic server structure May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant