UNPKG

firebase-tools

Version:
50 lines (48 loc) 1.6 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mcp = void 0; const logger_1 = require("../logger"); const index_1 = require("../mcp/index"); const util_1 = require("util"); const types_1 = require("../mcp/types"); const index_js_1 = require("../mcp/tools/index.js"); const path_1 = require("path"); const STARTUP_MESSAGE = ` This is a running process of the Firebase MCP server. This command should only be executed by an MCP client. An example MCP client configuration might be: { "mcpServers": { "firebase": { "command": "firebase", "args": ["experimental:mcp", "--dir", "/path/to/firebase/project"] } } } `; async function mcp() { const { values } = (0, util_1.parseArgs)({ options: { only: { type: "string", default: "" }, dir: { type: "string" }, "generate-tool-list": { type: "boolean", default: false }, }, allowPositionals: true, }); if (values["generate-tool-list"]) { console.log((0, index_js_1.markdownDocsOfTools)()); return; } process.env.IS_FIREBASE_MCP = "true"; (0, logger_1.useFileLogger)(); const activeFeatures = (values.only || "") .split(",") .filter((f) => types_1.SERVER_FEATURES.includes(f)); const server = new index_1.FirebaseMcpServer({ activeFeatures, projectRoot: values.dir ? (0, path_1.resolve)(values.dir) : undefined, }); await server.start(); if (process.stdin.isTTY) process.stderr.write(STARTUP_MESSAGE); } exports.mcp = mcp;