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 b9f945f215b..3a94a031371 100644 --- a/src/mcp/README.md +++ b/src/mcp/README.md @@ -53,6 +53,18 @@ | 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: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` | 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(""); +}