Repository navigation
Description
Summary
I ran into a Firebase MCP discovery problem in a Flutter app that already has Crashlytics configured.
When the server starts in its default auto-detect mode, Crashlytics tools are not exposed. After digging into it locally, the reason appears to be an internal exception during feature detection, as opposed to something missing in my Crashlytics config.
The same install exposes the Crashlytics tools immediately if I force features with --only, so this looks like an MCP auto-detection bug.
Environment
firebase-tools15.11.0- macOS arm64
- Flutter app with
firebase_crashlyticsinpubspec.yaml lib/firebase_options.dartgenerated by FlutterFire- Android project also applies the Crashlytics Gradle plugin
Steps to reproduce
- Use a Flutter app that has Firebase configured and
firebase_crashlyticsinstalled. - Start Firebase MCP in the app root without forcing features:
firebase mcp --dir /path/to/flutter_app
- Have an MCP client list tools.
I also reproduced this directly in-process with the installed server:
const { FirebaseMcpServer } = require("firebase-tools/lib/mcp/index.js");
(async () => {
const server = new FirebaseMcpServer({ projectRoot: "/path/to/flutter_app" });
await new Promise(r => setTimeout(r, 500));
await server.mcpListTools();
})();Expected behavior
Crashlytics tools should be exposed automatically for a Flutter project that already has Crashlytics configured.
Actual behavior
Tool listing fails during auto-detection with:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at Object.join (node:path:1339:7)
at /opt/homebrew/lib/node_modules/firebase-tools/lib/appUtils.js:172:53
at Array.map (<anonymous>)
at detectAppIdsForPlatform (/opt/homebrew/lib/node_modules/firebase-tools/lib/appUtils.js:171:52)
at async processFlutterDir (/opt/homebrew/lib/node_modules/firebase-tools/lib/appUtils.js:92:27)
at async Promise.all (index 0)
at async Promise.all (index 1)
at async detectApps (/opt/homebrew/lib/node_modules/firebase-tools/lib/appUtils.js:42:72)
at async getPlatformsFromFolder (/opt/homebrew/lib/node_modules/firebase-tools/lib/appUtils.js:32:18)
at async isCrashlyticsInstalled (/opt/homebrew/lib/node_modules/firebase-tools/lib/mcp/util/crashlytics/availability.js:14:23)
Workaround
If I start MCP with forced features, Crashlytics tools show up immediately:
firebase mcp --dir /path/to/flutter_app --only core,auth,crashlytics,firestore,functions,messaging,database,remoteconfig,storageWith forced features, the server exposes the expected Crashlytics tools, including:
crashlytics_get_issuecrashlytics_get_reportcrashlytics_list_eventscrashlytics_batch_get_events
Suspected cause
This looks like an ordering problem in MCP startup.
mcpListTools() calls detectActiveFeatures() and detectProjectRoot() in parallel:
await Promise.all([this.detectActiveFeatures(), this.detectProjectRoot()]);But detectActiveFeatures() builds its context from this.cachedProjectDir, and _createMcpContext() uses that cached dir immediately.
So it looks possible for Crashlytics availability detection to run before the project root has been cached, which then leads to path.join(dirPath, file) getting undefined inside detectAppIdsForPlatform().
Related issues
This feels related in spirit to earlier MCP Crashlytics discovery issues, but not identical:
- [MCP]No crashlytics tools for iOS project #9495
- [mcp] fix issue where crashlytics isn't detected for ios apps that use project.pbxproj #9515
- [MCP] MCP Server not working with Cursor #8812
I can provide more detail if it would be helpful, but the in-process reproduction above seems to capture the failure pretty directly.
Activity
[mcp] ensure project root is resolved before feature detection
aalej commentedon Mar 30, 2026
Hey @lukemmtt, thanks for the detailed report and for opening up a PR! I'm trying to reproduce this issue, but so far I haven't encountered the error. Here's my MCVE, could you let me know in case I'm missing anything here to reproduce the issue?
If possible, could you share a minimal reproducible example with us? This will also help us verify the fix.
lukemmtt commentedon Mar 30, 2026
Hello @aalej, thanks for looking into this!
I took a closer look at your MCVE, and I saw the same thing you did: it wasn’t reproducing the issue when running via the normal initialized MCP stdio flow. However, if I invoke the same repo directly from a parent or unrelated directory, using the direct in-process method described in my original issue, I was able to reproduce the problem.
Here’s a concise repro script demonstrating the issue clearly under these conditions:
The underlying cause seems to be that in this direct invocation scenario,
detectActiveFeatures()executes before the project root (cachedProjectDir) has been populated. This causes feature detection to incorrectly depend onprocess.cwd()rather than the explicitly providedprojectRoot, resulting in the original error (TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined).That’s why #10213 seems to me to be the correct fix: it explicitly ensures the project root is resolved before running feature detection, eliminating this unintended dependency on the startup sequence and invocation context.
lukemmtt commentedon Mar 30, 2026
I did not mean to close this 😭;
Edit: Thanks for permission to reopen!
aalej commentedon Mar 31, 2026
Thanks for the clarification @lukemmtt! I tried running a script similar to the one you provided, though in my case instead of getting an error, it outputs:
With the code change in #10213, the output changes to below, which correctly reflects what features I have on the app
Node js script
I'll discuss this issue with our engineering team during our sync to get their feedback on this as well. Just to verify, did you encounter any errors when running with
firebase mcp --dir /path/to/flutter_app? As you mentioned, theawait Promise.all([this.detectActiveFeatures(), this.detectProjectRoot()]);might be causing a race condition.[mcp] ensure project root is resolved before feature detection (#10213)
feat: add deploy and deploy_status tools (#10262)