How to Connect Firebase to an AI Agent
Auth setup
1. Create a service account in Google Cloud Console > IAM & Admin > Service Accounts. 2. Download the JSON key and set GOOGLE_APPLICATION_CREDENTIALS. 3. Run `firebase login` for interactive use. 4. For MCP: `npx firebase-tools experimental:mcp` uses the current gcloud auth context.
Key facts
| Base URL | https://firebase.googleapis.com/v1beta1/ |
| API version | v1beta1 (management) + product APIs (Firestore, Auth, etc.) |
| Auth | Google OAuth 2.0 with service account or user credentials. Service accounts use JWT-based access tokens (ADC). Admin SDK is preferred for server-side agent use. For MCP, the `firebase-tools experimental:mcp` command uses existing gcloud credentials. |
| Token URL | https://oauth2.googleapis.com/token |
| Scopes | https://www.googleapis.com/auth/cloud-platform (all Firebase features), or scoped per-product. |
| Request body | application/json |
| Pagination | Standard Google API pagination: `pageSize` and `pageToken` query params; response has `nextPageToken`. |
| Rate limit | Firestore: 500 writes/sec per database baseline; reads are effectively unmetered. Auth: 3,000 requests/min. Management API: 600 req/min per project. 429 or 403 quotaExceeded errors on overload. |
| Error format | Google RPC error format: {"error":{"code":403,"message":"...","status":"PERMISSION_DENIED","details":[...]}} |
Key endpoints
| Method | Path | Description |
GET | /projects/{projectId} | Get project metadata |
GET | /projects/{projectId}/databases | List Firestore databases |
POST | /projects/{projectId}/databases/{dbId}/documents:runQuery | Run a structured Firestore query |
GET | /projects/{projectId}/webApps | List web apps registered under the project |
POST | /projects/{projectId}/rules:deploy | Deploy new security rules |
Quickstart
GET https://firebase.googleapis.com/v1beta1/projects/my-project
Authorization: Bearer {access_token}
Response: {"projectId":"my-project","displayName":"My App","resources":{"realtimeDatabaseInstance":"..."}}
Agent pitfalls & tips
- The Firebase REST Management API only manages project metadata โ for actual data ops use Firestore REST (/v1/projects/{p}/databases/{db}/documents).
- Always prefer the Admin SDK over REST on the server side โ it handles token refresh and connection pooling.
- Security rules are deployed separately from data โ an agent that writes "correctly" may still hit PERMISSION_DENIED if rules are strict.
- Firestore indexes must be created (or inferred) before composite queries work โ errors return with a URL to create the missing index.
- Running `firebase-tools experimental:mcp` exposes project, hosting, functions, and Firestore tooling to an agent with low setup cost.
Source: curated by KanseiLink from official documentation (docs) and registry checks. Last reviewed: 2026-04-10. Specs change โ verify against the official docs before production use.
Frequently Asked Questions
What is Firebase's AEO score?
โผ
Firebase has an AEO score of 0.60 and is rated BBB (Basic agent connectivity available). AEO (Agent Engine Optimization) measures how well a SaaS service works with AI agents. Scores range from 0.00 to 1.00, with grades from AAA (best) to D (not agent-ready).
Is Firebase AI-agent-ready?
โผ
Firebase is currently connectable for AI agent use. Third-party MCP integrations are available for this service. For detailed connection guides, auth setup, and known pitfalls, use the KanseiLink MCP tool.
How does Firebase compare to other Database services?
โผ
In the Database category, Firebase is rated BBB. KanseiLink evaluates services based on MCP availability, API quality, documentation, auth-guide clarity, and integration recipe availability (methodology published). Visit the full rankings at kansei-link.com to see how Firebase compares.
How can I integrate Firebase with an AI agent?
โผ
The fastest way to integrate Firebase with an AI agent is through KanseiLink MCP. Install it with: npx @kansei-link/mcp-server โ then use the search_services and get_service_detail tools to get the current auth setup, endpoints, rate limits, and agent-specific tips. This data is kept fresh from registry checks, curated official-doc guides, and agent reports.
How do I authenticate with Firebase?
โผ
Google OAuth 2.0 with service account or user credentials. Service accounts use JWT-based access tokens (ADC). Admin SDK is preferred for server-side agent use. For MCP, the `firebase-tools experimental:mcp` command uses existing gcloud credentials. Setup: 1. Create a service account in Google Cloud Console > IAM & Admin > Service Accounts. 2. Download the JSON key and set GOOGLE_APPLICATION_CREDENTIALS. 3. Run `firebase login` for interactive use. 4. For MCP: `npx firebase-tools experimental:mcp` uses the current gcloud auth context.
What are Firebase's API rate limits?
โผ
Firestore: 500 writes/sec per database baseline; reads are effectively unmetered. Auth: 3,000 requests/min. Management API: 600 req/min per project. 429 or 403 quotaExceeded errors on overload.