home / mcp / django firebase mcp server

Django Firebase MCP Server

A production-ready Django app implementing Firebase Model Context Protocol (MCP) server with 14 Firebase tools for AI agents. Features standalone agent, HTTP/stdio transport, LangChain integration, and complete Firebase service coverage (Auth, Firestore, Storage).

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "highpolar-softwares-django-firebase-mcp": {
      "url": "http://127.0.0.1:8001/mcp",
      "headers": {
        "DEBUG": "True",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8001",
        "MCP_TRANSPORT": "http",
        "FIREBASE_STORAGE_BUCKET": "your-project.appspot.com",
        "SERVICE_ACCOUNT_KEY_PATH": "credentials.json"
      }
    }
  }
}

You have a Django-based MCP server that exposes Firebase services (Authentication, Firestore, and Cloud Storage) through a standardized MCP interface. It lets you manage Firebase resources via AI agents and MCP clients, with both quick-start standalone usage and full Django integration for production-like setups.

How to use

Start with the MCP server to expose Firebase capabilities to your AI agents. You can run a lightweight HTTP endpoint for MCP clients or operate in stdio mode for local, agent-to-agent communication. Once the server is running, you can issue MCP requests to list, query, or modify Firebase resources such as users, documents, and storage files. Use the stand-alone agent for quick testing, then switch to the Django-based MCP server for full integration.

How to install

Follow these concrete steps to install and start using the MCP server in a Django environment.

# Prerequisites
Python 3.11+
Firebase project with Admin SDK
Git (optional)
Redis (optional, for persistent state management)

# 1. Clone the project
git clone https://github.com/your-repo/django-firebase-mcp.git
cd django-firebase-mcp

# 2. Install dependencies
pip install -r requirements.txt

# 3. Firebase setup - place credentials in project root as credentials.json
# Obtain credentials.json from Firebase Console > Project Settings > Service Accounts > Generate private key

# 4. Environment configuration - create a .env file with required values
# Example values (replace with your own):
SERVICE_ACCOUNT_KEY_PATH=credentials.json
FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
MCP_TRANSPORT=http
MCP_HOST=127.0.0.1
MCP_PORT=8001
DEBUG=True
SECRET_KEY=your-secret-key-here

# 5. State management choice
# A) Redis (recommended for production)
REDIS_URL=redis://localhost:6379
USE_REDIS=true

# B) InMemorySaver (for quick testing)
USE_REDIS=false

4. Run the standalone Firebase agent for quick testing (optional but convenient):

# Start the standalone Firebase agent for quick testing
python firebase_admin_mcp/standalone_firebase_agent.py

5. Run the full Django MCP server (choose one mode):

# Run MCP server via Django (HTTP/REST MCP endpoint)
python manage.py runserver 8001

# Or run MCP server in stdio mode for MCP clients
python manage.py run_mcp --transport stdio

# Or run MCP server in HTTP mode (explicit host/port)
python manage.py run_mcp --transport http --host 127.0.0.1 --port 8001

Additional setup and notes

After starting, access to the MCP endpoint is typically available at http://127.0.0.1:8001/mcp/. Use this URL for HTTP-based MCP clients. The stdio mode provides a local IPC channel suitable for tightly coupled agents.

Django migrations and superuser creation are optional but recommended for a full integration.

# Django setup (optional but recommended)
p python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 8001

Available tools

firebase_verify_token

Verify Firebase ID tokens to authenticate requests against Firebase authentication.

firebase_create_custom_token

Create custom Firebase authentication tokens for non-standard sign-in flows.

firebase_get_user

Retrieve user information by UID from Firebase Authentication.

firebase_delete_user

Delete a Firebase Authentication user by UID.

firestore_list_collections

List all Firestore collections in the project.

firestore_create_document

Create a new document in a Firestore collection.

firestore_get_document

Retrieve a Firestore document by path.

firestore_update_document

Update fields in an existing Firestore document.

firestore_delete_document

Delete a Firestore document from a collection.

firestore_query_collection

Query Firestore documents within a collection using filters.

storage_list_files

List files stored in Cloud Storage with optional filters.

storage_upload_file

Upload a file to Cloud Storage.

storage_download_file

Download a file from Cloud Storage.

storage_delete_file

Delete a file from Cloud Storage.