Zoo MCP Server

A FastMCP-based server for retrieving animal species lists and details.

README.md

Deploy a Secure MCP Server on Cloud Run

A comprehensive tutorial for building and deploying a Model Context Protocol (MCP) server to Google Cloud Run.

About this Workshop

Subject Last Updated Written By
Cloud Run, MCP Oct 28, 2025 Luke Schlangen, Jack Wotherspoon

1. Introduction

Overview

In this lab, you will build and deploy a Model Context Protocol (MCP) server. MCP servers are useful for providing LLMs with access to external tools and services. You will configure it as a secure, production-ready service on Cloud Run that can be accessed from multiple clients. Then you will connect to the remote MCP server from Gemini CLI.

What You'll Do

We will use FastMCP to create a zoo MCP server that has two tools: get_animals_by_species and get_animal_details. FastMCP provides a quick, Pythonic way to build MCP servers and clients.

What You'll Learn

  • Deploy the MCP server to Cloud Run
  • Secure your server's endpoint by requiring authentication for all requests, ensuring only authorized clients and agents can communicate with it
  • Connect to your secure MCP server endpoint from Gemini CLI

2. Project Setup

  1. If you don't already have a Google Account, you must create a Google Account.

    Use a personal account instead of a work or school account. Work and school accounts may have restrictions that prevent you from enabling the APIs needed for this lab.

  2. Sign in to the Google Cloud Console.

  3. Enable billing in the Cloud Console.

    Completing this lab should cost less than $1 USD in Cloud resources. You can follow the steps at the end of this lab to delete resources to avoid further charges. New users are eligible for the $300 USD Free Trial.

  4. Create a new project or choose to reuse an existing project.


3. Open Cloud Shell Editor

  1. Click this link to navigate directly to Cloud Shell Editor.

    • If prompted to authorize at any point, click Authorize to continue.
    • If the terminal doesn't appear at the bottom of the screen, open it:
      • Click View
      • Click Terminal
  2. In the terminal, set your project with this command:

    Format:

    gcloud config set project [PROJECT_ID]
    

    Example:

    gcloud config set project lab-project-id-example
    
    • If you can't remember your project ID, you can list all your project IDs with:
      gcloud projects list | awk '/PROJECT_ID/{print $2}'
      
  3. You should see this message:

    Updated property [core/project].
    

    If you see a WARNING and are asked Do you want to continue (Y/n)?, then you have likely entered the project ID incorrectly. Press n, press Enter, and try to run the gcloud config set project command again.


4. Enable APIs

In the terminal, enable the necessary APIs:

gcloud services enable \
    run.googleapis.com \
    artifactregistry.googleapis.com \
    cloudbuild.googleapis.com

If prompted to authorize, click Authorize to continue.

This command may take a few minutes to complete, but it should eventually produce a successful message similar to this one:

Operation "operations/acf.p2-73d90d00-47ee-447a-b600" finished successfully.

5. Prepare Your Python Project

  1. Create a folder named mcp-on-cloudrun to store the source code for deployment:

    mkdir mcp-on-cloudrun && cd mcp-on-cloudrun
    
  2. Create a Python project with the uv tool to generate a pyproject.toml file:

    uv init --description "Example of deploying an MCP server on Cloud Run" --bare --python 3.13
    
  3. The uv init command creates a pyproject.toml file for your project. To view the contents of the file run the following:

    cat pyproject.toml
    

    The output should look like the following:

    [project]
    name = "mcp-on-cloudrun"
    

Tools 2

get_animals_by_speciesRetrieves a list of animals belonging to a specific species.
get_animal_detailsRetrieves specific details for a given animal.

Try it

List all the animals currently in the zoo that are classified as mammals.
Can you get the specific details for the lion in the zoo?
What species are available in the zoo database?
Find the details for the penguin.

Frequently Asked Questions

What are the key features of Zoo MCP Server?

Provides tools for retrieving animal species lists. Fetches specific details for individual animals. Built using the FastMCP framework. Designed for secure deployment on Google Cloud Run. Supports authentication for production-ready access.

What can I use Zoo MCP Server for?

Learning how to deploy and secure MCP servers on Google Cloud Run. Integrating animal database lookups into LLM-powered applications. Testing remote MCP server connectivity with the Gemini CLI. Building production-ready MCP services with authentication.

How do I install Zoo MCP Server?

Install Zoo MCP Server by running: mkdir mcp-on-cloudrun && cd mcp-on-cloudrun && uv init

What MCP clients work with Zoo MCP Server?

Zoo MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Zoo MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare