Retrieves a document from Firestore by its path
Creates or updates a document in Firestore
Updates fields in an existing Firestore document
Deletes a document from Firestore
Queries documents in a Firestore collection
Lists all collections in Firestore or subcollections of a document
Uploads a file to Firebase Storage
Downloads a file from Firebase Storage
Lists files in a Firebase Storage directory
Deletes a file from Firebase Storage
Signs in a user with email and password
Creates a new user account
Signs out the current user
Gets the currently authenticated user
Firebase MCP provides AI assistants with direct access to Firebase's powerful suite of cloud services. It enables seamless interaction with Firestore for document database operations, Storage for file management, and Authentication for user management, all through a standardized protocol. This integration allows AI systems to leverage Firebase's scalable infrastructure while maintaining security and proper access controls.
Firebase MCP is a Model Context Protocol server that enables AI assistants to interact directly with Firebase services. This integration allows AI systems to perform operations on Firestore databases, manage files in Firebase Storage, and handle user authentication, all while maintaining proper security controls.
npm install @gannonh/firebase-mcp
// firebase-config.js
export const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-project-id.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project-id.appspot.com",
messagingSenderId: "your-messaging-sender-id",
appId: "your-app-id"
};
// server.js
import { startServer } from '@gannonh/firebase-mcp';
import { firebaseConfig } from './firebase-config.js';
startServer({
port: 3000,
firebaseConfig
});
node server.js
Alternatively, you can use Docker:
FROM node:16
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
docker build -t firebase-mcp .
docker run -p 3000:3000 firebase-mcp
Ensure your Firebase security rules are properly configured to control access to your data. The MCP server will respect these rules when performing operations.
For Firestore:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
For Storage:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
You can also use environment variables for configuration:
FIREBASE_API_KEY=your-api-key
FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id
FIREBASE_APP_ID=your-app-id
MCP_SERVER_PORT=3000
Once your server is running, AI assistants can interact with your Firebase services through the MCP protocol. The server provides tools for:
Firestore Operations: Create, read, update, and delete documents, query collections, and manage subcollections.
Storage Operations: Upload, download, list, and delete files in Firebase Storage.
Authentication: Manage user authentication, including sign-in, sign-up, and user profile management.
firestore_list_collections
tool, Firebase SDK may output console logs to stdio during the operation. This is a known behavior of the Firebase SDK.To update to the latest version:
npm update @gannonh/firebase-mcp
Check the CHANGELOG.md file for details on new features, bug fixes, and breaking changes in each release.