### Start Server Locally
Source: https://github.com/google/mcp/blob/main/examples/allstrides/README.md
Installs server dependencies, builds the Node.js/Express application, and starts the server.
```bash
cd server
npm install
npm run build
npm start
```
--------------------------------
### Repository Structure Example
Source: https://github.com/google/mcp/blob/main/_autodocs/overview.md
Illustrates the directory structure of the repository, highlighting example applications.
```bash
/examples
/allstrides - Event management platform with real-time chat
/launchmybakery - Bakery location analysis using Maps and BigQuery
/petpassport - Dog walking itinerary generator with image generation
```
--------------------------------
### Start Local Application
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Navigate to the application directory and start the application using the provided script. Ensure you are in the correct directory before execution.
```bash
cd mcp/examples/allstrides
./start_allstrides.sh
```
--------------------------------
### Command-Line Argument Example
Source: https://github.com/google/mcp/blob/main/_autodocs/configuration-and-environment.md
Example of how to run the server with a specific port using a command-line argument.
```bash
node src/index.ts --port 3000
```
--------------------------------
### Run Allstrides Frontend Development Server
Source: https://github.com/google/mcp/blob/main/_autodocs/deployment-and-infrastructure.md
Installs dependencies and starts the Allstrides frontend development server, which proxies requests to the backend. Assumes Node.js environment.
```bash
cd examples/allstrides/frontend
npm install
npm start
# Outputs: Client running on port 3000 (with proxy to backend)
```
--------------------------------
### Run Allstrides Backend Server Locally
Source: https://github.com/google/mcp/blob/main/_autodocs/deployment-and-infrastructure.md
Installs dependencies, builds, and starts the Allstrides backend server for local development. Assumes Node.js environment.
```bash
cd examples/allstrides/server
npm install
npm run build
npm run dev
# Outputs: Server running on port 8080
```
--------------------------------
### Start Gemini CLI
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Navigate to the project directory and start the Gemini CLI to verify the MCP server configurations.
```bash
cd ~/projectmcp/
gemini
```
--------------------------------
### Install and Run ADK Agent
Source: https://github.com/google/mcp/blob/main/examples/launchmybakery/README.md
Set up a Python virtual environment, activate it, install the google-adk package, and then run the ADK web interface. Ensure you are in the adk_agent directory.
```bash
# Create virtual environment
python3 -m venv .venv
# If the above fails, you may need to install python3-venv:
# apt update && apt install python3-venv
# Activate virtual environment
source .venv/bin/activate
# Install ADK
pip install google-adk==1.28.0
# Navigate to the app directory
cd adk_agent/
# Run the ADK web interface
adk web --allow_origins 'regex:https://.*\.cloudshell\.dev'
```
--------------------------------
### Configure Environment Setup Script
Source: https://github.com/google/mcp/blob/main/examples/launchmybakery/README.md
Make the environment setup script executable and run it. This script enables APIs, creates a Maps API key, and generates a .env file.
```bash
chmod +x setup/setup_env.sh
./setup/setup_env.sh
```
--------------------------------
### Develop Allstrides Frontend
Source: https://github.com/google/mcp/blob/main/_autodocs/agent-implementations.md
Commands to set up and run the Allstrides frontend during development. This includes installing dependencies and starting the development server.
```bash
# Frontend
cd examples/allstrides/frontend
npm install
npm start
```
--------------------------------
### Provision BigQuery Setup Script
Source: https://github.com/google/mcp/blob/main/examples/launchmybakery/README.md
Make the BigQuery setup script executable and run it. This script creates a Cloud Storage bucket, uploads data, and sets up the BigQuery dataset and tables.
```bash
chmod +x ./setup/setup_bigquery.sh
./setup/setup_bigquery.sh
```
--------------------------------
### Develop Allstrides Backend
Source: https://github.com/google/mcp/blob/main/_autodocs/agent-implementations.md
Commands to set up and run the Allstrides backend server during development. This involves installing dependencies and starting the development server.
```bash
# Backend
cd examples/allstrides/server
npm install
npm run dev
```
--------------------------------
### Register User Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to make a POST request to the /api/auth/register endpoint to create a new user. Ensure the 'Content-Type' header is set to 'application/json'.
```javascript
const response = await fetch('http://localhost:8080/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'alice@example.com',
password: 'securepassword123',
first_name: 'Alice',
last_name: 'Smith',
nickname: 'alice_smith'
})
});
```
--------------------------------
### Clone Repository and Navigate
Source: https://github.com/google/mcp/blob/main/examples/launchmybakery/README.md
Clone the MCP repository and navigate to the launchmybakery example directory. This is the first step in setting up the demo environment.
```bash
git clone https://github.com/google/mcp.git
cd mcp/examples/launchmybakery
```
--------------------------------
### Example Output for Listing MCP Services
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This is an example of the expected output when listing enabled remote MCP services, showing the NAME and MCP_ENDPOINT for each service.
```console
student@cloudshell:~ (test-project-001-402417)$ gcloud beta services mcp list --project=$PROJECT_ID
NAME: services/developerknowledge.googleapis.com
MCP_ENDPOINT: developerknowledge.googleapis.com
NAME: services/run.googleapis.com
MCP_ENDPOINT: run.googleapis.com/mcp
NAME: services/sqladmin.googleapis.com
MCP_ENDPOINT: sqladmin.googleapis.com/mcp
```
--------------------------------
### BigQuery Provisioning Script
Source: https://github.com/google/mcp/blob/main/examples/petpassport/README.md
Run the setup script to automate BigQuery dataset and table creation, including uploading CSV data.
```bash
chmod +x setup/setup_bigquery.sh
./setup/setup_bigquery.sh
```
--------------------------------
### Create a new project
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Initializes a new project with the specified name and template. Use this command to start a new full-stack application.
```bash
npx create-mcp-app@latest my-app --template fullstack
```
--------------------------------
### Set up CI/CD Pipeline
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Example of a GitHub Actions workflow for continuous integration and deployment. This automates the build, test, and deployment process.
```yaml
name: CI/CD Pipeline
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Dependencies
run: npm install
- name: Build Application
run: npm run build
- name: Deploy to AWS
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy using Elastic Beanstalk
run: aws elasticbeanstalk update-environment --application-name my-migrated-app --environment-name my-migrated-app-env --version-label "$(git rev-parse --short HEAD)"
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/google/mcp/blob/main/examples/petpassport/README.md
Install the necessary Python dependencies for the Pet Passport application using pip.
```bash
pip install google-adk==1.28.0 python-dotenv google-genai pillow
```
--------------------------------
### Start FastAPI Server
Source: https://github.com/google/mcp/blob/main/examples/petpassport/README.md
Command to start the FastAPI server locally using Uvicorn for running the Pet Passport application.
```bash
uvicorn petpassport.main:app --reload
```
--------------------------------
### Initializing Firestore Emulator
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This command starts the Firestore emulator. It's useful for local development and testing without incurring costs.
```bash
firebase emulators:start --only firestore
```
--------------------------------
### Start Gemini CLI
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Launches the Gemini CLI interface in the current project directory.
```bash
gemini
```
--------------------------------
### Frontend Component Migration Example
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This example shows how to refactor a React component to use new props and state management patterns during a frontend migration.
```JavaScript
import React, { useState, useEffect } from 'react';
// Assume this is the old component structure
function OldUserProfile(props) {
const [user, setUser] = useState(null);
useEffect(() => {
// Simulate fetching old user data
setTimeout(() => {
setUser({ id: props.userId, name: 'John Doe', email: 'john.doe@example.com' });
}, 1000);
}, [props.userId]);
if (!user) {
return
Loading...
;
}
return (
{user.name}
Email: {user.email}
);
}
// New component structure after migration
function NewUserProfile({ userId }) {
const [userData, setUserData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
const fetchUser = async () => {
setLoading(true);
setError(null);
try {
// Simulate fetching new user data structure
const response = await fetch(`/api/users/${userId}`);
if (!response.ok) {
throw new Error('Failed to fetch user');
}
const data = await response.json();
setUserData(data);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
};
fetchUser();
}, [userId]);
if (loading) {
return Loading user profile...
;
}
if (error) {
return Error: {error}
;
}
if (!userData) {
return No user data found.
;
}
return (
{userData.full_name}
User ID: {userData.user_id}
Contact: {userData.contact}
Status: {userData.is_active ? 'Active' : 'Inactive'}
);
}
export default NewUserProfile;
```
--------------------------------
### WebSocket Server Setup
Source: https://github.com/google/mcp/blob/main/_autodocs/websocket-protocol.md
Initializes a WebSocket server instance. This setup is typically part of a larger Node.js HTTP server configuration.
```typescript
import WebSocket from 'ws';
const server = http.createServer(app);
const wss = new WebSocket.Server({ noServer: true });
```
--------------------------------
### Cloud Build Configuration File
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Example `cloudbuild.yaml` file to define build steps. This includes building a Docker image and deploying it to Cloud Run.
```yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA']
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '$SERVICE_NAME', '--image', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA', '--region', '$REGION', '--platform', 'managed']
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
```
--------------------------------
### Build Frontend Locally
Source: https://github.com/google/mcp/blob/main/examples/allstrides/README.md
Installs frontend dependencies and builds the React application for local development.
```bash
cd frontend
npm install
npm run build
cd ..
```
--------------------------------
### Create a New User Instance
Source: https://github.com/google/mcp/blob/main/_autodocs/database-models.md
Example of creating a new user record in the database. All non-nullable fields must be supplied.
```typescript
const user = await User.create({
email: 'user@example.com',
hashed_password: 'bcrypted_hash',
first_name: 'John',
last_name: 'Doe',
nickname: 'johnd'
});
```
--------------------------------
### Start Cloud SQL Auth Proxy on Compute Engine
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Start the Cloud SQL Auth Proxy as a background service on a Compute Engine instance. This command configures it to connect to the specified Cloud SQL instance.
```bash
nohup ./cloud-sql-proxy --instances="$PROJECT_ID:$REGION:$INSTANCE_NAME=tcp:5432" --token-file=/path/to/token.json --auto-iam-authn &
```
--------------------------------
### Database Migration Script
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This example demonstrates a database migration script using SQL. Ensure you have a SQL client and the correct database connection details.
```SQL
-- Example SQL script for database migration
-- Create a new table for migrated data
CREATE TABLE IF NOT EXISTS migrated_users (
user_id INT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert data from an old table (assuming 'old_users' exists)
INSERT INTO migrated_users (user_id, username, email)
SELECT id, name, email FROM old_users
WHERE id NOT IN (SELECT user_id FROM migrated_users);
-- Update existing records if necessary
-- UPDATE migrated_users SET email = 'new.email@example.com' WHERE user_id = 1;
-- Add indexes for performance
CREATE INDEX IF NOT EXISTS idx_migrated_users_username ON migrated_users (username);
-- Clean up old data if required (use with caution)
-- DROP TABLE IF EXISTS old_users;
SELECT 'Database migration script executed successfully.' AS status;
```
--------------------------------
### Run Allstrides with Helper Script
Source: https://github.com/google/mcp/blob/main/examples/allstrides/README.md
Executes a shell script to build the frontend, set up the server, and start the Allstrides application locally.
```bash
./start_allstrides.sh
```
--------------------------------
### Configuration File Migration
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Example of migrating a configuration file from YAML to JSON format.
```bash
# Assuming you have yq installed (a portable YAML, JSON, XML, TOML processor)
# Install yq: https://github.com/mikefarah/yq
# Convert config.yaml to config.json
yq eval -o=json config.yaml > config.json
# Example config.yaml content:
# database:
# host: localhost
# port: 5432
# username: admin
# password: "secure_password"
# api:
# key: "your_api_key"
# timeout: 30
# Resulting config.json content:
# {
# "database": {
# "host": "localhost",
# "port": 5432,
# "username": "admin",
# "password": "secure_password"
# },
# "api": {
# "key": "your_api_key",
# "timeout": 30
# }
# }
```
--------------------------------
### HTTP Upgrade Request Example
Source: https://github.com/google/mcp/blob/main/_autodocs/websocket-protocol.md
Illustrates the client-side HTTP request to initiate a WebSocket connection, including the necessary headers and query parameters for authentication.
```http
GET /api/chat/ws?token= HTTP/1.1
Host: localhost:8080
Upgrade: websocket
Connection: Upgrade
```
--------------------------------
### Generate Development Environment Variables
Source: https://github.com/google/mcp/blob/main/_autodocs/deployment-and-infrastructure.md
Example of creating a .env file for local development, including generating a random secret key.
```bash
# .env (do not commit)
SECRET_KEY=$(openssl rand -base64 32)
DATABASE_URL=/tmp/allstrides.db
MAPS_API_KEY=your-api-key
```
--------------------------------
### Migrating a Frontend Component
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This snippet shows a basic frontend component migration example. It assumes a React-like framework.
```JavaScript
import React, { useState, useEffect } from 'react';
function MigratedComponent() {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
const fetchData = async () => {
try {
// Replace with your actual API endpoint
const response = await fetch('/api/migrated-data');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const result = await response.json();
setData(result);
} catch (e) {
setError(e);
} finally {
setLoading(false);
}
};
fetchData();
}, []);
if (loading) {
return Loading...
;
}
if (error) {
return Error loading data: {error.message}
;
}
return (
Migrated Frontend Component
{JSON.stringify(data, null, 2)}
);
}
export default MigratedComponent;
```
--------------------------------
### GET /api/events Request Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to make a GET request to the /api/events endpoint to fetch a paginated list of events. You can specify 'skip' and 'limit' in the query parameters.
```javascript
const response = await fetch('http://localhost:8080/api/events?skip=0&limit=50');
const events = await response.json();
```
--------------------------------
### GET /api/events/:id Request Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to make a GET request to the /api/events/:id endpoint to retrieve a specific event. Replace ':id' with the actual event ID.
```javascript
const response = await fetch('http://localhost:8080/api/events/1');
const event = await response.json();
```
--------------------------------
### Setting up a Firebase Project
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This command initializes a Firebase project in your current directory. It prompts for project selection and configuration details.
```bash
firebase init
```
--------------------------------
### Agent Instruction Pattern for MCP Tool Usage
Source: https://github.com/google/mcp/blob/main/_autodocs/mcp-toolset-reference.md
Example of an agent instruction pattern that guides the agent on how to utilize available MCP toolsets for user assistance. It prioritizes data analysis with BigQuery before location queries with Maps.
```python
instruction = """
You have access to:
1. Maps Toolset - for location and place queries
2. BigQuery Toolset - for data analysis
When helping users:
- Use BigQuery first to understand data patterns
- Use Maps to find specific locations matching criteria
- Always explain your reasoning and data sources
"""
```
--------------------------------
### Install and Update Gemini CLI
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Installs or updates the Gemini CLI to the latest version globally.
```bash
cd ~/projectmcp/
npm install -g @google/gemini-cli@latest
```
--------------------------------
### Generate Migration Tutorial
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
After providing necessary information, Gemini CLI can generate a detailed markdown file with step-by-step instructions for data migration.
```console
✦ I have created a detailed migration guide for you.
You can find the tutorial in the new file: MIGRATION_GUIDE.md.
This guide covers:
1. Exporting your local SQLite data to CSV format.
2. Creating the PostgreSQL schema with compatible data types.
3. Uploading data to Google Cloud Storage.
4. Importing data into Cloud SQL in the correct order to respect relationships.
5. Resetting ID sequences to ensure new data can be added without errors.
```
--------------------------------
### Common ErrorResponse JSON Examples
Source: https://github.com/google/mcp/blob/main/_autodocs/types-and-interfaces.md
Examples of common error responses, illustrating specific error messages.
```json
{ "detail": "Email already registered" }
```
```json
{ "detail": "Incorrect username or password" }
```
```json
{ "detail": "User not found" }
```
```json
{ "detail": "Event not found" }
```
```json
{ "error": "Server error" }
```
--------------------------------
### WebSocket Connection URL Example
Source: https://github.com/google/mcp/blob/main/_autodocs/authentication-and-security.md
Example of a WebSocket connection URL including the JWT token as a query parameter for authentication.
```http
ws://localhost:8080/api/chat/ws?token=eyJhbGciOiJIUzI1NiIs...
```
--------------------------------
### Fetch Chat History Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to call the chat history endpoint using the fetch API and parse the JSON response.
```javascript
const response = await fetch('http://localhost:8080/api/chat/history?skip=0&limit=50');
const messages = await response.json();
```
--------------------------------
### Create Project Directory and Gemini Config
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Sets up the necessary directory structure for project-specific Gemini CLI configurations.
```bash
mkdir ~/projectmcp
cd ~/projectmcp
```
```bash
mkdir ~/projectmcp/.gemini
touch ~/projectmcp/.gemini/settings.json
```
--------------------------------
### Setting up a Cloud Run Service
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This command deploys a container image to Cloud Run, creating a new service. Ensure your container image is available in a registry like Artifact Registry or Container Registry.
```bash
gcloud run deploy my-service --image gcr.io/my-project/my-image --platform managed --region us-central1 --allow-unauthenticated
```
--------------------------------
### RSVP to an Event (JavaScript Example)
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Client-side example demonstrating how to send an RSVP request to the API. Ensure the Authorization header includes a valid Bearer token.
```javascript
const response = await fetch('http://localhost:8080/api/events/rsvp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({ event_id: 1 })
});
```
--------------------------------
### Prompt Gemini CLI for Data Migration Tutorial
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
A prompt to ask Gemini CLI to generate a detailed data migration tutorial from a local database to Cloud SQL for PostgreSQL.
```bash
I agree with the recommendation to use Cloud SQL for PostgreSQL as the new database for my application. Can you prepare a detailed migration tutorial based on Google documentation on how to move data from my local database to Cloud SQL in the cloud?
```
--------------------------------
### POST /api/events Request Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to make a POST request to the /api/events endpoint to create a new event. Ensure to include the Content-Type and Authorization headers.
```javascript
const response = await fetch('http://localhost:8080/api/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({
title: 'Morning Run',
description: '5K run at Central Park',
start_time: '2026-06-24T08:00:00Z',
distance: 5,
unit: 'km'
})
});
```
--------------------------------
### POST /api/events/vote Request Example
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Example of how to make a POST request to the /api/events/vote endpoint to toggle a vote for an event. Authentication is required, and the event_id must be provided in the request body.
```javascript
const response = await fetch('http://localhost:8080/api/events/vote', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({ event_id: 1 })
});
```
--------------------------------
### Setting up Firebase Functions
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This command initializes Firebase Functions for your project. It sets up the necessary directory structure and configuration for writing serverless functions.
```bash
firebase functions:init
```
--------------------------------
### Rate an Event (JavaScript Example)
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Client-side example for submitting an event rating. The request must include the event ID, rating value, and a valid Bearer token in the Authorization header.
```javascript
const response = await fetch('http://localhost:8080/api/events/rate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({ event_id: 1, value: 5 })
});
```
--------------------------------
### Deploying a Static Website to Cloud Storage
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
This snippet shows how to deploy a static website to a cloud storage bucket. Ensure you have the necessary permissions and the bucket is configured for static website hosting.
```bash
gsutil -m cp -r "./out" "gs://your-bucket-name"
```
--------------------------------
### Install Cloud SQL Auth Proxy on Compute Engine
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Install the Cloud SQL Auth Proxy on a Compute Engine instance. This allows the instance to securely connect to Cloud SQL.
```bash
wget https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.8.2/cloud-sql-proxy.linux.amd64 -O cloud-sql-proxy
chmod +x cloud-sql-proxy
```
--------------------------------
### Initialize Git Repository
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Initializes a new Git repository in the current directory. This is a standard first step for version control.
```bash
git init
```
--------------------------------
### JavaScript WebSocket Client Example
Source: https://github.com/google/mcp/blob/main/_autodocs/websocket-protocol.md
A comprehensive example of a JavaScript client connecting to a WebSocket server. It includes authentication via JWT, handling connection events (open, message, error, close), sending messages, and closing the connection.
```javascript
// 1. Authenticate first (get JWT token)
const loginResponse = await fetch('http://localhost:8080/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: 'user@example.com',
password: 'password123'
})
});
const { access_token } = await loginResponse.json();
// 2. Connect to WebSocket with token
const token = access_token;
const ws = new WebSocket(`ws://localhost:8080/api/chat/ws?token=${token}`);
// 3. Handle connection events
ws.onopen = () => {
console.log('Connected to chat');
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
console.log(`${message.owner.nickname}: ${message.content}`);
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};
ws.onclose = () => {
console.log('Disconnected from chat');
};
// 4. Send messages
ws.send('Hello everyone!');
ws.send('This is another message');
// 5. Close connection
ws.close();
```
--------------------------------
### Prompt to List Cloud Resources
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Use this prompt with Gemini CLI to list all Cloud SQL instances and Cloud Run services within the project.
```text
Can you please list all Cloud SQL instances in the project and Cloud Run services in the project.
```
--------------------------------
### Get Event by ID
Source: https://github.com/google/mcp/blob/main/_autodocs/api-reference-allstrides.md
Retrieves a single event by its ID. Authentication is not required.
```APIDOC
## GET /api/events/:id
### Description
Retrieves a single event by ID.
### Method
GET
### Endpoint
/api/events/:id
### Authentication
Not required
### Parameters
#### Path Parameters
- **id** (number) - Required - Event ID
### Response
#### Success Response (200 OK)
- **id** (number) - Unique identifier for the event
- **title** (string) - Event name
- **description** (string) - Event details
- **start_time** (ISO 8601) - Event start timestamp
- **distance** (number) - Distance of the event
- **unit** (string) - Unit of distance
- **owner_id** (number) - ID of the user who created the event
- **vote_count** (number) - Number of votes for the event
### Response Example
{
"id": 1,
"title": "Morning Run",
"description": "5K run at Central Park",
"start_time": "2026-06-24T08:00:00Z",
"distance": 5,
"unit": "km",
"owner_id": 1,
"vote_count": 3
}
### Errors
- **404** - "Event not found": Event does not exist
- **500** - "Server error": Database error
```
--------------------------------
### Create a Cloud SQL Instance
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Create a new Cloud SQL instance with specified settings. This includes the instance name, database version, region, and tier.
```bash
gcloud sql instances create "$INSTANCE_NAME" \
--database-version="POSTGRES_13" \
--region="$REGION" \
--tier="db-f1-micro"
```
--------------------------------
### Load Sample Data with SQLite
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Import sample data into the application's database using the SQLite utility. This requires navigating to the application directory and executing the SQL seed file.
```bash
cd ~/projectmcp/mcp/examples/allstrides
sqlite3 allstrides.db < seed_data.sql
```
--------------------------------
### Verify Gemini CLI Version
Source: https://github.com/google/mcp/blob/main/examples/allstrides/full_stack_app_migration_lab.md
Checks the currently installed version of the Gemini CLI.
```bash
gemini --version
```