最新资讯
dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围 dev.to 银行 77 意图分类最便宜 LLM:GPT-6.1 Terra 每次成功任务 $0.000727 theinformation.com Chesky的副业:Airbnb向CEO新设AI实验室出售IP theverge.com OpenAI 宣布数据中心项目不再与公职人员签署保密协议 dev.to NVIDIA 发布四个开放 Cosmos 3 仿真模型 dev.to 真实 MCP 客户端击穿我们服务器的五种方式 theverge.com Airbnb 正在开发 AI 旅行 agent,计划 2027 年上半年推出 wechat 这可能是美国AI最魔幻的一天。 nytimes.com 美众议院共和党领袖要求 Nvidia 黄仁勋闭门简报 pub.towardsai.net 忘掉我:为记忆而设计的系统中的删除难题 marktechpost.com Google 发布 Gemini Omni 1.2 Flash:15 秒视频,每秒 0.07 美元
多元动态
登录 注册
大模型 cloud.google.com ·

在 Gemini 中实现 MCP Apps 的开发者指南

原文 我的收藏

Google Cloud 发布开发者指南,介绍 MCP Apps(SEP-1865)开放扩展:将工具与实时 UI 配对,在 Gemini Enterprise 聊天流中以沙箱 iframe 渲染,可全屏或侧栏展开,编辑在本地执行并与助手保持同步。架构分三层:浏览器客户端、Gemini Enterprise(工具调用、AppBridge 代理、OAuth 连接器)以及托管在私有 Cloud Run 上的 MCP 服务器(单一 JSON-RPC 端点 /mcp)。鉴权采用 Cloud Run IAM 与 In-App OAuth 双层机制,分别校验调用服务与终端用户。

AI推荐理由 Google Cloud 官方开发者指南,介绍 MCP Apps(SEP-1865)这一开放 MCP 扩展:工具与实时 UI 配对,在 Gemini Enterprise 聊天流中以沙箱 iframe 渲染,支持本地编辑与工作区同步。文中给出三层架构(浏览器、Gemini Enterprise、Cloud Run 上的 MCP 服务器)和双层 OAuth 鉴权细节,对 Agent 交互式应用开发有实际参考价值;但属厂商教程,未提供性能数据或第三方验证。

82

正文

Enterprise assistants still respond mostly in text. However, that can break down for visual, multi-step work, where every adjustment costs another slow chat turn. MCP Apps (SEP-1865) solves this. This open Model Context Protocol (MCP) extension pairs a tool with a live UI. In Gemini Enterprise, that UI renders directly in the chat flow inside a sandboxed iframe, and can expand to fullscreen or a side panel. Edits run locally while the workspace and assistant stay synchronized. You also avoid rebuilding core foundations: Gemini provides workforce sign-in, governed data access, and the Default Assistant, while you host your MCP server on a private Cloud Run service. Why we need MCP Apps Enterprise assistants have evolved through three generations: Generation 1 (Text chatbots): Returns static markdown with no interactive controls. Generation 2 (Standard MCP tools): Invokes live APIs, but outputs static text. Every change requires another model turn. Generation 3 (Interactive MCP Apps): Pairs each tool with a live workspace. Adjustments happen in the widget without a model turn, while the assistant stays in sync. Building MCP Apps in Gemini delivers six benefits: Responsive user experience: Single-click actions execute directly in the panel without round-tripping through the chat. Purpose-built workflows: Deliver visual redaction views for legal review, 3D viewers for CAD, or sensitivity models for finance. Enterprise security: Workforce OAuth sign-in, private Cloud Run ingress, and a sandboxed iframe protect every layer. Human-in-the-loop governance: Experts inspect and approve high-stakes actions before execution. Open standard: Portable across compatible hosts, with automatic text fallback. Broad connectivity: Connect to BigQuery, Agent Platform, Cloud Storage, or internal ERP and CRM systems. High-level architecture Three decoupled tiers work together: Client browser: Shows the chat alongside the MCP App widget in the side panel. Gemini Enterprise: The default assistant calls tools, the AppBridge proxy relays widget messages, and the connector manages OAuth. Google Cloud (your project): You deploy and host the MCP server on Cloud Run, which exposes one JSON-RPC endpoint (/mcp), runs background jobs, and serves the single-file HTML widget. Each tier talks only to its neighbor, letting Gemini Enterprise enforce security and routing. Authentication with two independent layers Each user signs in through OAuth 2.0. On every call, Gemini Enterprise sends its service agent token alongside the user's OAuth token: Layer 1 (Cloud Run IAM): Enforced at Google's edge, this answers "which service may call?" Public access is disabled; unauthorized callers receive HTTP 403. Layer 2 (In-App OAuth): Enforced inside the application, this answers "which user is calling?" Failed verification returns HTTP 401, prompting the user to sign in again. Cloud Run IAM cannot distinguish end users, so both layers are required. Outbound calls use a least-privilege service account. Build, deploy on Google Cloud, and register in Gemini Enterprise First, build your custom MCP server (exposing POST /mcp and a bundled ui:// HTML widget) using the MCP Apps SDK, or use Google Antigravity to scaffold and deploy your MCP App with this starter prompt: Build an MCP App for Gemini Enterprise using the create-mcp-app skill (https://github.com/modelcontextprotocol/ext-apps/tree/main/plugins/mcp-apps/skills/create-mcp-app). Workflow: [describe your input data, side-panel UI controls, and approval or export actions]. Generate a single-file HTML widget, a Streamable HTTP backend (POST /mcp) with Data stores > Create data store, select Custom MCP Server and register the connector: Configuration field Value MCP Server URL https://.run.app/mcp Authorization URL https://accounts.google.com/o/oauth2/v2/auth Token URL https://oauth2.googleapis.com/token Client ID and Secret Your Web OAuth 2.0 Client ID and Secret Scopes openid email profile Enable PKCE Support Checked (recommended) Use HTTP Basic Auth Unchecked (avoids invalid_client errors) Step 6: Enable actions on your data store. Gemini Enterprise imports your MCP server's tools as actions and disables them by default. In the Cloud Console, open Gemini Enterprise > Data stores > [Your MCP Data Store] > Actions, click Reload custom actions (which calls tools/list on your server), select your model-visible tools, and click Enable actions. Step 7: Connect the data store to your app. Open Gemini Enterprise > Apps > [Your App] > Connected data stores > Add existing data stores, and select your MCP data store. Connecting it as a data store gives the built-in Default Assistant access to your MCP tools and UI widget directly in main chat ( do not use "Add Agent," which is for external sub-agents rather than MCP data stores). Build your own An MCP App pairs backend tools with a live workspace in Gemini Enterprise. You do not build a chat frontend or identity pipeline; you deploy one Cloud Run container and attach it as a Data Store, making Gemini Enterprise where enterprise work gets done. Try Gemini here Co-build with Google Antigravity here Build on Google Cloud: MCP Apps Specification (SEP-1865), Cloud Run, and Google Cloud AI.

来源报道 · 1 篇 · 以下链接均前往原始媒体

opmlrss::Google Cloud Blog 在 Gemini 中实现 MCP Apps 的开发者指南 10-20 · 原文发布
← 返回精选动态 原文

更多内容