Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bin/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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 { resolve } from "path";

const STARTUP_MESSAGE = `
Expand All @@ -20,19 +21,28 @@
}
`;

export async function mcp(): Promise<void> {

Check warning on line 24 in src/bin/mcp.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const { values } = parseArgs({
options: {
only: { type: "string", default: "" },
dir: { type: "string" },
"generate-tool-list": { type: "boolean", default: false },
"generate-prompt-list": { type: "boolean", default: false },
},
allowPositionals: true,
});

let earlyExit = false;
if (values["generate-tool-list"]) {
console.log(markdownDocsOfTools());
return;
earlyExit = true;
}
if (values["generate-prompt-list"]) {
console.log(markdownDocsOfPrompts());
earlyExit = true;
}
if (earlyExit) return;

process.env.IS_FIREBASE_MCP = "true";
useFileLogger();
const activeFeatures = (values.only || "")
Expand Down
7 changes: 7 additions & 0 deletions src/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@ Only counts events matching the given filters. |
| 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. <br><br>Arguments: <br>&lt;prompt&gt; (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. <br><br>Arguments: <br>&lt;prompt&gt;: a question to pass to the Gemini in Firebase model |
| crashlytics:connect | crashlytics | Access a Firebase application's Crashlytics data. |
25 changes: 25 additions & 0 deletions src/mcp/prompts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,28 @@ export function availablePrompts(features?: ServerFeature[]): ServerPrompt[] {
}
return allPrompts;
}

/**
* Generates a markdown table of all available prompts and their descriptions.
* This is used for generating documentation.
*/
export function markdownDocsOfPrompts(): string {
const allPrompts = availablePrompts();
let doc = `
| Prompt Name | Feature Group | Description |
| ----------- | ------------- | ----------- |`;
for (const prompt of allPrompts) {
const feature = prompt.mcp._meta?.feature || "";
let description = prompt.mcp.description || "";
if (prompt.mcp.arguments?.length) {
const argsList = prompt.mcp.arguments.map(
(arg) =>
` <br>&lt;${arg.name}&gt;${arg.required ? "" : " (optional)"}: ${arg.description || ""}`,
);
description += ` <br><br>Arguments:${argsList.join("")}`;
}
doc += `
| ${prompt.mcp.name} | ${feature} | ${description} |`;
}
return doc;
}
Loading