markhilton/firebase-logs-mcp-server
If you are the rightful owner of firebase-logs-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
An MCP server providing real-time access to Firebase emulator logs for AI-assisted debugging and development.
Firebase Logs MCP Server
An MCP (Model Context Protocol) server that provides real-time access to Firebase emulator logs for Claude Code and other MCP-compatible clients.
Overview
This MCP server enables AI assistants to read and monitor Firebase emulator logs in real-time, making it easier to debug and develop Firebase applications with AI assistance. The server reads logs from the emulator-debug.log file generated by the Firebase emulators when started with the provided script.
Prerequisites
- Node.js 18+
- Firebase CLI installed globally (
npm install -g firebase-tools) - A Firebase project with emulators configured
- Claude Code or another MCP-compatible client
Installation
From npm (recommended)
npm install -g firebase-logs-mcp-server
From source
git clone https://github.com/markhilton/firebase-logs-mcp-server.git
cd firebase-logs-mcp-server
npm install
npm run build
npm link
Important: Starting Firebase Emulators
⚠️ Critical Requirement: Firebase emulators must be started using the provided start.sh script to generate the required log file. The MCP server depends on reading from the emulator-debug.log file.
Using the start.sh script
- Copy the
start.shscript to your Firebase project root directory - Make it executable:
chmod +x start.sh - Run the script to start emulators:
./start.sh
The script will:
- Check and free required Firebase emulator ports
- Start Firebase emulators with import/export functionality
- Save all emulator output to
emulator-debug.log(required for the MCP server) - Display logs in the terminal while also saving them to the file
Why the script is required
The standard firebase emulators:start command does not automatically save logs to a file. The MCP server needs a persistent log file to read from, which is created by the start.sh script using the script command to capture all output.
Integration
Claude Code Integration
1. Install the MCP server globally
npm install -g firebase-logs-mcp-server
2. Configure Claude Code
Add the following to your Claude Code configuration file:
Location: ~/.claude/claude.json
{
"mcpServers": {
"firebase-logs": {
"command": "npx",
"args": ["firebase-logs-mcp-server"]
}
}
}
Note: By default, the server will look for emulator-debug.log in the current working directory. This works well for most projects as Claude Code operates in your project directory.
Optional: Specify a custom log path
Only add the FIREBASE_LOG_PATH environment variable if your log file is in a non-standard location:
{
"mcpServers": {
"firebase-logs": {
"command": "npx",
"args": ["firebase-logs-mcp-server"],
"env": {
"FIREBASE_LOG_PATH": "/custom/path/to/emulator-debug.log"
}
}
}
}
3. Restart Claude Code
After updating the configuration, restart Claude Code for the changes to take effect.
Claude Desktop Integration
For Claude Desktop users, add to your configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"firebase-logs": {
"command": "npx",
"args": ["firebase-logs-mcp-server"],
"env": {
"FIREBASE_LOG_PATH": "/absolute/path/to/your/project/emulator-debug.log"
}
}
}
}
Note: Claude Desktop requires an absolute path to the log file since it doesn't operate within your project directory.
Available Tools
get_firebase_logs
Retrieves recent Firebase emulator logs.
Parameters:
service(string): Filter logs by service -"firestore","auth","functions", or"all"lines(number): Number of recent log lines to retrieve (default: 50)
Example usage in Claude:
"Get the last 100 lines of Firestore logs"
"Show me recent authentication errors"
"What's happening in the Functions emulator?"
watch_firebase_logs
Starts watching Firebase logs in real-time (currently in development).
Example usage in Claude:
"Watch the Firebase logs for errors"
"Monitor Firestore operations in real-time"
Resources
The server also provides resources for:
- Current emulator status
- Log file statistics
- Configuration information
Development
Building from source
npm install
npm run build
Running in development mode
npm run dev
Testing locally
- Start Firebase emulators using the
start.shscript - Run the MCP server:
FIREBASE_LOG_PATH=./emulator-debug.log npm start
Troubleshooting
"Log file not found" error
Ensure that:
- Firebase emulators are running using the
start.shscript - The
FIREBASE_LOG_PATHenvironment variable points to the correct location - The
emulator-debug.logfile exists in your Firebase project directory
Port conflicts
The start.sh script automatically handles port conflicts by:
- Checking all required Firebase emulator ports
- Killing processes using those ports
- Verifying ports are free before starting emulators
Claude Code doesn't see the server
- Verify the server is installed globally:
npm list -g firebase-logs-mcp-server - Check the Claude Code configuration file (
~/.claude/claude.json) for syntax errors - If using
FIREBASE_LOG_PATH, ensure it's an absolute path for Claude Desktop, or relative to your project for Claude Code - Restart Claude Code after configuration changes
Environment Variables
FIREBASE_LOG_PATH: Path to the Firebase emulator log file (default:./emulator-debug.login the current working directory)- Claude Code: Usually not needed - defaults to your project directory
- Claude Desktop: Required - must be an absolute path to the log file
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Support
For issues and questions, please open an issue on GitHub.