Token导航 LogoToken导航TokenDH.com
MCP Cloudrun Gstore logo
浏览器工具未说明官方级别未说明来源级核验

MCP Cloudrun Gstore

MCP Server

一个模拟Google商店API的服务,提供手机、耳机、手表等产品数据,支持在Google Cloud Run上部署。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
HTMLFastMCP浏览器自动化

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

juananestival

提供方

juananestival

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP云运行示例-谷歌商店模拟

此项目演示了如何将MCP服务器部署到Google Cloud Run。这个特定的实现模仿了Google Store API,提供了有关手机、耳机、手表等的数据。

设置GCP项目

配置您的工作项目:

gcloud config set project [PROJECT_ID]

启用所需的API:

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

使用uv启动项目

uv init --description "Example of deploying a Google Store Mock MCP server on Cloud Run" --bare --python 3.13

创建服务帐户

gcloud iam service-accounts create mcp-server-sa --display-name="MCP Server Service Account"

服务器.py

服务器使用 FastMCP 定义用于模拟Google Store数据的工具和资源。

import asyncio
import logging
import os
from typing import List, Dict, Any, Optional

from fastmcp import FastMCP

logger = logging.getLogger(__name__)
logging.basicConfig(format="[%(levelname)s]: %(message)s", level=logging.INFO)

mcp = FastMCP("Google Store Mock Server 📱⌚🏠")

# Mock data for Google Store
STORE_PRODUCTS = [
    # Phones
    {
        "id": "p9pxl",
        "category": "phones",
        "name": "Pixel 9 Pro XL",
        "description": "The most powerful Pixel yet, with a pro-level camera and Gemini AI.",
        "price": 1099.00,
        "currency": "USD",
        "specs": ["6.8-inch Super Actua display", "Triple rear camera system", "Tensor G4 chip"]
    },
    # ... (see server.py for full data)
]

@mcp.tool()
def list_categories() -> List[str]:
    """Lists all available product categories in the Google Store."""
    # ...

@mcp.tool()
def get_products_by_category(category: str) -> List[Dict[str, Any]]:
    """Retrieves all products for a specific category."""
    # ...

@mcp.tool()
def get_product_details(product_name: str) -> Optional[Dict[str, Any]]:
    """Retrieves detailed information about a specific product."""
    # ...

@mcp.tool()
def get_active_offers() -> List[Dict[str, Any]]:
    """Retrieves currently active offers and promotions."""
    # ...

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 8080))
    asyncio.run(
        mcp.run_async(
            transport="streamable-http", 
            host="0.0.0.0", 
            port=port
        )
    )

软件包安装

uv add fastmcp==2.12.4 --no-sync

部署到云端运行

export GOOGLE_CLOUD_PROJECT=your-project-id

gcloud run deploy google-store-mcp-server \
    --service-account=mcp-server-sa@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com \
    --no-allow-unauthenticated \
    --region=europe-west1 \
    --source=. \
    --labels=dev-tutorial=codelab-mcp

解决局部紫外线问题

如果您遇到以下问题 uv.lock 涉及私有注册表的文件:

# Delete the old lockfile
rm uv.lock

# Regenerate it forcing the public index
uv lock --default-index https://pypi.org/simple

# Authenticate for local development if needed
gcloud auth login
gcloud auth application-default login
uv pip install keyrings.google-artifactregistry-auth
export UV_KEYRING_PROVIDER=subprocess

目录标签

目录标签

HTMLFastMCP浏览器自动化本地部署API模拟Google商店云计算部署

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

session

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明session部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP