From 650c47cc5d1086afeb163ea0fef8938ccecaf1e6 Mon Sep 17 00:00:00 2001 From: Kevin Cheung Date: Fri, 3 Oct 2025 14:57:08 -0700 Subject: [PATCH 1/2] MCP: Add --generate-resource-list option --- src/bin/mcp.ts | 6 ++ src/mcp/README.md | 149 ++++++++++++++++++++----------------- src/mcp/resources/index.ts | 19 +++++ 3 files changed, 105 insertions(+), 69 deletions(-) diff --git a/src/bin/mcp.ts b/src/bin/mcp.ts index 849d8287d04..e0905b5cf84 100644 --- a/src/bin/mcp.ts +++ b/src/bin/mcp.ts @@ -6,6 +6,7 @@ import { parseArgs } from "util"; import { SERVER_FEATURES, ServerFeature } from "../mcp/types"; import { markdownDocsOfTools } from "../mcp/tools/index.js"; import { markdownDocsOfPrompts } from "../mcp/prompts/index.js"; +import { markdownDocsOfResources } from "../mcp/resources/index.js"; import { resolve } from "path"; const STARTUP_MESSAGE = ` @@ -28,6 +29,7 @@ export async function mcp(): Promise { dir: { type: "string" }, "generate-tool-list": { type: "boolean", default: false }, "generate-prompt-list": { type: "boolean", default: false }, + "generate-resource-list": { type: "boolean", default: false }, }, allowPositionals: true, }); @@ -41,6 +43,10 @@ export async function mcp(): Promise { console.log(markdownDocsOfPrompts()); earlyExit = true; } + if (values["generate-resource-list"]) { + console.log(markdownDocsOfResources()); + earlyExit = true; + } if (earlyExit) return; process.env.IS_FIREBASE_MCP = "true"; diff --git a/src/mcp/README.md b/src/mcp/README.md index 613ff4b60cb..c53691d3dee 100644 --- a/src/mcp/README.md +++ b/src/mcp/README.md @@ -1,78 +1,89 @@ -| Tool Name | Feature Group | Description | -| -------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| firebase_login | core | Use this to sign the user into the Firebase CLI and Firebase MCP server. This requires a Google Account, and sign in is required to create and work with Firebase Projects. | -| firebase_logout | core | Use this to sign the user out of the Firebase CLI and Firebase MCP server. | -| firebase_validate_security_rules | core | Use this to check Firebase Security Rules for Firestore, Storage, or Realtime Database for syntax and validation errors. | -| firebase_get_project | core | Use this to retrieve information about the currently active Firebase Project. | -| firebase_list_apps | core | Use this to retrieve a list of the Firebase Apps registered in the currently active Firebase project. Firebase Apps can be iOS, Android, or Web. | -| firebase_list_projects | core | Use this to retrieve a list of Firebase Projects that the signed-in user has access to. | -| firebase_get_sdk_config | core | Use this to retrieve the Firebase configuration information for a Firebase App. You must specify EITHER a platform OR the Firebase App ID for a Firebase App registered in the currently active Firebase Project. | -| firebase_create_project | core | Use this to create a new Firebase Project. | -| firebase_create_app | core | Use this to create a new Firebase App in the currently active Firebase Project. Firebase Apps can be iOS, Android, or Web. | -| firebase_create_android_sha | core | Use this to add the specified SHA certificate hash to the specified Firebase Android App. | -| firebase_get_environment | core | Use this to retrieve the current Firebase **environment** configuration for the Firebase CLI and Firebase MCP server, including current authenticated user, project directory, active Firebase Project, and more. | -| firebase_update_environment | core | Use this to update environment config for the Firebase CLI and Firebase MCP server, such as project directory, active project, active user account, accept terms of service, and more. Use `firebase_get_environment` to see the currently configured environment. | -| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | -| firebase_get_security_rules | core | Use this to retrieve the security rules for a specified Firebase service. If there are multiple instances of that service in the product, the rules for the defualt instance are returned. | -| firebase_read_resources | core | Use this to read the contents of `firebase://` resources or list available resources | -| firestore_delete_document | firestore | Use this to delete a Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | -| firestore_get_documents | firestore | Use this to retrieve one or more Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | -| firestore_list_collections | firestore | Use this to retrieve a list of collections from a Firestore database in the current project. | -| firestore_query_collection | firestore | Use this to retrieve one or more Firestore documents from a collection is a database in the current project by a collection with a full document path. Use this if you know the exact path of a collection and the filtering clause you would like for the document. | -| auth_get_users | auth | Use this to retrieve one or more Firebase Auth users based on a list of UIDs or a list of emails. | -| auth_update_user | auth | Use this to disable, enable, or set a custom claim on a specific user's account. | -| auth_set_sms_region_policy | auth | Use this to set an SMS region policy for Firebase Authentication to restrict the regions which can receive text messages based on an ALLOW or DENY list of country codes. This policy will override any existing policies when set. | -| dataconnect_build | dataconnect | Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors. | -| dataconnect_generate_schema | dataconnect | Use this to generate a Firebase Data Connect Schema based on the users description of an app. | -| dataconnect_generate_operation | dataconnect | Use this to generate a single Firebase Data Connect query or mutation based on the currently deployed schema and the provided prompt. | -| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase Data Connect services | -| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a Data Connect service or its emulator. | -| storage_get_object_download_url | storage | Use this to retrieve the download URL for an object in a Cloud Storage for Firebase bucket. | -| messaging_send_message | messaging | Use this to send a message to a Firebase Cloud Messaging registration token or topic. ONLY ONE of `registration_token` or `topic` may be supplied in a specific call. | -| functions_get_logs | functions | Retrieves a page of Cloud Functions log entries using Google Cloud Logging advanced filters. | -| remoteconfig_get_template | remoteconfig | Use this to retrieve the specified Firebase Remote Config template from the currently active Firebase Project. | -| remoteconfig_update_template | remoteconfig | Use this to publish a new remote config template or roll back to a specific version for the project | -| crashlytics_create_note | crashlytics | Add a note to an issue from crashlytics. | -| crashlytics_delete_note | crashlytics | Delete a note from a Crashlytics issue. | -| crashlytics_get_issue | crashlytics | Gets data for a Crashlytics issue, which can be used as a starting point for debugging. | -| crashlytics_list_events | crashlytics | Use this to list the most recent events matching the given filters. | +| Tool Name | Feature Group | Description | +| --------- | ------------- | ----------- | +| firebase_login | core | Use this to sign the user into the Firebase CLI and Firebase MCP server. This requires a Google Account, and sign in is required to create and work with Firebase Projects. | +| firebase_logout | core | Use this to sign the user out of the Firebase CLI and Firebase MCP server. | +| firebase_validate_security_rules | core | Use this to check Firebase Security Rules for Firestore, Storage, or Realtime Database for syntax and validation errors. | +| firebase_get_project | core | Use this to retrieve information about the currently active Firebase Project. | +| firebase_list_apps | core | Use this to retrieve a list of the Firebase Apps registered in the currently active Firebase project. Firebase Apps can be iOS, Android, or Web. | +| firebase_list_projects | core | Use this to retrieve a list of Firebase Projects that the signed-in user has access to. | +| firebase_get_sdk_config | core | Use this to retrieve the Firebase configuration information for a Firebase App. You must specify EITHER a platform OR the Firebase App ID for a Firebase App registered in the currently active Firebase Project. | +| firebase_create_project | core | Use this to create a new Firebase Project. | +| firebase_create_app | core | Use this to create a new Firebase App in the currently active Firebase Project. Firebase Apps can be iOS, Android, or Web. | +| firebase_create_android_sha | core | Use this to add the specified SHA certificate hash to the specified Firebase Android App. | +| firebase_get_environment | core | Use this to retrieve the current Firebase **environment** configuration for the Firebase CLI and Firebase MCP server, including current authenticated user, project directory, active Firebase Project, and more. | +| firebase_update_environment | core | Use this to update environment config for the Firebase CLI and Firebase MCP server, such as project directory, active project, active user account, accept terms of service, and more. Use `firebase_get_environment` to see the currently configured environment. | +| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | +| firebase_get_security_rules | core | Use this to retrieve the security rules for a specified Firebase service. If there are multiple instances of that service in the product, the rules for the defualt instance are returned. | +| firebase_read_resources | core | Use this to read the contents of `firebase://` resources or list available resources | +| firestore_delete_document | firestore | Use this to delete a Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | +| firestore_get_documents | firestore | Use this to retrieve one or more Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | +| firestore_list_collections | firestore | Use this to retrieve a list of collections from a Firestore database in the current project. | +| firestore_query_collection | firestore | Use this to retrieve one or more Firestore documents from a collection is a database in the current project by a collection with a full document path. Use this if you know the exact path of a collection and the filtering clause you would like for the document. | +| auth_get_users | auth | Use this to retrieve one or more Firebase Auth users based on a list of UIDs or a list of emails. | +| auth_update_user | auth | Use this to disable, enable, or set a custom claim on a specific user's account. | +| auth_set_sms_region_policy | auth | Use this to set an SMS region policy for Firebase Authentication to restrict the regions which can receive text messages based on an ALLOW or DENY list of country codes. This policy will override any existing policies when set. | +| dataconnect_build | dataconnect | Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors. | +| dataconnect_generate_schema | dataconnect | Use this to generate a Firebase Data Connect Schema based on the users description of an app. | +| dataconnect_generate_operation | dataconnect | Use this to generate a single Firebase Data Connect query or mutation based on the currently deployed schema and the provided prompt. | +| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase Data Connect services | +| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a Data Connect service or its emulator. | +| storage_get_object_download_url | storage | Use this to retrieve the download URL for an object in a Cloud Storage for Firebase bucket. | +| messaging_send_message | messaging | Use this to send a message to a Firebase Cloud Messaging registration token or topic. ONLY ONE of `registration_token` or `topic` may be supplied in a specific call. | +| functions_get_logs | functions | Use this to retrieve a page of Cloud Functions log entries using Google Cloud Logging advanced filters. | +| remoteconfig_get_template | remoteconfig | Use this to retrieve the specified Firebase Remote Config template from the currently active Firebase Project. | +| remoteconfig_update_template | remoteconfig | Use this to publish a new remote config template or roll back to a specific version for the project | +| crashlytics_create_note | crashlytics | Add a note to an issue from crashlytics. | +| crashlytics_delete_note | crashlytics | Delete a note from a Crashlytics issue. | +| crashlytics_get_issue | crashlytics | Gets data for a Crashlytics issue, which can be used as a starting point for debugging. | +| crashlytics_list_events | crashlytics | Use this to list the most recent events matching the given filters. + Can be used to fetch sample crashes and exceptions for an issue, + which will include stack traces and other data useful for debugging. | +| crashlytics_batch_get_events | crashlytics | Gets specific events by resource name. Can be used to fetch sample crashes and exceptions for an issue, which will include stack traces and other data useful for debugging. | - -| crashlytics*batch_get_events | crashlytics | Gets specific events by resource name. -Can be used to fetch sample crashes and exceptions for an issue, -which will include stack traces and other data useful for debugging. | | crashlytics_list_notes | crashlytics | Use this to list all notes for an issue in Crashlytics. | -| crashlytics_get_top_issues | crashlytics | Use this to count events and distinct impacted users, grouped by \_issue*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. | -| crashlytics*get_top_variants | crashlytics | Counts events and distinct impacted users, grouped by issue \_variant*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. | -| crashlytics*get_top_versions | crashlytics | Counts events and distinct impacted users, grouped by \_version*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. | -| crashlytics*get_top_apple_devices | crashlytics | Counts events and distinct impacted users, grouped by apple \_device*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. -Only relevant for iOS, iPadOS and MacOS applications. | -| crashlytics*get_top_android_devices | crashlytics | Counts events and distinct impacted users, grouped by android \_device*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. -Only relevant for Android applications. | -| crashlytics*get_top_operating_systems | crashlytics | Counts events and distinct impacted users, grouped by \_operating system*. -Groups are sorted by event count, in descending order. -Only counts events matching the given filters. | +| crashlytics_get_top_issues | crashlytics | Use this to count events and distinct impacted users, grouped by *issue*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. | +| crashlytics_get_top_variants | crashlytics | Counts events and distinct impacted users, grouped by issue *variant*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. | +| crashlytics_get_top_versions | crashlytics | Counts events and distinct impacted users, grouped by *version*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. | +| crashlytics_get_top_apple_devices | crashlytics | Counts events and distinct impacted users, grouped by apple *device*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. + Only relevant for iOS, iPadOS and MacOS applications. | +| crashlytics_get_top_android_devices | crashlytics | Counts events and distinct impacted users, grouped by android *device*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. + Only relevant for Android applications. | +| crashlytics_get_top_operating_systems | crashlytics | Counts events and distinct impacted users, grouped by *operating system*. + Groups are sorted by event count, in descending order. + Only counts events matching the given filters. | | crashlytics_update_issue | crashlytics | Use this to update the state of Crashlytics issue. | | apphosting_fetch_logs | apphosting | Use this to fetch the most recent logs for a specified App Hosting backend. If `buildLogs` is specified, the logs from the build process for the latest build are returned. The most recent logs are listed first. | -| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to conenct to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | +| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to conenct to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | | realtimedatabase_get_data | realtimedatabase | Use this to retrieve data from the specified location in a Firebase Realtime Database. | | realtimedatabase_set_data | realtimedatabase | Use this to write data to the specified location in a Firebase Realtime Database. | -| Prompt Name | Feature Group | Description | -| ------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| firebase:deploy | core | Use this command to deploy resources to Firebase.

Arguments:
<prompt> (optional): any specific instructions you wish to provide about deploying | -| firebase:init | core | Use this command to setup Firebase for the current workspace. | -| firebase:consult | core | Use this command to consult the Firebase Assistant with access to detailed up-to-date documentation for the Firebase platform.

Arguments:
<prompt>: a question to pass to the Gemini in Firebase model | -| crashlytics:connect | crashlytics | Access a Firebase application's Crashlytics data. | +| Prompt Name | Feature Group | Description | +| ----------- | ------------- | ----------- | +| firebase:deploy | core | Use this command to deploy resources to Firebase.

Arguments:
<prompt> (optional): any specific instructions you wish to provide about deploying | +| firebase:init | core | Use this command to setup Firebase for the current workspace. | +| firebase:consult | core | Use this command to consult the Firebase Assistant with access to detailed up-to-date documentation for the Firebase platform.

Arguments:
<prompt>: a question to pass to the Gemini in Firebase model | +| crashlytics:connect | crashlytics | Access a Firebase application's Crashlytics data. | + +| Resource Name | Description | +| ------------- | ----------- | +| backend_init_guide | Firebase Backend Init Guide: guides the coding agent through configuring Firebase backend services in the current project | +| ai_init_guide | Firebase GenAI Init Guide: guides the coding agent through configuring GenAI capabilities in the current project utilizing Firebase | +| data_connect_init_guide | Firebase Data Connect Init Guide: guides the coding agent through configuring Data Connect for PostgreSQL access in the current project | +| firestore_init_guide | Firestore Init Guide: guides the coding agent through configuring Firestore in the current project | +| firestore_rules_init_guide | Firestore Rules Init Guide: guides the coding agent through setting up Firestore security rules in the project | +| rtdb_init_guide | Firebase Realtime Database Init Guide: guides the coding agent through configuring Realtime Database in the current project | +| auth_init_guide | Firebase Authentication Init Guide: guides the coding agent through configuring Firebase Authentication in the current project | +| hosting_init_guide | Firebase Hosting Deployment Guide: guides the coding agent through deploying to Firebase Hosting in the current project | +| docs | Firebase Docs: loads plain text content from Firebase documentation, e.g. `https://firebase.google.com/docs/functions` becomes `firebase://docs/functions` | diff --git a/src/mcp/resources/index.ts b/src/mcp/resources/index.ts index ccb575201dd..b1e78fec68c 100644 --- a/src/mcp/resources/index.ts +++ b/src/mcp/resources/index.ts @@ -56,3 +56,22 @@ export async function resolveResource( if (track) void trackGA4("mcp_read_resource", { resource_name: uri, not_found: "true" }); return null; } + +/** + * Generates a markdown table of all available resources and their descriptions. + * This is used for generating documentation. + */ +export function markdownDocsOfResources(): string { + const allResources = [...resources, ...resourceTemplates]; + const headings = ` +| Resource Name | Description | +| ------------- | ----------- |`; + const resourceRows = allResources.map((res) => { + let desc = res.mcp.title ? `${res.mcp.title}: ` : ""; + desc += res.mcp.description || ""; + desc = desc.replaceAll("\n", "
"); + return ` +| ${res.mcp.name} | ${desc} |`; + }); + return headings + resourceRows.join(""); +} From 46309d449b7098fb07568edea756ff7e9a0b2876 Mon Sep 17 00:00:00 2001 From: Kevin Cheung Date: Mon, 6 Oct 2025 10:59:51 -0700 Subject: [PATCH 2/2] regen readme --- src/mcp/README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mcp/README.md b/src/mcp/README.md index 2d0c044aac3..3a94a031371 100644 --- a/src/mcp/README.md +++ b/src/mcp/README.md @@ -50,21 +50,21 @@ | realtimedatabase_get_data | realtimedatabase | Use this to retrieve data from the specified location in a Firebase Realtime Database. | | realtimedatabase_set_data | realtimedatabase | Use this to write data to the specified location in a Firebase Realtime Database. | -| Prompt Name | Feature Group | Description | -| ----------- | ------------- | ----------- | -| firebase:deploy | core | Use this command to deploy resources to Firebase.

Arguments:
<prompt> (optional): any specific instructions you wish to provide about deploying | -| firebase:init | core | Use this command to setup Firebase for the current workspace. | -| firebase:consult | core | Use this command to consult the Firebase Assistant with access to detailed up-to-date documentation for the Firebase platform.

Arguments:
<prompt>: a question to pass to the Gemini in Firebase model | -| crashlytics:connect | crashlytics | Access a Firebase application's Crashlytics data. | +| Prompt Name | Feature Group | Description | +| ------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| firebase:deploy | core | Use this command to deploy resources to Firebase.

Arguments:
<prompt> (optional): any specific instructions you wish to provide about deploying | +| firebase:init | core | Use this command to set up Firebase services, like backend and AI features. | +| firebase:consult | core | Use this command to consult the Firebase Assistant with access to detailed up-to-date documentation for the Firebase platform.

Arguments:
<prompt>: a question to pass to the Gemini in Firebase model | +| crashlytics:connect | crashlytics | Access a Firebase application's Crashlytics data. | -| Resource Name | Description | -| ------------- | ----------- | -| backend_init_guide | Firebase Backend Init Guide: guides the coding agent through configuring Firebase backend services in the current project | -| ai_init_guide | Firebase GenAI Init Guide: guides the coding agent through configuring GenAI capabilities in the current project utilizing Firebase | -| data_connect_init_guide | Firebase Data Connect Init Guide: guides the coding agent through configuring Data Connect for PostgreSQL access in the current project | -| firestore_init_guide | Firestore Init Guide: guides the coding agent through configuring Firestore in the current project | -| firestore_rules_init_guide | Firestore Rules Init Guide: guides the coding agent through setting up Firestore security rules in the project | -| rtdb_init_guide | Firebase Realtime Database Init Guide: guides the coding agent through configuring Realtime Database in the current project | -| auth_init_guide | Firebase Authentication Init Guide: guides the coding agent through configuring Firebase Authentication in the current project | -| hosting_init_guide | Firebase Hosting Deployment Guide: guides the coding agent through deploying to Firebase Hosting in the current project | -| docs | Firebase Docs: loads plain text content from Firebase documentation, e.g. `https://firebase.google.com/docs/functions` becomes `firebase://docs/functions` | +| Resource Name | Description | +| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| backend_init_guide | Firebase Backend Init Guide: guides the coding agent through configuring Firebase backend services in the current project | +| ai_init_guide | Firebase GenAI Init Guide: guides the coding agent through configuring GenAI capabilities in the current project utilizing Firebase | +| data_connect_init_guide | Firebase Data Connect Init Guide: guides the coding agent through configuring Data Connect for PostgreSQL access in the current project | +| firestore_init_guide | Firestore Init Guide: guides the coding agent through configuring Firestore in the current project | +| firestore_rules_init_guide | Firestore Rules Init Guide: guides the coding agent through setting up Firestore security rules in the project | +| rtdb_init_guide | Firebase Realtime Database Init Guide: guides the coding agent through configuring Realtime Database in the current project | +| auth_init_guide | Firebase Authentication Init Guide: guides the coding agent through configuring Firebase Authentication in the current project | +| hosting_init_guide | Firebase Hosting Deployment Guide: guides the coding agent through deploying to Firebase Hosting in the current project | +| docs | Firebase Docs: loads plain text content from Firebase documentation, e.g. `https://firebase.google.com/docs/functions` becomes `firebase://docs/functions` |