mcp server firebase

Local 2025-09-01 00:39:00 0

A server providing a unified interface to interact with Firebase services, including Authentication, Firestore, and Storage.


Overview

This is a Firebase MCP (Model Context Protocol) server that provides a unified interface to interact with various Firebase services including Authentication, Firestore, and Storage.

Setup

  1. Clone and build the project:

    git clone https://github.com/gemini-dk/mcp-server-firebase
    cd mcp-server-firebase
    npm install
    npm run build

  2. Get Firebase service account key:

  3. Go to Firebase Console > Project Settings > Service accounts
  4. Click "Generate new private key"
  5. Save the JSON file to your project directory

  6. Configure mcp_settings.json:

    {
      "firebase-mcp": {
        "command": "node",
        "args": [
          "/path/to/mcp-server-firebase/dist/index.js"
        ],
        "env": {
          "SERVICE_ACCOUNT_KEY_PATH": "/path/to/serviceAccountKey.json"
        }
      }
    }
    Replace /path/to/mcp-server-firebase with the actual path where you cloned the repository. Replace /path/to/serviceAccountKey.json with the path to your service account key file.

Available APIs

Authentication

  • Get user by ID or email

Firestore

  • Add/update/delete documents
  • List collections/documents

Storage

  • List files in a directory
  • Get File metadata and Download URL

License

  • MIT License
[
  {
    "description": "Add a document to a Firestore collection",
    "inputSchema": {
      "properties": {
        "collection": {
          "description": "Collection name",
          "type": "string"
        },
        "data": {
          "description": "Document data",
          "type": "object"
        }
      },
      "required": [
        "collection",
        "data"
      ],
      "type": "object"
    },
    "name": "firestore_add_document"
  },
  {
    "description": "List collections in Firestore. If documentPath is provided, returns subcollections under that document; otherwise returns root collections.",
    "inputSchema": {
      "properties": {
        "documentPath": {
          "description": "Optional parent document path",
          "type": "string"
        },
        "limit": {
          "default": 20,
          "description": "Number of collections to return",
          "type": "number"
        },
        "pageToken": {
          "description": "Token for pagination to get the next page of results",
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "name": "firestore_list_collections"
  },
  {
    "description": "List documents from a Firestore collection with optional filtering",
    "inputSchema": {
      "properties": {
        "collection": {
          "description": "Collection name",
          "type": "string"
        },
        "filters": {
          "description": "Array of filter conditions",
          "items": {
            "properties": {
              "field": {
                "description": "Field name to filter",
                "type": "string"
              },
              "operator": {
                "description": "Comparison operator",
                "type": "string"
              },
              "value": {
                "description": "Value to compare against (use ISO format for dates)",
                "type": "any"
              }
            },
            "required": [
              "field",
              "operator",
              "value"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "limit": {
          "default": 20,
          "description": "Number of documents to return",
          "type": "number"
        },
        "pageToken": {
          "description": "Token for pagination to get the next page of results",
          "type": "string"
        }
      },
      "required": [
        "collection"
      ],
      "type": "object"
    },
    "name": "firestore_list_documents"
  },
  {
    "description": "Get a document from a Firestore collection",
    "inputSchema": {
      "properties": {
        "collection": {
          "description": "Collection name",
          "type": "string"
        },
        "id": {
          "description": "Document ID",
          "type": "string"
        }
      },
      "required": [
        "collection",
        "id"
      ],
      "type": "object"
    },
    "name": "firestore_get_document"
  },
  {
    "description": "Update a document in a Firestore collection",
    "inputSchema": {
      "properties": {
        "collection": {
          "description": "Collection name",
          "type": "string"
        },
        "data": {
          "description": "Updated document data",
          "type": "object"
        },
        "id": {
          "description": "Document ID",
          "type": "string"
        }
      },
      "required": [
        "collection",
        "id",
        "data"
      ],
      "type": "object"
    },
    "name": "firestore_update_document"
  },
  {
    "description": "Delete a document from a Firestore collection",
    "inputSchema": {
      "properties": {
        "collection": {
          "description": "Collection name",
          "type": "string"
        },
        "id": {
          "description": "Document ID",
          "type": "string"
        }
      },
      "required": [
        "collection",
        "id"
      ],
      "type": "object"
    },
    "name": "firestore_delete_document"
  },
  {
    "description": "Get a user by ID or email from Firebase Authentication",
    "inputSchema": {
      "properties": {
        "identifier": {
          "description": "User ID or email address",
          "type": "string"
        }
      },
      "required": [
        "identifier"
      ],
      "type": "object"
    },
    "name": "auth_get_user"
  },
  {
    "description": "List files in a given path in Firebase Storage",
    "inputSchema": {
      "properties": {
        "directoryPath": {
          "description": "The optional path to list files from. If not provided, the root is used.",
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "name": "storage_list_files"
  },
  {
    "description": "Get file information including metadata and download URL",
    "inputSchema": {
      "properties": {
        "filePath": {
          "description": "The path of the file to get information for",
          "type": "string"
        }
      },
      "required": [
        "filePath"
      ],
      "type": "object"
    },
    "name": "storage_get_file_info"
  }
]