Skip to content
Open
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
9 changes: 4 additions & 5 deletions src/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ npx -y firebase-tools login
- `--only <feature1,feature2>`: A comma-separated list of feature groups to activate. Use this to limit the tools exposed to only features you are actively using.

## Tools

| Tool Name | Feature Group | Description |
| -------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| firebase_get_project | core | Retrieves information about the currently active Firebase project. |
Expand Down Expand Up @@ -97,7 +96,7 @@ npx -y firebase-tools login
| crashlytics_update_issue | crashlytics | Update the state of an issue in Crashlytics. |
| apphosting_fetch_logs | apphosting | Fetches 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 | Retrieves 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`. |
| database_get_data | database | Returns RTDB data from the specified location |
| database_set_data | database | Writes RTDB data to the specified location |
| database_get_rules | database | Get an RTDB database's rules |
| database_validate_rules | database | Validates an RTDB database's rules |
| rtdb_get_data | database | Returns RTDB data from the specified location |
| rtdb_set_data | database | Writes RTDB data to the specified location |
| rtdb_get_rules | database | Get an RTDB database's rules |
| rtdb_validate_rules | database | Validates an RTDB database's rules |
2 changes: 1 addition & 1 deletion src/mcp/prompts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const prompts: Record<ServerFeature, ServerPrompt[]> = {
remoteconfig: [],
crashlytics: crashlyticsPrompts,
apphosting: [],
database: [],
rtdb: [],
};

function namespacePrompts(
Expand Down
4 changes: 2 additions & 2 deletions src/mcp/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
import { remoteConfigTools } from "./remoteconfig/index";
import { crashlyticsTools } from "./crashlytics/index";
import { appHostingTools } from "./apphosting/index";
import { realtimeDatabaseTools } from "./database/index";
import { rtdbTools } from "./rtdb/index";

/** availableTools returns the list of MCP tools available given the server flags */
export function availableTools(activeFeatures?: ServerFeature[]): ServerTool[] {
const toolDefs: ServerTool[] = [];
if (!activeFeatures?.length) {
activeFeatures = Object.keys(tools) as ServerFeature[];

Check warning on line 18 in src/mcp/tools/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'tools' was used before it was defined
}
if (!activeFeatures.includes("core")) {
activeFeatures.unshift("core");
}
for (const key of activeFeatures) {
toolDefs.push(...tools[key]);

Check warning on line 24 in src/mcp/tools/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'tools' was used before it was defined
}
return toolDefs;
}
Expand All @@ -36,7 +36,7 @@
remoteconfig: addFeaturePrefix("remoteconfig", remoteConfigTools),
crashlytics: addFeaturePrefix("crashlytics", crashlyticsTools),
apphosting: addFeaturePrefix("apphosting", appHostingTools),
database: addFeaturePrefix("database", realtimeDatabaseTools),
rtdb: addFeaturePrefix("rtdb", rtdbTools),
};

function addFeaturePrefix(feature: string, tools: ServerTool[]): ServerTool[] {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import { get_data } from "./get_data";
import { set_data } from "./set_data";
import { validate_rules } from "./validate_rules";

export const realtimeDatabaseTools: ServerTool[] = [get_data, set_data, get_rules, validate_rules];
export const rtdbTools: ServerTool[] = [get_data, set_data, get_rules, validate_rules];
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/mcp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const SERVER_FEATURES = [
"remoteconfig",
"crashlytics",
"apphosting",
"database",
"rtdb",
] as const;
export type ServerFeature = (typeof SERVER_FEATURES)[number];

Expand Down
2 changes: 1 addition & 1 deletion src/mcp/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Converts data to a CallToolResult.
*/
export function toContent(
data: any,

Check warning on line 22 in src/mcp/util.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
options?: { format?: "json" | "yaml"; contentPrefix?: string; contentSuffix?: string },
): CallToolResult {
if (typeof data === "string") return { content: [{ type: "text", text: data }] };
Expand Down Expand Up @@ -72,7 +72,7 @@
remoteconfig: remoteConfigApiOrigin(),
crashlytics: crashlyticsApiOrigin(),
apphosting: apphostingOrigin(),
database: realtimeOrigin(),
rtdb: realtimeOrigin(),
};

/**
Expand All @@ -82,10 +82,10 @@
export async function checkFeatureActive(
feature: ServerFeature,
projectId?: string,
options?: any,

Check warning on line 85 in src/mcp/util.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
): Promise<boolean> {
// if the feature is configured in firebase.json, it's active
if (feature in (options?.config?.data || {})) return true;

Check warning on line 88 in src/mcp/util.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .config on an `any` value
// if the feature's api is active in the project, it's active
try {
if (projectId)
Expand All @@ -104,7 +104,7 @@
// Helper function to process a single schema node (could be a property schema, items schema, etc.)
// Returns the cleaned schema, or null if the schema becomes invalid and should be removed according to the rules.
// The isRoot parameter is true only for the top-level schema object.
function deepClean(obj: any, isRootLevel: boolean = false): any {

Check warning on line 107 in src/mcp/util.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (typeof obj !== "object" || obj === null) {
return obj; // Not a schema object or null, return as is
}
Expand Down
Loading