谷歌隨OpenAI強勢入局,劈柴4天閃電部署Gemini+MCP!
3月31日,谷歌CEO Sundar Pichai(劈柴哥)發出靈魂一問:
To MCP or not to MCP, that's the question.
(MCP還是不MCP,這是個問題。)
MCP的持續火爆,加上OpenAI在27日官宣對MCP的支持,終究還是讓谷歌坐不住了。
劈柴哥讓網友們給拿一拿主意。
OpenAI的工程師Steven Heidel很快回復道:「我們已經做了,現在到你們了。」
劈柴在線征求意見還不到4天,谷歌DeepMind的高級AI關系工程師Philipp Schmid,在X上宣布在Gemini API文檔中添加了使用MCP的示例。
現在可以直接將MCP服務器與Gemini 模型搭配使用。
谷歌官宣支持MCP
模型上下文協議 (MCP) 是開放標準,用于連接AI應用與外部工具、數據源和系統。
MCP為模型提供了一個通用協議,以便AI模型訪問上下文,例如函數(工具)、數據源(資源)或預定義的提示。
可以使用工具調用功能將模型與MCP服務器搭配使用。
如下示例,了解如何將本地MCP服務器與Gemini、Python SDK和 mcp SDK搭配使用。
import asyncioimport os from datetime
import datetime from google
import genai from google.genai
import types from mcp
import ClientSession, StdioServerParameters from mcp.client.stdio
import stdio_client
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
# Create server parameters for stdio connection
server_params = StdioServerParameters(command="npx", # Executable
args=["-y", "@philschmid/weather-mcp"], # Weather MCP Server
env=None, # Optional environment variables
)
async def run():
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Prompt to get the weather for the current day in London.
prompt = f"What is the weather in London in {datetime.now().strftime('%Y-%m-%d')}?"
# Initialize the connection between client and server
await session.initialize()
# Get tools from MCP session and convert to Gemini Tool objects
mcp_tools = await session.list_tools()
tools = [
types.Tool(
function_declaratinotallow=[
{
"name": tool.name,
"description": tool.description,
"parameters": {
k: v
for k, v in tool.inputSchema.items()
if k not in ["additionalProperties", "$schema"]
},
}
]
)
for tool in mcp_tools.tools
]
# Send request to the model with MCP function declarations
response = client.models.generate_content(
model="gemini-2.0-flash",
cnotallow=prompt,
cnotallow=types.GenerateContentConfig(
temperature=0,
tools=tools,
),
)
# Check for a function call
if response.candidates[0].content.parts[0].function_call:
function_call = response.candidates[0].content.parts[0].function_call
print(function_call)
# Call the MCP server with the predicted tool
result = await session.call_tool(
function_call.name, arguments=function_call.args
)
print(result.content[0].text)
# Continue as shown in step 4 of "How Function Calling Works"
# and create a user friendly response
else:
print("No function call found in the response.")
print(response.text)
# Start the asyncio event loop and run the main function
asyncio.run(run())
但是,大如谷歌這樣的科技巨頭,做出任何決策都沒那么容易。
幾天前,Steven剛剛使用現在爆火的「吉卜力」風格圖片解釋了一下什么是MCP。
圖片中展示了一個基于MCP協議的分布式系統架構。
簡單的說,MCP協議可以使AI根據需求從不同的軟件或者網頁上獲取到數據或者服務。
善于整活的網友還把劈柴哥的這個帖子也整成了「吉卜力」風。
緊跟潮流。
緊跟潮流的還有網友Adam Holt,他用漫畫回復了劈柴哥。
漫畫中,劈柴哥與Anthropic(MCP協議的推出者)CEO Dario Amodei微笑握手,奧特曼則站在中間,望著劈柴哥。
「為開發者而做。」Adam寫道。
網友Jeffrey Emanuel還幫劈柴哥分析起了行業形勢。
他表示,考慮到 Anthropic、OpenAI以及DeepSeek全都支持MCP協議,如果谷歌還不采用,將會錯失應用開發的熱潮。
「并且所有的Gemini模型都將不再那么有用。」他寫道。
網友Kris Hansen則進一步表示,現在的MCP就相當于是1993年的HTTP。
「更多產品采用這個標準協議將會有助于所有人。」
綜合來看,Kris將MCP比作1993年的HTTP確實比較合理。
兩者都是其領域的基礎協議,處于早期發展階段,也都具有改變技術格局的潛力。
方面 | HTTP 0.9 (1993) | MCP (2025) |
版本 | 0.9,早期版本 | 最新版本,2024年推出 |
主要功能 | 傳輸超文本文檔,支持GET方法 | 為AI模型提供上下文,連接數據源和工具 |
架構 | 客戶端-服務器,基于TCP/IP | 客戶端-服務器,標準化接口 |
復雜性 | 非常簡單,無頭部信息 | 更復雜,支持實時雙向通信 |
采用階段 | 早期,剛剛開始推廣 | 早期,工具如Zed和Replit開始集成 |
潛在影響 | 成為萬維網基礎,促成網絡革命 | 可能改變AI數據集成方式,增強AI應用能力 |
當然,在一片支持的評論中也不乏反對的聲音。
網友Han就希望谷歌自己推出一個「更強大、更輕量級的MCP進化版本」。
To MCP or not to MCP
標準化協議對于整個AI生態的構建都是至關重要的。
就像互聯網需要HTTP協議奠定基礎一樣,AI時代同樣需要像MCP這樣的標準來促進互操作性和創新。
如果谷歌宣布支持MCP,那么Gemini可以作為MCP客戶端,輕松連接到各種數據源和工具。
同時,谷歌也可以提供MCP服務器,讓其他AI模型訪問其服務,如Gmail、Google Calendar和Google Drive 。
但是,大如谷歌這樣的科技巨頭,做出任何決策都沒那么容易。
其中重要的是,依賴外部標準可能帶來的風險。
畢竟,MCP協議是由谷歌在AI領域的對手Anthropic推出和主導的。
谷歌很難影響其長期的發展方向。
雖說MCP協議現在是開源的,但以后怎樣谷歌也拿不準。
畢竟谷歌自己剛把開源的安卓變得封閉起來。