Skip to content

Add web support for Crashlytics MCP tools and prompts#10822

Open
tagboola wants to merge 6 commits into
mainfrom
crash-mcp-web-support
Open

Add web support for Crashlytics MCP tools and prompts#10822
tagboola wants to merge 6 commits into
mainfrom
crash-mcp-web-support

Conversation

@tagboola

Copy link
Copy Markdown
Contributor

Description

Add support for web apps with Crashlytics MCP tools and prompts.

Scenarios Tested

Sample Commands

@wiz-9635d3485b

wiz-9635d3485b Bot commented Jul 20, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 4 Medium 2 Low
Software Management Finding Software Management Findings -
Total 4 Medium 2 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

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

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.

Code Review

This pull request extends Firebase Crashlytics support to web applications, introducing web-specific reports (topBrowsers and webMetrics), metrics (sessionsCount), and filters (browserFilterDisplayNames). It also updates MCP prompts, guides, tools, and availability checks to distinguish between mobile and web platforms. The reviewer feedback highlights a critical issue in the web Crashlytics detection logic, which incorrectly expects "firebase/crashlytics" in package.json instead of the standard "firebase" or "@firebase/crashlytics" dependencies, and points out a few minor typos in comments and documentation.

Comment on lines +93 to +102
async function webAppUsesCrashlytics(appPath: string): Promise<boolean> {
const packageJsonFiles = await detectFiles(appPath, "package.json");
for (const file of packageJsonFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("firebase/crashlytics")) {
return true;
}
}
return false;
}

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.

high

Checking for "firebase/crashlytics" directly in package.json will fail for standard Firebase Web projects. In a typical project, "firebase" is listed as a dependency in package.json, and "firebase/crashlytics" is imported in the source files (as it is a subpath export, not a standalone npm package).

To correctly detect if a web app uses Crashlytics, we should check if "firebase" or "@firebase/crashlytics" is listed as a dependency in package.json.

Suggested change
async function webAppUsesCrashlytics(appPath: string): Promise<boolean> {
const packageJsonFiles = await detectFiles(appPath, "package.json");
for (const file of packageJsonFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("firebase/crashlytics")) {
return true;
}
}
return false;
}
async function webAppUsesCrashlytics(appPath: string): Promise<boolean> {
const packageJsonFiles = await detectFiles(appPath, "package.json");
const pattern = /"(firebase|@firebase\/crashlytics)"\s*:/;
for (const file of packageJsonFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (pattern.test(content)) {
return true;
}
}
return false;
}

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.

Is that true? How is the js sdk bundled?

@tonybaroneee tonybaroneee Jul 22, 2026

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.

So during the EAP, they’ll need to install and import “@firebase/crashlytics” explicitly due to how things are packaged/exposed. This will be detectable in package.json.

After we merge to main and are part of the larger SDK release, then they can just import “firebase/crashlytics” in their code as it will be bundled in the larger “firebase” dependency in package.json. At this point, there is no longer a guarantee that they have anything with "crashlytics" in their package.json.

Happy to chat this out more in person if it's still unclear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated this to check to see if firebase is installed and firebase/crashlytics is imported.

Comment thread src/mcp/util/crashlytics/availability.spec.ts Outdated
Comment thread src/mcp/resources/guides/crashlytics_reports.ts Outdated
Comment thread src/crashlytics/types.ts Outdated
@tagboola
tagboola requested review from PolinaGo and maxl0rd July 20, 2026 16:26
@tagboola
tagboola requested a review from schnecle July 21, 2026 18:43

@schnecle schnecle left a comment

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.

A couple small things

Comment thread src/crashlytics/filters.ts
.array(z.enum(["SIGNAL_EARLY", "SIGNAL_FRESH", "SIGNAL_REGRESSED", "SIGNAL_REPETITIVE"]))
.optional()
.describe(`Counts events matching the given signals`),
.describe(`Counts events matching the given signals. Only supported for mobile apps.`),

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.

This looks like the kind of thing that an agent is really going to mess up. Have you tested this one out locally? It might perform better if you say mobile apps and then qualify it like "mobile apps (e.g. iOS and Android)"

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 think this instruction will mostly work. If the api can just discard invalid filters, this is probably fine.

Comment thread src/mcp/util/crashlytics/availability.spec.ts Outdated
Comment on lines +93 to +102
async function webAppUsesCrashlytics(appPath: string): Promise<boolean> {
const packageJsonFiles = await detectFiles(appPath, "package.json");
for (const file of packageJsonFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("firebase/crashlytics")) {
return true;
}
}
return false;
}

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.

Is that true? How is the js sdk bundled?

Comment thread src/mcp/resources/guides/crashlytics_reports.ts Outdated
Comment thread src/crashlytics/types.ts Outdated
Comment thread src/crashlytics/filters.ts
.array(z.enum(["SIGNAL_EARLY", "SIGNAL_FRESH", "SIGNAL_REGRESSED", "SIGNAL_REPETITIVE"]))
.optional()
.describe(`Counts events matching the given signals`),
.describe(`Counts events matching the given signals. Only supported for mobile apps.`),

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 think this instruction will mostly work. If the api can just discard invalid filters, this is probably fine.

Comment thread src/crashlytics/types.ts Outdated
Comment thread src/crashlytics/types.ts Outdated
Comment thread src/crashlytics/types.ts Outdated
Comment thread src/crashlytics/types.ts Outdated
return false;
}

const sourceFiles = await detectFiles(appPath, "*.{js,jsx,ts,tsx,mjs,cjs,html,vue,svelte}");

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.

This could be very costly to the MCP start up time on a big app. For the other options, we try to do something that works for most folks and then give the workaround that they can force the crashlytics tools to be there even if not detected. Do we have any conventions around where someone would import the crashlytics dep that we could use to cover that 90% case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed-- I'm worried about the performance of this as well. @tonybaroneee is there a particular file where we expect most developers to import crashlytics?

I just remembered for the app testing agent that we just do a check to see if the app distribution API is enabled on the project to determine if we expose the app testing agent MCP tools. I wonder if is there an API or onboarding step that we can check to determine if they're onboarded for crash for web. That may be easier than trying to pinpoint a specific file that has a crashlytics import.

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.

Yeah, maybe let's just call a GET to the telemetry admin API config endpoint to see if they've onboarded. That's a pretty strong signal (even though they still might not have provisioned the SDK in their app yet).

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.

5 participants