-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add MCP init prompt for Firestore and AI Logic #9177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
127abc0
cc543ec
90ea84c
a937bea
8d51f85
00d7434
b8321d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { resource } from "../../resource"; | ||
|
||
export const init_auth = resource( | ||
{ | ||
uri: "firebase://guides/init/auth", | ||
name: "auth_init_guide", | ||
title: "Firebase Authentication Init Guide", | ||
description: | ||
"guides the coding agent through configuring Firebase Authentication in the current project", | ||
}, | ||
async (uri) => { | ||
return { | ||
contents: [ | ||
{ | ||
uri, | ||
type: "text", | ||
text: ` | ||
### Configure Firebase Authentication | ||
|
||
- **Permission Required**: Request developer permission before implementing authentication features | ||
- **Provider Setup**: Guide developers to enable authentication providers (Email/Password, Google Sign-in, etc.) in the [Firebase Auth Console](https://console.firebase.google.com/). Ask developers to confirm which authentication method they selected before proceeding to implementation. | ||
- **Implementation**: Create sign-up and login pages using Firebase Authentication. | ||
- **Security Rules**: Update Firestore security rules to ensure only authenticated users can access their own data | ||
- **Testing**: Recommend developers test the complete sign-up and sign-in flow to verify authentication functionality | ||
- **Next Steps**: Recommend deploying the application to production once authentication is verified and working properly | ||
`.trim(), | ||
}, | ||
], | ||
}; | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,16 @@ export const init_firestore = resource( | |
uri, | ||
type: "text", | ||
text: ` | ||
Create a file called \`firestore.ts\`: | ||
### Setup Firestore Database | ||
|
||
\`\`\`ts | ||
import { initializeApp } from "firebase/app"; | ||
import { getFirestore } from "firebase/firestore"; | ||
|
||
const app = initializeApp({...}); | ||
const db = getFirestore(app); | ||
\`\`\` | ||
- Set up Firebase Firestore as the primary database for the application | ||
- Implement client code for basic CRUD operations for the application | ||
- **Important**: Use the \`firebase deploy\` command to provision the database automatically. **Do not ask developers to go to the console to do it**. | ||
- **Environment**: Use production environment directly - avoid emulator for initial setup | ||
- **Verification**: Guide developers to verify database creation at the [Firebase Console](https://console.firebase.google.com/) by clicking on the "Firestore Database" tab in the left navigation to confirm the database is created. | ||
- **Testing**: Recommend developers test their application and verify data appears correctly in the console. Ask developers to confirm they can see their test data in the console before proceeding to the next step. | ||
- **Security**: Recommend implementing authentication if the application handles sensitive user data. Guide users to navigate to the "Firestore Database" section and click on the "Rules" tab to view and configure their security rules. | ||
- **Security Warning**: Alert developers against making Firestore security rules public (allowing read/write without authentication) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for later: there's a really thorough prompt in studio about how to make secure rules - we might want to pull that into here as another guide, and link the AI to it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'm hoping to bring that in and add a bunch more rules tooling soon |
||
`.trim(), | ||
}, | ||
], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { resource } from "../../resource"; | ||
|
||
export const init_hosting = resource( | ||
{ | ||
uri: "firebase://guides/init/hosting", | ||
name: "hosting_init_guide", | ||
title: "Firebase Hosting Deployment Guide", | ||
description: | ||
"guides the coding agent through deploying to Firebase Hosting in the current project", | ||
}, | ||
async (uri) => { | ||
return { | ||
contents: [ | ||
{ | ||
uri, | ||
type: "text", | ||
text: ` | ||
### Configure Firebase Hosting | ||
- Introduce Firebase Hosting when developers are ready to deploy their application to production | ||
- **Alternative**: Developers can deploy later using the \`/deploy\` command | ||
- **Permission Required**: Request developer permission before implementing Firebase Hosting | ||
- **Deployment**: Configure Firebase Hosting and deploy the application to production | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nonblocking note for later - does this actually work? Seems like we'd want more explicit instructions on how to do this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my thought too. We're starting with Charlotte's prompts for now, but we'll likely iterate on this. Surprisingly this works decently well |
||
`.trim(), | ||
}, | ||
], | ||
}; | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import { init_ai } from "./guides/init_ai"; | ||
import { init_auth } from "./guides/init_auth"; | ||
import { init_backend } from "./guides/init_backend"; | ||
import { init_data_connect } from "./guides/init_data_connect"; | ||
import { init_firestore } from "./guides/init_firestore"; | ||
import { init_hosting } from "./guides/init_hosting"; | ||
import { init_rtdb } from "./guides/init_rtdb"; | ||
|
||
export const resources = [init_backend, init_ai, init_data_connect, init_firestore, init_rtdb]; | ||
export const resources = [ | ||
init_backend, | ||
init_ai, | ||
init_data_connect, | ||
init_firestore, | ||
init_rtdb, | ||
init_auth, | ||
init_hosting, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonblocking thing to test: should this instead tell the AI to run the init MCP tool with Firestore, Auth, and Hosting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh hadn't seen that tool - let me check that out in a follow up