{"id":28758927,"url":"https://github.com/raghavdasila/django-firebase-mcp","last_synced_at":"2025-06-19T07:03:14.255Z","repository":{"id":298704667,"uuid":"1000787184","full_name":"raghavdasila/django-firebase-mcp","owner":"raghavdasila","description":"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).","archived":false,"fork":false,"pushed_at":"2025-06-16T08:36:15.000Z","size":75,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-16T09:52:57.826Z","etag":null,"topics":["django","drf","firebase-admin","langchain","langgraph","mcp","model-context-protocol"],"latest_commit_sha":null,"homepage":"https://highpolar.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raghavdasila.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-12T10:16:57.000Z","updated_at":"2025-06-16T08:36:18.000Z","dependencies_parsed_at":"2025-06-16T09:52:58.793Z","dependency_job_id":null,"html_url":"https://github.com/raghavdasila/django-firebase-mcp","commit_stats":null,"previous_names":["highpolar-softwares/django-firebase-mcp","raghavdasila/django-firebase-mcp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raghavdasila/django-firebase-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavdasila%2Fdjango-firebase-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavdasila%2Fdjango-firebase-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavdasila%2Fdjango-firebase-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavdasila%2Fdjango-firebase-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raghavdasila","download_url":"https://codeload.github.com/raghavdasila/django-firebase-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavdasila%2Fdjango-firebase-mcp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260294416,"owners_count":22987618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","drf","firebase-admin","langchain","langgraph","mcp","model-context-protocol"],"created_at":"2025-06-17T05:00:30.144Z","updated_at":"2025-06-17T05:00:38.879Z","avatar_url":"https://github.com/raghavdasila.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Firebase MCP\n\nA comprehensive Django app that implements Firebase Model Context Protocol (MCP) server, enabling AI agents to interact with Firebase services through a standardized protocol.\n\n## 🚀 Quick Start\n\nGet up and running in under 5 minutes with the standalone Firebase agent for testing.\n\n### Prerequisites\n\n- Python 3.11+\n- Firebase project with Admin SDK\n- Git (optional)\n- Redis (optional, for persistent state management)\n\n### 1. Clone \u0026 Setup\n\n```bash\ngit clone https://github.com/your-repo/django-firebase-mcp.git\ncd django-firebase-mcp\n```\n\n### 2. Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 3. Firebase Setup\n\n#### Get Firebase Credentials\n\n1. Go to [Firebase Console](https://console.firebase.google.com/)\n2. Select your project (or create a new one)\n3. Navigate to **Project Settings** → **Service Accounts**\n4. Click **\"Generate new private key\"**\n5. Download the JSON file and save it as `credentials.json` in the project root\n\n#### Enable Firebase Services\n\nMake sure these services are enabled in your Firebase project:\n\n- **Authentication** (for user management)\n- **Firestore Database** (for document storage)\n- **Cloud Storage** (for file uploads)\n\n### 4. Environment Configuration\n\nCreate a `.env` file in the project root:\n\n```env\n# Firebase Configuration\nSERVICE_ACCOUNT_KEY_PATH=credentials.json\nFIREBASE_STORAGE_BUCKET=your-project-id.appspot.com\n\n# MCP Configuration\nMCP_TRANSPORT=http\nMCP_HOST=127.0.0.1\nMCP_PORT=8001\n\n# Django Settings\nDEBUG=True\nSECRET_KEY=your-secret-key-here\n```\n\n**⚠️ Important:** Replace `your-project-id` with your actual Firebase project ID.\n\n### 5. State Management Setup\n\nThe Firebase MCP agent uses state management for conversation persistence. Choose one option:\n\n#### Option A: Redis (Recommended for Production)\n\nInstall and run Redis on port 6379:\n\n```powershell\n# Install Redis using Chocolatey\nchoco install redis-64\n\n# Or download from: https://github.com/microsoftarchive/redis/releases\n# Then run Redis server\nredis-server\n```\n\nAdd to your `.env` file:\n\n```env\n# Redis Configuration\nREDIS_URL=redis://localhost:6379\nUSE_REDIS=true\n```\n\n#### Option B: InMemorySaver (Quick Testing)\n\nFor quick testing without Redis, the agent will automatically use InMemorySaver. No additional setup required.\n\nAdd to your `.env` file:\n\n```env\n# Memory-based state (no persistence)\nUSE_REDIS=false\n```\n\n**Note:** InMemorySaver doesn't persist conversations between restarts, while Redis maintains state across sessions.\n\n### 6. Quick Test with Standalone Agent\n\nTest your setup immediately with the standalone Firebase agent:\n\n```bash\n# Run the standalone agent\npython firebase_admin_mcp/standalone_firebase_agent.py\n```\n\nYou should see:\n\n```\n🔥 Firebase MCP Agent Ready!\nType 'help' for available commands, 'quit' to exit.\n\n\u003e\n```\n\nTry these commands:\n\n```\n\u003e List all Firebase collections\n\u003e Check Firebase health status\n\u003e help\n\u003e quit\n```\n\n### 7. Full Django Setup (Optional)\n\nFor full Django integration:\n\n```bash\n# Apply migrations\npython manage.py migrate\n\n# Create superuser (optional)\npython manage.py createsuperuser\n\n# Run Django development server\npython manage.py runserver 8001\n```\n\nThe MCP server will be available at: `http://127.0.0.1:8001/mcp/`\n\n## 🛠️ Management Commands\n\n### Core Commands\n\n```bash\n# Run standalone Firebase agent (quick testing)\npython firebase_admin_mcp/standalone_firebase_agent.py\n\n# Run MCP server via Django\npython manage.py runserver 8001\n\n# Run MCP server in stdio mode (for MCP clients)\npython manage.py run_mcp --transport stdio\n\n# Run MCP server in HTTP mode\npython manage.py run_mcp --transport http --host 127.0.0.1 --port 8001\n\n# Run standalone agent via Django management command\npython manage.py run_standalone_agent\n```\n\n### Testing Commands\n\n```bash\n# Test Firebase connectivity\npython firebase_admin_mcp/tests/test_firebase_connection.py\n\n# Test MCP server completeness\npython firebase_admin_mcp/tests/test_mcp_complete.py\n\n# Demo Firebase agent\npython firebase_admin_mcp/tests/demo_firebase_agent.py\n\n# Demo standalone agent\npython firebase_admin_mcp/demo_standalone_agent.py\n```\n\n## 🔧 Available Tools\n\nThe MCP server provides **14 Firebase tools** across three categories:\n\n### 🔐 Authentication (4 tools)\n\n- `firebase_verify_token` - Verify Firebase ID tokens\n- `firebase_create_custom_token` - Create custom auth tokens\n- `firebase_get_user` - Get user info by UID\n- `firebase_delete_user` - Delete user accounts\n\n### 📚 Firestore Database (6 tools)\n\n- `firestore_list_collections` - List all collections\n- `firestore_create_document` - Create new documents\n- `firestore_get_document` - Retrieve documents\n- `firestore_update_document` - Update documents\n- `firestore_delete_document` - Delete documents\n- `firestore_query_collection` - Query with filters\n\n### 🗄️ Cloud Storage (4 tools)\n\n- `storage_list_files` - List files with filtering\n- `storage_upload_file` - Upload files\n- `storage_download_file` - Download files\n- `storage_delete_file` - Delete files\n\n## 🧪 Quick Testing\n\n### Test Server Health\n\n```bash\ncurl http://127.0.0.1:8001/mcp/\n```\n\n### Test a Firebase Tool\n\n```bash\ncurl -X POST http://127.0.0.1:8001/mcp/ \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"firestore_list_collections\",\n      \"arguments\": {}\n    },\n    \"id\": 1\n  }'\n```\n\n## 🤖 AI Agent Integration\n\n### LangChain Example\n\n```python\nfrom langchain_openai import ChatOpenAI\nfrom langgraph.prebuilt import create_react_agent\n\n# Import Firebase tools\nfrom firebase_admin_mcp.tools.agents.firebase_mcp_client import ALL_FIREBASE_TOOLS\n\n# Create agent with Firebase capabilities\nmodel = ChatOpenAI(model=\"gpt-4\")\nagent = create_react_agent(\n    model=model,\n    tools=ALL_FIREBASE_TOOLS,\n    prompt=\"You are a Firebase assistant with full database and storage access.\"\n)\n\n# Use the agent\nresponse = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Show me all my Firestore collections\"}]\n})\n```\n\n## 📚 Documentation\n\nThis project includes comprehensive documentation:\n\n- **[FIREBASE_ADMIN_MCP.md](FIREBASE_ADMIN_MCP.md)** - Complete technical documentation\n\n  - Detailed API reference\n  - All tool specifications\n  - Advanced configuration\n  - Security considerations\n  - Production deployment guide\n\n- **[STANDALONE_AGENT.md](STANDALONE_AGENT.md)** - Standalone agent documentation\n  - Self-contained Firebase agent\n  - Complete feature overview\n  - Usage examples\n  - Integration patterns\n\n## 🔧 Troubleshooting\n\n### Common Issues\n\n**Problem:** `Default app does not exist` error\n**Solution:** Verify `credentials.json` path in `.env` file\n\n**Problem:** Server won't start\n**Solution:** Check if port 8001 is available: `netstat -an | findstr :8001`\n\n**Problem:** Firebase connection fails\n**Solution:** Verify Firebase services are enabled in console\n\n**Problem:** Import errors\n**Solution:** Ensure all dependencies installed: `pip install -r requirements.txt`\n\n**Problem:** Redis connection fails\n**Solution:** Verify Redis is running: `redis-cli ping` (should return \"PONG\")\n\n**Problem:** State not persisting between sessions\n**Solution:** Check Redis configuration or switch to Redis from InMemorySaver\n\n## 🎯 What's Next?\n\n1. **Explore the Standalone Agent** - Perfect for quick testing and demos\n2. **Read the Full Documentation** - See FIREBASE_ADMIN_MCP.md for complete details\n3. **Integrate with Your AI Agents** - Use the MCP tools in your applications\n4. **Customize for Your Needs** - Extend with additional Firebase operations\n\n## 📝 Project Structure\n\n```\ndjango-firebase-mcp/\n├── README.md                          # This file\n├── FIREBASE_ADMIN_MCP.md             # Complete documentation\n├── STANDALONE_AGENT.md               # Standalone agent guide\n├── requirements.txt                   # Python dependencies\n├── credentials.json                   # Firebase credentials (you create this)\n├── .env                              # Environment variables (you create this)\n├── manage.py                         # Django management\n├── firebase_admin_mcp/               # Main MCP app\n│   ├── standalone_firebase_agent.py  # Standalone agent\n│   ├── tools/                        # Firebase MCP tools\n│   ├── management/commands/          # Django commands\n│   └── tests/                        # Test suite\n└── django_firebase_mcp/             # Django project settings\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Test your changes\n4. Submit a pull request\n\n## 📄 License\n\nMIT License - see LICENSE file for details.\n\n---\n\n**🔥 Ready to supercharge your AI agents with Firebase?**\n\nStart with the standalone agent, then explore the full documentation for advanced usage!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavdasila%2Fdjango-firebase-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraghavdasila%2Fdjango-firebase-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavdasila%2Fdjango-firebase-mcp/lists"}