Google Cloud Firestore MCP Server

1.1.2 · active · verified Wed Apr 22

MCP FirestoreDB is a Node.js-based server that implements the Model Context Protocol (MCP) for Google Cloud Firestore operations. Currently at version 1.1.2, this package provides a robust set of 17 specialized tools, including document CRUD, batch operations, collection management, and advanced index configuration and analysis. It acts as an intermediary, enabling MCP-compatible clients (such as AI agents like Claude Desktop or Cursor IDE) to interact with Firestore databases via a standardized protocol. Key differentiators include its adherence to the MCP standard, comprehensive tooling for common and complex Firestore tasks (e.g., schema analysis, index generation), and capabilities for real-time operations, advanced querying, and high-performance batch processing. The package emphasizes production readiness with robust error handling and validation, and is primarily consumed by configuring it within an MCP client environment rather than requiring direct programmatic integration of its individual tools into an application. It provides the server-side logic for managing Firestore resources.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically start the MCP FirestoreDB server, loading necessary Google Cloud credentials from environment variables. It showcases basic initialization for integration into a Node.js application.

import { startMCPServer } from 'mcpfirestoredb';
import dotenv from 'dotenv';
import path from 'path';

dotenv.config(); // Load environment variables from .env

// Ensure required environment variables are set
if (!process.env.GOOGLE_APPLICATION_CREDENTIALS) {
  console.error('Error: GOOGLE_APPLICATION_CREDENTIALS environment variable is not set. Please provide the path to your service account JSON file.');
  process.exit(1);
}
if (!process.env.FIREBASE_PROJECT_ID) {
  console.error('Error: FIREBASE_PROJECT_ID environment variable is not set. Please provide your Google Cloud Project ID.');
  process.exit(1);
}

async function runServer() {
  try {
    console.log('Starting MCP FirestoreDB Server...');
    const serverInstance = await startMCPServer({
      projectId: process.env.FIREBASE_PROJECT_ID,
      credentialsPath: process.env.GOOGLE_APPLICATION_CREDENTIALS,
      databaseId: process.env.FIRESTORE_DATABASE_ID || '(default)', // Optional
      emulatorHost: process.env.FIRESTORE_EMULATOR_HOST // Optional
    });
    console.log(`MCP FirestoreDB Server started successfully on port ${serverInstance.port || 'default'}.`);
    console.log('Ready to receive commands from MCP-compatible clients.');
  } catch (error) {
    console.error('Failed to start MCP FirestoreDB Server:', error);
    process.exit(1);
  }
}

runServer();

view raw JSON →