firebase-hosting-mcp-server
v1.0.1
Published
MCP server for deploying and managing Firebase Hosting projects. Works with Claude Code, Codex, Gemini CLI, and any MCP-compatible client.
Maintainers
Readme
🔥 Firebase Hosting MCP Server
Deploy and manage Firebase Hosting projects from any MCP-compatible AI client — Claude Code, Codex, Gemini CLI, Cursor, Windsurf, and more.
Stop repeating the same deploy steps. Let your AI assistant handle Firebase Hosting for you.
Features
| Tool | Description |
|------|-------------|
| firebase_hosting_init | Scaffold hosting config with auto-framework detection |
| firebase_hosting_deploy | Build & deploy to production in one command |
| firebase_hosting_preview | Deploy preview channels for PR reviews & demos |
| firebase_hosting_harden | Apply production-grade security headers in one shot |
| firebase_hosting_status | View releases, channels, and config at a glance |
| firebase_hosting_rollback | Roll back to a previous release instantly |
| firebase_hosting_configure | Modify firebase.json (rewrites, headers, redirects...) |
| firebase_hosting_delete_channel | Clean up preview channels |
Auto-detects React, Vue, Vite, Next.js, Nuxt, Angular, Svelte, and Astro — sets the correct public dir, SPA rewrites, and cache headers automatically.
Prerequisites
- Node.js ≥ 18
- Firebase CLI installed and authenticated:
npm install -g firebase-tools firebase login - DjioniDev API key — get yours at djioni.dev
Installation
npm install -g firebase-hosting-mcp-serverOr run directly with npx:
npx firebase-hosting-mcp-serverConfiguration
Claude Code
claude mcp add firebase-hosting -- npx firebase-hosting-mcp-serverThen set your API key:
export DJIONI_API_KEY="your-api-key"Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"firebase-hosting": {
"command": "npx",
"args": ["firebase-hosting-mcp-server"],
"env": {
"DJIONI_API_KEY": "your-api-key"
}
}
}
}Cursor / Windsurf
Add to your MCP settings (.cursor/mcp.json or equivalent):
{
"mcpServers": {
"firebase-hosting": {
"command": "npx",
"args": ["firebase-hosting-mcp-server"],
"env": {
"DJIONI_API_KEY": "your-api-key"
}
}
}
}Codex / Gemini CLI / Other MCP Clients
Any client supporting the MCP stdio transport can use this server:
DJIONI_API_KEY="your-api-key" npx firebase-hosting-mcp-serverUsage Examples
Initialize a project
"Initialize Firebase Hosting for my React app in /Users/me/my-app with project ID my-app-prod"
The MCP will auto-detect React, set build/ as the public dir, enable SPA rewrites, and configure optimized cache headers.
Deploy to production
"Deploy my app to Firebase Hosting"
Builds the project, deploys, and returns the live URL.
Create a preview for a PR
"Deploy a preview channel called pr-42 for my app"
Creates a shareable URL like https://my-app--pr-42.web.app that expires in 7 days.
Check status
"What's the current status of my Firebase Hosting?"
Shows releases, preview channels, config summary, and auth info.
Rollback
"Roll back my Firebase Hosting to the previous release"
Instantly reverts to the last working version.
Add a redirect
"Add a redirect from /old-page to /new-page in my Firebase config"
Modifies firebase.json without touching anything else.
Harden security headers
"Harden the security headers on my Firebase Hosting"
Applies 9 production-grade security headers (CSP, HSTS, X-Frame-Options, Permissions-Policy, etc.) to firebase.json. Works with the standard preset for 95% of apps.
If your app uses external APIs or scripts, just tell it:
"Harden security with csp_connect_src pointing to https://api.myapp.com"
Use dry_run to preview before applying:
"Harden security with dry_run so I can see what changes"
Re-deploy after hardening to push headers live.
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| DJIONI_API_KEY | ✅ | Your DjioniDev API key |
| DJIONI_LICENSE_API_URL | ❌ | Custom license API URL (default: Cloud Run backend) |
| FIREBASE_HOSTING_MCP_KEY | ❌ | Alternative env var for the API key |
How It Works
This MCP server wraps the Firebase CLI (firebase-tools) and exposes it through the Model Context Protocol. Under the hood:
- License verification — before each tool call, verifies your API key via
POST /v1/license/verify(checks key validity, scope, and deploy quota) - Framework detection — reads
package.jsonto identify your stack - Smart config — generates optimized
firebase.jsonwith proper cache headers, SPA rewrites, and clean URLs - CLI wrapper — executes
firebase deploy,hosting:channel:deploy, etc. with--jsonfor reliable parsing - Usage tracking — after successful deploys, records usage via
POST /v1/license/usage(fire-and-forget, won't block your deploy)
Billable vs Free actions
| Billable (counts against quota) | Free |
|---|---|
| firebase_hosting_deploy | firebase_hosting_init |
| firebase_hosting_preview | firebase_hosting_status |
| | firebase_hosting_configure |
| | firebase_hosting_harden |
| | firebase_hosting_rollback |
| | firebase_hosting_delete_channel |
Key scoping
Your API key must have firebase-hosting-mcp in its scopes (or empty scopes = access to all DjioniDev products). This is configured when the key is created in the DjioniDev License API.
License
MIT — Built by DjioniDev
