# Firebase MCP

> Firebase REST & Admin APIs allows you to manage your backend data and user accounts directly from your AI agent. Use this MCP to query Realtime Database and Firestore, sign up users, look up profiles, and send notifications using natural language commands.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** firebase, nosql, realtime-database, firestore, authentication, fcm, backend-as-a-service

## Description

This connector gives your AI agent direct access to the core services powering a Firebase project. Instead of opening multiple developer consoles or writing boilerplate API calls, you tell your agent what needs fixing or checking. It handles reads and writes across both Cloud Firestore and Realtime Database structures. Need to verify if a user exists? Ask for it. Want to push out an announcement? Send the message directly. This gives you complete control over authentication, data storage, and messaging—all without leaving your primary workflow. Vinkius hosts this MCP so you can connect it once from any compatible client and access all these backend tools instantly.

## Tools

### auth_lookup
Gets the profile details for a known Firebase Auth user.

### auth_sign_in
Signs in a user using their email and password credentials.

### auth_sign_up
Creates an account for a new user or signs them in anonymously.

### fcm_send_message
Sends a push message to specific devices or topics via Firebase Cloud Messaging.

### firestore_create_doc
Creates a brand new document in the specified Cloud Firestore collection.

### firestore_delete_doc
Deletes an entire document from Cloud Firestore.

### firestore_get_doc
Retrieves the data for a single, specific document in Cloud Firestore.

### firestore_list_docs
Lists all documents currently present within a defined Firestore collection.

### firestore_patch_doc
Updates or inserts changes into an existing document in Cloud Firestore.

### rtdb_delete
Deletes a section of data from the Firebase Realtime Database.

### rtdb_get
Reads and retrieves all data stored at a specific path in the Realtime Database.

### rtdb_patch
Updates only specific pieces of data inside the Realtime Database structure.

### rtdb_push
Adds new data entries to a list or array within the Realtime Database.

### rtdb_put
Writes and overwrites all existing data at a specific path in the Realtime Database.

## Prompt Examples

**Prompt:** 
```
Get the data at path 'configs/app_settings' from the Realtime Database.
```

**Response:** 
```
I've retrieved the settings from 'configs/app_settings'. The current configuration includes `maintenance_mode: false`, `min_version: '2.1.0'`, and `theme: 'dark'`. Would you like to update any of these values?
```

**Prompt:** 
```
List all documents in the 'products' collection in Firestore.
```

**Response:** 
```
I found 3 documents in the 'products' collection: 'laptop_pro_15', 'wireless_mouse_x', and 'usb_c_hub'. Would you like to see the full details for any of these products?
```

**Prompt:** 
```
Sign up a new user with email 'dev-test@example.com' and password 'SecretPass123'.
```

**Response:** 
```
The user has been successfully created. The new UID is `abc123xyz`. I've also received an ID token for this session. Should I look up the profile details for this new account?
```

## Capabilities

### Check user accounts
Look up existing user profiles or sign in new users using credentials.

### Manage structured data (Firestore)
List, retrieve, and update entire collections of documents in Cloud Firestore.

### Manipulate JSON data (RTDB)
Perform full read/write operations on complex, nested JSON structures within the Realtime Database.

### Send notifications
Push targeted messages to specific devices or user groups using Firebase Cloud Messaging.

## Use Cases

### A Product Manager needs live user stats.
The PM asks the AI client to list all documents in the 'user_metrics' collection. The agent runs `firestore_list_docs`, showing the latest activity counts immediately, letting them verify if a recent feature rollout worked.

### A DevOps engineer needs to clean up old data.
The engineer realizes that user session logs are accumulating garbage. They ask the agent to delete all documents older than 90 days from the 'logs' collection using `firestore_delete_doc`.

### A Backend Developer needs to test a new feature flow.
The developer simulates a user signing in with `auth_sign_in`, and then immediately uses `rtdb_put` to write the temporary session data to the Realtime Database for testing purposes.

### A Support Agent needs to notify all affected users.
The agent confirms a service outage, then instructs the AI client to send an urgent alert using `fcm_send_message` to all targeted devices or topics across the user base.

## Benefits

- Debugging is faster. Instead of opening the console to check if a user exists, you simply ask your agent to run `auth_lookup` and get the profile details immediately.
- Data updates are instant. Need to fix a setting? Use `firestore_patch_doc` or `rtdb_patch` to update specific fields right away, eliminating manual dashboard access.
- Automation is simple. You can trigger complex sequences, like signing up a user with `auth_sign_up`, and then immediately sending them an onboarding message via `fcm_send_message`—all in one prompt.
- View everything at once. Want to see what data lives in your app? Use `firestore_list_docs` or `rtdb_get` to inspect entire collections or paths instantly for status checks.
- Complex state management is easier. You don't have to worry about cross-platform tool calls; the agent handles coordinating actions across Firestore, RTDB, and Auth services for you.

## How It Works

The bottom line is you get to manage complex backends using conversation, not console clicks.

1. Subscribe to this MCP and supply your specific Firebase Project ID and Web API Key.
2. Your AI client sends a natural language request, telling the agent what data needs reading or writing.
3. The agent executes the correct tool call (e.g., `firestore_get_doc`) against your live backend data and returns the result.

## Frequently Asked Questions

**How do I check if a user exists using auth_lookup?**
You provide the necessary unique ID to the agent, and it runs `auth_lookup` against Firebase Auth. It returns the profile data or an error if the account isn't found.

**Can I update a document in Firestore without losing other fields?**
Yes, you use `firestore_patch_doc`. This tool specifically modifies only the fields you name, leaving all other data intact. It prevents accidental overwrites.

**What is the difference between rtdb_put and rtdb_patch?**
`rtdb_put` overwrites everything at a given path; it's like replacing the entire file. `rtdb_patch`, however, only updates specific children within that data structure.

**How do I send a message to all users?**
You use `fcm_send_message`. You specify the target topic or device list in your prompt, and the agent handles sending the notification payload through Firebase Cloud Messaging.

**After running `auth_sign_up`, how do I retrieve the new user's profile data using `auth_lookup`?**
The `auth_lookup` tool immediately fetches the profile details associated with a specific User ID (UID). You provide the UID, and the agent returns all stored profile information. This lets you verify the account creation status or pull existing metadata without needing to re-authenticate.

**If I need to check for multiple records in a collection, should I use `firestore_list_docs` instead of repeatedly calling `firestore_get_doc`?**
Yes. Use `firestore_list_docs` when you want an overview of all documents within a whole collection; it returns IDs and basic data structure information for multiple records at once. You must use `firestore_get_doc` only if you already know the exact document ID you need to read.

**When deleting sensitive data, is there a functional difference between using `rtdb_delete` and `firestore_delete_doc`?**
They target different database structures. `rtdb_delete` handles entire JSON paths in the Realtime Database, while `firestore_delete_doc` removes a single document from Cloud Firestore. Choose the tool based on whether your data lives in Firestore or RTDB.

**Before I start executing database commands, what core credentials must I provide to make this MCP functional?**
You must subscribe and input your Firebase Project ID and Web API Key. These two pieces of information grant the agent access rights to interact with your Realtime Database, Firestore, and Auth services.

**Can I read data from a specific path in the Realtime Database?**
Yes. Use the `rtdb_get` tool and provide the database path (e.g., 'users/jack/profile'). You can also set the `shallow` parameter to true if you only want to see the keys at that level.

**How do I create a new document in a Firestore collection?**
Use the `firestore_create_doc` tool. Specify the `collectionPath` and provide the document data as a JSON string. If you don't provide a `documentId`, Firestore will generate one automatically.

**Can I check a user's profile information if I have their ID token?**
Absolutely. The `auth_lookup` tool allows you to retrieve full user profile data from Firebase Auth by providing a valid `idToken` obtained during sign-in.