## File: README.md

# `google/mcp`

This repository contains a list of Google's official Model Context Protocol (MCP) servers, guidance on how to deploy MCP servers to Google Cloud, and examples to get started.

## ⚡ Google MCP Servers

### **Remote MCP servers** 

These [remote MCP servers are managed by Google](https://docs.cloud.google.com/mcp/overview), and are available [via endpoint](https://docs.cloud.google.com/mcp/enable-disable-mcp-servers). Below are a few key remote servrs. For a comprehensive list of all remote MCP servers managed by Google in General Availability (GA) and public preview [**vist the supported products pager**](https://docs.cloud.google.com/mcp/supported-products) 


* [**AlloyDB for PostgreSQL**](https://docs.cloud.google.com/alloydb/docs/ai/use-alloydb-mcp) 
* [**BigQuery**](https://docs.cloud.google.com/bigquery/docs/use-bigquery-mcp) 
* [**Bigtable**](https://docs.cloud.google.com/bigtable/docs/use-bigtable-mcp) 
* [**Cloud Resource Manager**](https://docs.cloud.google.com/resource-manager/reference/mcp)
* [**Cloud SQL for MySQL**](https://docs.cloud.google.com/sql/docs/mysql/use-cloudsql-mcp) 
* [**Cloud SQL for PostgreSQL**](https://docs.cloud.google.com/sql/docs/postgres/use-cloudsql-mcp) 
* [**Cloud SQL for SQL Server**](https://docs.cloud.google.com/sql/docs/sqlserver/use-cloudsql-mcp)
* [**Compute Engine (GCE)**](https://docs.cloud.google.com/compute/docs/reference/mcp) 
* [**Developer Knowledge API (Google Developer Documentation)**](https://developers.google.com/knowledge/mcp) 
* [**Firestore**](https://docs.cloud.google.com/firestore/native/docs/use-firestore-mcp)
* [**Google Maps (Grounding Lite)**](https://developers.google.com/maps/ai/grounding-lite)  
* [**Google Security Operations (Chronicle)**](https://docs.cloud.google.com/chronicle/docs/reference/mcp)
* [**Kubernetes Engine (GKE)**](https://docs.cloud.google.com/kubernetes-engine/docs/reference/mcp)   
* [**Spanner**](https://docs.cloud.google.com/spanner/docs/use-spanner-mcp)
* [**Cloud Run**](https://docs.cloud.google.com/run/docs/reference/mcp) (GA)
* [**Cloud Storage**](https://docs.cloud.google.com/storage/docs/reference/mcp)


### **Open-source MCP servers**  

You can run these open-source MCP servers locally, or deploy them to Google Cloud (see below).  

* [**Google Workspace**](https://github.com/gemini-cli-extensions/workspace), including Google Docs, Sheets, Slides, Calendar, and Gmail. (Gemini CLI extension)  
* [**Firebase**](https://github.com/gemini-cli-extensions/firebase/) (Gemini CLI extension)  
* [**Cloud Run**](https://github.com/GoogleCloudPlatform/cloud-run-mcp) (Gemini CLI Extension)
* [**Go**](https://go.dev/gopls/features/mcp) 
* [**Google Analytics**](https://github.com/googleanalytics/google-analytics-mcp)  
* [**MCP Toolbox for Databases**](https://github.com/googleapis/genai-toolbox), including BigQuery, Cloud SQL, AlloyDB, Spanner, Firestore, and more.  
* [**Google Cloud Storage**](https://github.com/googleapis/gcloud-mcp/tree/main/packages/storage-mcp)  
* [**Genmedia**](https://github.com/GoogleCloudPlatform/vertex-ai-creative-studio/tree/main/experiments/mcp-genmedia), including Imagen and Veo models.  
* [**Kubernetes Engine (GKE)**](https://github.com/GoogleCloudPlatform/gke-mcp)  
* [**Google Cloud Security**](https://github.com/google/mcp-security), including Security Command Center, Chronicle, and more.  
* [**gcloud CLI**](https://github.com/googleapis/gcloud-mcp/tree/main/packages/gcloud-mcp)  
* [**Google Cloud Observability**](https://github.com/googleapis/gcloud-mcp/tree/main/packages/observability-mcp)
* [**Flutter/Dart**](https://github.com/dart-lang/ai/tree/main/pkgs/dart_mcp_server)
* [**Angular**](https://github.com/angular/angular-cli/tree/main/packages/angular/cli/src/commands/mcp)
* [**Google Maps Platform Code Assist toolkit**](https://developers.google.com/maps/ai/mcp)
* [**Chrome DevTools**](https://github.com/ChromeDevTools/chrome-devtools-mcp)

## 💻 Examples

* [**Launch My Bakery**](http://github.com/google/mcp/tree/main/examples/launchmybakery) (`/examples/launchmybakery`)**:** A sample agent built with Agent Development Kit (ADK) that uses remote MCP servers for Google Maps and BigQuery.
* [**Allstrides**](https://github.com/google/mcp/tree/main/examples/allstrides) (`/examples/allstrides`)**:** A sample app migrated from local to Cloud using remote MCP servers for Developer Knowledge, Cloud SQL and Cloud Run 


## 📙 Resources

### **Run an MCP server in Google Cloud** 

* [Documentation \- Host MCP Servers on Cloud Run](https://docs.cloud.google.com/run/docs/host-mcp-servers)  
* Blog Post \- [Build and Deploy a Remote MCP Server to Google Cloud Run in Under 10 Minutes](https://cloud.google.com/blog/topics/developers-practitioners/build-and-deploy-a-remote-mcp-server-to-google-cloud-run-in-under-10-minutes)  
* [MCP Toolbox for Databases \- Deploy to Cloud Run](https://googleapis.github.io/genai-toolbox/how-to/deploy_toolbox/), [Deploy to Google Kubernetes Engine (GKE)](https://googleapis.github.io/genai-toolbox/how-to/deploy_gke/)  
* [Blog post - Announcing MCP support for Apigee](https://cloud.google.com/blog/products/ai-machine-learning/mcp-support-for-apigee) (Turnkey MCP hosting for Apigee-hosted APIs)  
* “Tools Make an Agent” \- [Blog](https://cloud.google.com/blog/topics/developers-practitioners/tools-make-an-agent-from-zero-to-assistant-with-adk) and [Codelab](https://codelabs.developers.google.com/codelabs/cloud-run/tools-make-an-agent)  
* Codelab \- [How to deploy a secure MCP server on Cloud Run](https://codelabs.developers.google.com/codelabs/cloud-run/how-to-deploy-a-secure-mcp-server-on-cloud-run#0)  
* [Codelab \- "Agent Verse" \- Architecting Multi-agent Systems](http://goo.gle/summoner) 

## 🤝 Contributing

We welcome contributions to this repository, including bug reports, feature requests, documentation improvements, and code contributions. Please see our [Contributing Guidelines](https://github.com/google/mcp/blob/main/CONTRIBUTING.md) to get started.

## 📃 License

This project is licensed under the Apache 2.0 License \- see the [LICENSE](https://github.com/google/mcp/blob/main/LICENSE) file for details.

## Disclaimers

This is not an officially supported Google product. This project is intended for demonstration purposes only.

This project is not eligible for the [Google Open Source Software Vulnerability Rewards Program](https://bughunters.google.com/open-source-security).

---

## File: examples/petpassport/README.md

# Pet Passport: Pet-friendly route planner

This directory contains the **Pet Passport** application, a demo of an AI Agent using the Model Context Protocol (MCP) to combine data analysis and real-world location services.

## Demo Overview

Pet Passport helps users plan a perfect day out with their dog based on breed popularity in New York City. The agent uses a "Macro-to-Micro" reasoning chain:
1.  **Strategic Discovery (BigQuery):** Identifies the NYC Zip Code with the highest population for a specific breed.
2.  **Local Execution (Maps):** Uses that Zip Code as a location bias to find "pet friendly cafes" and "dog parks".
3.  **Itinerary Generation:** Combines the data to create a "Pet Passport" itinerary.

The agent is built using the `google-adk` framework and powered by `gemini-3.1`.

## Dataset

This demo uses the [NYC Dog Licensing Dataset](https://data.cityofnewyork.us/Health/NYC-Dog-Licensing-Dataset/nu7n-tubp) from NYC Open Data. It contains records of licensed dogs in New York City.

## Project Structure

```text
petpassport/
├── petpassport/
│   ├── __init__.py
│   ├── agent.py             # Agent definition using ADK
│   ├── tools.py             # MCP Tool configuration (BigQuery & Maps)
│   └── main.py              # FastAPI application exposing the agent
├── pyproject.toml           # Project dependencies
└── README.md                # This documentation
```

## Prerequisites

*   **Python 3.13+**
*   **Google Cloud Project** with access to BigQuery and Maps MCP endpoints.
*   **Environment Variables** (Store these in a `.env` file in the project root):
    *   `MAPS_API_KEY`: Your Google Maps API key.
    *   `GOOGLE_CLOUD_PROJECT`: Your Google Cloud project ID.

## Deployment Guide

Follow these steps to set up and run the demo.

### 1. Authenticate with Google Cloud

Set your active Google Cloud project and authenticate. This is required for the ADK to access BigQuery.

```bash
gcloud config set project [YOUR-PROJECT-ID]
gcloud auth application-default login --project [YOUR-PROJECT-ID]
```

*Note: If you encounter errors about a different project during authentication, you can bypass it by disabling the quota project and setting it manually:*
```bash
gcloud auth application-default login --disable-quota-project
gcloud auth application-default set-quota-project [YOUR-PROJECT-ID]
```

### 3. Configure Environment

Run the environment setup script. This script will:
*   Enable necessary Google Cloud APIs (Maps, BigQuery, remote MCP).
*   Create a restricted Google Maps Platform API Key.
*   Create a `.env` file with required environment variables.

```bash
chmod +x setup/setup_env.sh
./setup/setup_env.sh
```

### 4. Provision BigQuery

Run the setup script. This script automates the following:
*   Creates a Cloud Storage bucket.
*   Uploads the CSV data files.
*   Creates the `nyc_dogs` BigQuery dataset.
*   Loads the data into BigQuery table `licenses`.

```bash
chmod +x setup/setup_bigquery.sh
./setup/setup_bigquery.sh
```

## Installation

1.  Navigate to the project directory:
    ```bash
    cd examples/petpassport
    ```

2.  Create a virtual environment:
    ```bash
    python3 -m venv .venv
    ```

3.  Activate the virtual environment:
    ```bash
    source .venv/bin/activate
    ```

4.  Install dependencies:
    ```bash
    pip install google-adk==1.28.0 python-dotenv google-genai pillow
    ```

## Running the Application Locally

To run the application locally on your machine:

1.  **Install Uvicorn** (if not already installed):
    ```bash
    pip install uvicorn
    ```

2.  **Start the FastAPI server:**
    ```bash
    uvicorn petpassport.main:app --reload
    ```

3.  **Open the UI:**
    Navigate to `http://127.0.0.1:8000/ui/` in your browser to interact with the Pet Passport interface.

**Sample prompt:** "I have a Labrador Retriever. Where should we go in NYC?"

## Deploying to Cloud Run

To deploy the Pet Passport agent to Google Cloud Run:

1.  **Ensure you are in the project directory**:
    ```bash
    cd examples/petpassport
    ```

2.  **Deploy to Cloud Run**:
    Use the following pure `gcloud` command to build and deploy the application to Cloud Run. Replace `[YOUR-REGION]` with your desired region (e.g., `us-west1`).

    ```bash
    gcloud run deploy petpassport \
      --source petpassport \
      --region [YOUR-REGION] \
      --allow-unauthenticated \
      --labels dev-tutorial=google-mcp
    ```

    *Note: This command assumes you have the environment variables `MAPS_API_KEY` and `GOOGLE_CLOUD_PROJECT` set in your current shell.*

3.  **Permissions**:
    Ensure the Cloud Run service account has the following IAM roles:
    *   `BigQuery Data Viewer` and `BigQuery Job User` (to query BigQuery).
    *   `Storage Object Admin` on the bucket `pet-passport-data-$PROJECT_ID` (to upload PDFs).

---

## File: examples/launchmybakery/README.md

# Launch My Bakery: Google remote MCP demo 

[](https://cloud.google.com/blog/products/ai-machine-learning/announcing-official-mcp-support-for-google-services)
[](https://codelabs.developers.google.com/adk-mcp-bigquery-maps#0)
[](https://www.youtube.com/watch?v=wzccErUYhTI&t=1s)

This directory contains the data artifacts and infrastructure setup scripts for the **MCP support for BigQuery & Google Maps** demo.  

## Demo Overview

This scenario demonstrates an AI Agent's ability to orchestrate enterprise data (BigQuery) and real-world geospatial context (Google Maps) to solve a complex business problem: 

> **"How would you help a friend launch a new high-end sourdough bakery in Los Angeles?"**

The agent autonomously queries BigQuery to find macro trends and uses Google Maps to validate micro-location details. The demo relies on three key datasets:

1.  **Demographics:** To identify neighborhoods with high foot traffic using census data (Macro Discovery).
2.  **Market Data:** To analyze competitor pricing and suggest a premium price point (Pricing Strategy).
3.  **Sales History:** To forecast potential revenue based on comparable store trends (Forecasting).

### Architecture Diagram



The diagram above illustrates the flow of information in this demo. The Agent, powered by Gemini 3.5 Flash, orchestrates requests between the user and Google Cloud services. It uses a remote (Google hosted) MCP server to securely access BigQuery for demographic and sales data, and Google Maps APIs for real-world location analysis and validation.

## Repository Structure

```text
launchmybakery/
├── data/                        # Pre-generated CSV files for BigQuery
│   ├── demographics.csv
│   ├── bakery_prices.csv
│   ├── sales_history_weekly.csv
│   └── foot_traffic.csv
├── adk_agent/                   # AI Agent Application (ADK)
│   └── mcp_bakery_app/          # App directory
│       ├── agent.py             # Agent definition
│       └── tools.py             # Custom tools for the agent
├── setup/                       # Infrastructure setup scripts
│   ├── setup_bigquery.sh        # Script to provision BigQuery dataset and tables
│   └── setup_env.sh             # Script to set up environment variables
├── cleanup/                     # Infrastructure clean up environment
│   ├── cleanup_env.sh           # Script to remove resources in environment
└── README.md                    # This documentation
```

## Prerequisites

*   **Google Cloud Project** with billing enabled.
*   **Google Cloud Shell** (Recommended) or a local terminal with the `gcloud` CLI installed.

## Deployment Guide

Follow these steps in **Google Cloud Shell** to provision the demo environment.

### 1. Clone the Repository
```bash
git clone https://github.com/google/mcp.git
cd mcp/examples/launchmybakery
```

### 2. Authenticate with Google Cloud

Run the following command to authenticate with your Google Cloud account. This is required for the ADK to access BigQuery.

```bash
gcloud config set project [YOUR-PROJECT-ID]
gcloud auth application-default login
```

Follow the prompts to complete the authentication process.

⚠️ Note: ADK does not automatically refresh your OAuth 2.0 token. If your chat session lasts more than 60 minutes, you may need to re-authenticate using the command above.

### 3. Configure Environment

Run the environment setup script. This script will:
*   Enable necessary Google Cloud APIs (Maps, BigQuery, remote MCP).
*   Create a restricted Google Maps Platform API Key.
*   Create a `.env` file with required environment variables.

```bash
chmod +x setup/setup_env.sh
./setup/setup_env.sh
```

### 4. Provision BigQuery

Run the setup script. This script automates the following:
*   Creates a Cloud Storage bucket.
*   Uploads the CSV data files.
*   Creates the `mcp_bakery` BigQuery dataset.
*   Loads the data into BigQuery tables.

```bash
chmod +x ./setup/setup_bigquery.sh
./setup/setup_bigquery.sh
```

### 5. Install ADK and Run Agent

Create a virtual environment, install the ADK, and run the agent.

```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'
```

### 6. Chat with the Agent

Open the link provided by `adk web` in your browser. You can now chat with the agent and ask it questions about the bakery data.

**Sample Questions:**

*   "I’m looking to open my fourth bakery location in Los Angeles. I need a neighborhood with early activity. Find the zip code with the highest 'morning' foot traffic score."
*   "Can you search for 'Bakeries' in that zip code to see if it's saturated? If there are too many, check for 'Specialty Coffee' shops, so I can position myself near them to capture foot traffic."
*    "Okay and I want to position this as a premium brand. What is the maximum price being charged for a 'Sourdough Loaf' in the LA Metro area?"
*    "Now I want a revenue projection for December 2025. Look at my sales history and take data from my best performing store for the 'Sourdough Loaf'. Run a forecast for December 2025 to estimate the quantity I'll sell. Then, calculate the projected total revenue using just under the premium price we found (let's use $18)"
*    "That'll cover my rent. Lastly, let's verify logistics. Find the closest "Restaurant Depot" to the proposed area and make sure that drive time is under 30 minutes for daily restocking."

To abort the ADK session in Cloud Shell, press `Ctrl+C`.

### 7. Cleanup

To avoid incurring ongoing costs for BigQuery storage or other Google Cloud resources, you can run the cleanup script. This script will delete the BigQuery dataset, the Cloud Storage bucket, and the API keys created during setup. Navigate back to the root directory of the repository and run the following command:

```bash
chmod +x cleanup/cleanup_env.sh
./cleanup/cleanup_env.sh
```

## Data Logic & Narratives

The data in this repository is synthetic but structured to support specific demo narratives and successful agent reasoning chains.

| Table | Demo Purpose | Narrative Logic |
| :--- | :--- | :--- |
| **`foot_traffic`** | **Target Discovery**Finding the target neighborhood. | **Morning** activity is uniquely spiked in **90403**, allowing the Agent to pinpoint it as the optimal location for a morning-focused business like a bakery. |
| **`demographics`** | **Community Profiling**Analyzing market depth. | **Santa Monica (90403)** is modeled with a dense, established residential population, providing a stable baseline for customer volume. |
| **`bakery_prices`** | **Pricing Strategy**Setting a price point. | **Erewhon Market** has the highest price ceiling for a Sourdough Loaf (~$18.50), while the market average is ~$8.20. This allows the Agent to confidently suggest a premium price point of ~$15-18. |
| **`sales_history`** | **Forecasting**Predicting growth. | **Silver Lake** shows aggressive week-over-week growth trends, while **Playa Vista** represents a stable, high-volume flagship store, providing distinct patterns for forecasting models. |

---

## File: examples/allstrides/README.md

# AllStrides: Google remote MCP for Cloud SQL and Developer Knowledge

[](https://cloud.google.com/blog/products/ai-machine-learning/announcing-official-mcp-support-for-google-services)
[](https://codelabs.developers.google.com/ai-mcp-dk-csql#0)
[](https://youtu.be/SeuhYVg8-AU?si=uGQHyU4N_vZoZBUn)

This directory contains the data artifacts and infrastructure setup scripts for the **Google remote MCP for Cloud SQL and Developer Knowledge** demo.  

## Demo Overview

This scenario demonstrates an AI Agent's ability to act as a Product Architect, migrating a localized application to the cloud using Google Model Context Protocol (MCP) servers. By equipping Gemini CLI with access to Cloud SQL, Developer Knowledge and Cloud Run MCP, you can transform a manual deployment process into an agentic orchestration.

> **"How do I evolve AllStrides from a local-only prototype into a secure, globally accessible enterprise platform?"**

Gemini CLI interacts with the Google Cloud ecosystem by leveraging three specific MCP servers to modernize the stack:

1.  **Developer Knowledge MCP**: To analyze the current application structure and identify the optimal Google Cloud database.
2.  **Cloud SQL MCP**: To provision a production-grade database instance and migrate local fitness community data to the cloud via a single natural language prompt.
3.  **Cloud Run MCP**: To containerize the allstrides application and deploy it to a serverless environment, making AllStrides live and accessible to users worldwide.

### Architecture Diagram




This directory contains the sample application artifacts and a lab demonstrating how the MCP support for Developer Knowledge, Databases ad Cloud Run help to migrate demo application to the cloud.
## Sample Application
The sample "Allstrides" application is featuring event management, fuser authentication, profile management, event CRUD operations, RSVP functionality, and real-time chat.

## Architecture

This project is a **Unified Full-Stack TypeScript Application**.
- **Frontend**: React (TypeScript)
- **Backend**: Node.js / Express (TypeScript)
- **Database**: SQLite (managed by Sequelize)
- **Real-time**: WebSocket (ws)
- **Deployment**: Single container serving both API and Static Frontend assets.

### Project Structure
```text
Listing: allstrides
├── frontend/
│   ├── public/
│   └── src/
│       ├── components/
│       │   ├── chat/
│       │   └── layout/
│       └── pages/
│           ├── auth/
│           ├── events/
│           └── profile/
└── server/
    └── src/
        ├── middleware/
        ├── models/
        └── routes/
```

- `frontend/`: React application (CRA).
- `server/`: Node.js/Express API and WebSocket server.
- `docker-compose.yml`: Local deployment config.
- `start_allstrides.sh`: Helper script for local execution.

## Getting Started

### Prerequisites

- Node.js (v22 or later)
- Docker (optional)

### Configuration

The application listens on port `8080` by default. You can change this using:
1.  **Environment Variable:** `PORT=3000 npm start`
2.  **Command Line Argument:** `npm start -- --port 3000`

### Running Locally

1.  **Use the Helper Script:**
    This script builds the frontend, sets up the server, and starts the application.
    ```bash
    ./start_allstrides.sh
    ```
    The application will be available at [http://localhost:8080](http://localhost:8080).

2.  **Manual Setup:**
    
    *Build Frontend:*
    ```bash
    cd frontend
    npm install
    npm run build
    cd ..
    ```

    *Start Server:*
    ```bash
    cd server
    npm install
    npm run build
    npm start
    ```

### Running with Docker

1.  Start the application:
    ```bash
    docker compose up --build
    ```
    The application will be available at [http://localhost:8080](http://localhost:8080).

2.  Stop the application:
    ```bash
    docker compose down
    ```

### Seeding the Database

You can populate the database with random test data using two methods:

**Method 1: Scripted Seeding (Internal)**
To use the internal Sequelize seed script (50 users, 200 events, 100 messages):
```bash
cd server
npm run seed
```

**Method 2: SQL Import (External)**
To import the pre-generated SQLite script (50 users, 100 events from 2025-2026, 150 messages, and votes):
```bash
# From the root of the 'allstrides' folder
sqlite3 allstrides.db < seed_data.sql
```
*Note: This will overwrite existing data for users, events, messages, and votes.*

## Development Notes

- **Database**: The application uses a local SQLite database (`allstrides.db`) located in the root `allstrides` folder (when running locally) or mapped to the container volume.
- **Authentication**: Uses JWT. Passwords are hashed with BCrypt.
- **API Documentation**: The backend endpoints are available at `/api/...`.
- **Frontend Routing**: The server is configured to handle client-side routing (SPA) by falling back to `index.html` for non-API routes.

## License
This project is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.