Skip to content

feat: add Update Environment MCP App#10260

Merged
joehan merged 7 commits intomcp-sse-supportfrom
mcp-update-env-app
Apr 16, 2026
Merged

feat: add Update Environment MCP App#10260
joehan merged 7 commits intomcp-sse-supportfrom
mcp-update-env-app

Conversation

@joehan
Copy link
Copy Markdown
Member

@joehan joehan commented Apr 3, 2026

Adds the Update Environment MCP App. (Chained off #10259)

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new visual interface for selecting the active Firebase project within a workspace, including an HTML template, a TypeScript application for logic, and a resource definition to serve the UI. Several critical issues were identified: the HTML template incorrectly references a .ts file instead of the compiled .js file, and the firebase_get_environment tool is expected to return structured data but currently returns a string, which will break the 'Current Context' display. Additionally, there are multiple violations of the repository style guide, specifically the use of any types and deeply nested logic, along with a UI bug where safe area insets could overwrite necessary default padding.

Comment thread src/mcp/apps/update_environment/mcp-app.html
Comment thread src/mcp/apps/update_environment/mcp-app.ts
Comment thread src/mcp/apps/update_environment/mcp-app.ts
if (ctx.styles?.css?.fonts) applyHostFonts(ctx.styles.css.fonts);
if (ctx.safeAreaInsets) {
const { top, right, bottom, left } = ctx.safeAreaInsets;
document.body.style.padding = `${top}px ${right}px ${bottom}px ${left}px`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting document.body.style.padding directly from safeAreaInsets will overwrite the default 24px padding defined in the CSS (line 27). If the safe area insets are zero, the UI will lose its intended margins. It is better to ensure a minimum padding that respects both the safe area and the design's spacing.

Suggested change
document.body.style.padding = `${top}px ${right}px ${bottom}px ${left}px`;
document.body.style.padding = `${Math.max(top, 24)}px ${Math.max(right, 24)}px ${Math.max(bottom, 24)}px ${Math.max(left, 24)}px`;

Comment thread src/mcp/apps/update_environment/mcp-app.ts

// Fetch projects on load
const result = await app.callServerTool({ name: "firebase_list_projects", arguments: {} });
const data = result.structuredContent as any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using any for the tool result data. Use the FirebaseProject interface to maintain type safety as per the style guide (line 38).

Suggested change
const data = result.structuredContent as any;
const data = result.structuredContent as { projects: FirebaseProject[] } | undefined;
References
  1. Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)

Base automatically changed from mcp-app-infra to mcp-sse-support April 3, 2026 22:08
@joehan joehan force-pushed the mcp-update-env-app branch 5 times, most recently from 69b87cf to a5b2a79 Compare April 4, 2026 00:09
@joehan joehan marked this pull request as ready for review April 9, 2026 23:13
@joehan joehan requested a review from maneesht April 9, 2026 23:13
<div id="status-box"></div>
</div>
</div>
<script type="module" src="mcp-app.ts"></script>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you dismissed this feedback, but how does this get compiled?

const statusBox = document.getElementById("status-box") as HTMLDivElement;

let projects: any[] = [];
let filteredProjects: any[] = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we strongly type this and line 15?

import * as path from "path";
import * as fs from "fs/promises";

export const RESOURCE_MIME_TYPE = "application/vnd.mcp.ext-app+html";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we probably want to share this between mcp apps

renderProjects();
showStatus("Projects loaded successfully.", "success");
setTimeout(() => {
if (statusBox.className === "status success") statusBox.style.display = "none";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow here. Should this be a setInterval instead?

Copy link
Copy Markdown
Contributor

@maneesht maneesht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lg, but I'd rather we replace the any in this

@joehan joehan force-pushed the mcp-update-env-app branch from 0be62c8 to 5d8e23c Compare April 16, 2026 17:49
joehan added 7 commits April 16, 2026 10:52
### Description
- Adds mcpapps experiment flag to src/experiments.ts.
- Adds applyAppMeta helper function to src/mcp/util.ts to conditionally add UI metadata.
- Adds unit tests for applyAppMeta in src/mcp/util.spec.ts.

### Scenarios Tested
- Unit tests passed.
- Build succeeds.
### Description
- Fixes applyAppMeta to preserve existing metadata.
- Moves mcpapps flag to be grouped with other MCP experiments.
- Removes as any in util.spec.ts by importing CallToolResult.

### Scenarios Tested
- Build succeeds.
- Lint passes for modified files (ignoring pre-existing warnings).
- Unit tests for applyAppMeta pass.
Adds support for returning structured content from tools, which is used by MCP Apps to pass complex data to the host. Also updates the resource index.

- Verified build and file changes.
### Description
Adds the Update Environment MCP App, allowing users to switch projects and directories from the UI.

### Scenarios Tested
- Verified build and file changes.
@joehan joehan force-pushed the mcp-update-env-app branch from 5d8e23c to 9cb1bff Compare April 16, 2026 17:53
@joehan joehan merged commit 1999159 into mcp-sse-support Apr 16, 2026
1 check passed
@joehan joehan deleted the mcp-update-env-app branch April 16, 2026 17:55
joehan added a commit that referenced this pull request Apr 17, 2026
* feat: add SSE mode support for MCP server

### Description
Adds support for running the MCP server in SSE (HTTP) mode, in addition to the default Stdio transport. This allows clients to connect over network or via tools that support SSE.

### Scenarios Tested
- Started server in SSE mode and verified log output.

* fix: add progressToken to McpContext interface to fix build error

### Description
Fixes a type error where progressToken was not defined on McpContext.

### Scenarios Tested
- Verified build succeeds.

* refactor: address PR comments on SSE support

### Description
Addresses PR comments by:
- Moving inline require calls to top-level imports.
- Replacing any types with specific interfaces or unknown.

### Scenarios Tested
- Verified build succeeds.

* fix: address remaining review comments on SSE support

### Description
- Reverts accidental GA4 tracking change in mcpListResources.
- Replaces console.error with this.logger calls for better logging.
- Changes default server binding from 0.0.0.0 to 127.0.0.1 for security.

### Scenarios Tested
- Verified build succeeds.

* style: lint and format fixes for SSE support

### Description
- Applied auto-formatting fixes from npm run format.

### Scenarios Tested
- Verified build succeeds.

* feat: add infrastructure for MCP Apps (#10259)

* feat: add infrastructure for MCP Apps

### Description
Adds support for returning structured content from tools, which is used by MCP Apps to pass complex data to the host. Also updates the resource index.

### Scenarios Tested
- Verified build and file changes.

* fix: resolve build errors and address review comments on infra

### Description
- Removes imports and registry entries for UI resources that are not yet available in this branch (login, update_environment, deploy, init).
- Replaces as any in toContent with an intersection type for better type safety.

### Scenarios Tested
- Verified build succeeds.

* chore: avoid any for sessionId in SSE transport

### Description
- Defines a local interface extending SSEServerTransport to avoid using  when accessing .

### Scenarios Tested
- Build succeeds.
- Lint passes for modified lines.

* feat: change sse flag to mode flag and fix build errors

### Description
- Replaced  boolean flag with  string flag (defaults to 'stdio').
- Added validation for  to accept only 'stdio' or 'sse'.
- Fixed build errors by adding  to  interface and removing missing  resource.

### Scenarios Tested
- Build succeeds.
- Lint passes with no new errors.

* feat: add Update Environment MCP App (#10260)

* feat: add mcpapps experiment flag and helper

### Description
- Adds mcpapps experiment flag to src/experiments.ts.
- Adds applyAppMeta helper function to src/mcp/util.ts to conditionally add UI metadata.
- Adds unit tests for applyAppMeta in src/mcp/util.spec.ts.

### Scenarios Tested
- Unit tests passed.
- Build succeeds.

* chore: address PR comments on experiments and util

### Description
- Fixes applyAppMeta to preserve existing metadata.
- Moves mcpapps flag to be grouped with other MCP experiments.
- Removes as any in util.spec.ts by importing CallToolResult.

### Scenarios Tested
- Build succeeds.
- Lint passes for modified files (ignoring pre-existing warnings).
- Unit tests for applyAppMeta pass.

* feat: add infrastructure for MCP Apps

Adds support for returning structured content from tools, which is used by MCP Apps to pass complex data to the host. Also updates the resource index.

- Verified build and file changes.

* feat: add Update Environment MCP App

### Description
Adds the Update Environment MCP App, allowing users to switch projects and directories from the UI.

### Scenarios Tested
- Verified build and file changes.

* fix: resolve compilation errors in mcp-update-env-app

* fix: resolve remaining lint errors in mcp-update-env-app

* refactor: extract app MIME type shared constant

* added changelog'
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.

3 participants