谷歌隨OpenAI強(qiáng)勢(shì)入局,劈柴4天閃電部署Gemini+MCP!
3月31日,谷歌CEO Sundar Pichai(劈柴哥)發(fā)出靈魂一問:
To MCP or not to MCP, that's the question.
(MCP還是不MCP,這是個(gè)問題。)
MCP的持續(xù)火爆,加上OpenAI在27日官宣對(duì)MCP的支持,終究還是讓谷歌坐不住了。
劈柴哥讓網(wǎng)友們給拿一拿主意。
OpenAI的工程師Steven Heidel很快回復(fù)道:「我們已經(jīng)做了,現(xiàn)在到你們了?!?/span>
劈柴在線征求意見還不到4天,谷歌DeepMind的高級(jí)AI關(guān)系工程師Philipp Schmid,在X上宣布在Gemini API文檔中添加了使用MCP的示例。
現(xiàn)在可以直接將MCP服務(wù)器與Gemini 模型搭配使用。
谷歌官宣支持MCP
模型上下文協(xié)議 (MCP) 是開放標(biāo)準(zhǔn),用于連接AI應(yīng)用與外部工具、數(shù)據(jù)源和系統(tǒng)。
MCP為模型提供了一個(gè)通用協(xié)議,以便AI模型訪問上下文,例如函數(shù)(工具)、數(shù)據(jù)源(資源)或預(yù)定義的提示。
可以使用工具調(diào)用功能將模型與MCP服務(wù)器搭配使用。
如下示例,了解如何將本地MCP服務(wù)器與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剛剛使用現(xiàn)在爆火的「吉卜力」風(fēng)格圖片解釋了一下什么是MCP。
圖片中展示了一個(gè)基于MCP協(xié)議的分布式系統(tǒng)架構(gòu)。
簡(jiǎn)單的說,MCP協(xié)議可以使AI根據(jù)需求從不同的軟件或者網(wǎng)頁(yè)上獲取到數(shù)據(jù)或者服務(wù)。
善于整活的網(wǎng)友還把劈柴哥的這個(gè)帖子也整成了「吉卜力」風(fēng)。
緊跟潮流。
緊跟潮流的還有網(wǎng)友Adam Holt,他用漫畫回復(fù)了劈柴哥。
漫畫中,劈柴哥與Anthropic(MCP協(xié)議的推出者)CEO Dario Amodei微笑握手,奧特曼則站在中間,望著劈柴哥。
「為開發(fā)者而做?!笰dam寫道。
網(wǎng)友Jeffrey Emanuel還幫劈柴哥分析起了行業(yè)形勢(shì)。
他表示,考慮到 Anthropic、OpenAI以及DeepSeek全都支持MCP協(xié)議,如果谷歌還不采用,將會(huì)錯(cuò)失應(yīng)用開發(fā)的熱潮。
「并且所有的Gemini模型都將不再那么有用?!顾麑懙?。
網(wǎng)友Kris Hansen則進(jìn)一步表示,現(xiàn)在的MCP就相當(dāng)于是1993年的HTTP。
「更多產(chǎn)品采用這個(gè)標(biāo)準(zhǔn)協(xié)議將會(huì)有助于所有人?!?/span>
綜合來看,Kris將MCP比作1993年的HTTP確實(shí)比較合理。
兩者都是其領(lǐng)域的基礎(chǔ)協(xié)議,處于早期發(fā)展階段,也都具有改變技術(shù)格局的潛力。
方面 | HTTP 0.9 (1993) | MCP (2025) |
版本 | 0.9,早期版本 | 最新版本,2024年推出 |
主要功能 | 傳輸超文本文檔,支持GET方法 | 為AI模型提供上下文,連接數(shù)據(jù)源和工具 |
架構(gòu) | 客戶端-服務(wù)器,基于TCP/IP | 客戶端-服務(wù)器,標(biāo)準(zhǔn)化接口 |
復(fù)雜性 | 非常簡(jiǎn)單,無頭部信息 | 更復(fù)雜,支持實(shí)時(shí)雙向通信 |
采用階段 | 早期,剛剛開始推廣 | 早期,工具如Zed和Replit開始集成 |
潛在影響 | 成為萬維網(wǎng)基礎(chǔ),促成網(wǎng)絡(luò)革命 | 可能改變AI數(shù)據(jù)集成方式,增強(qiáng)AI應(yīng)用能力 |
當(dāng)然,在一片支持的評(píng)論中也不乏反對(duì)的聲音。
網(wǎng)友Han就希望谷歌自己推出一個(gè)「更強(qiáng)大、更輕量級(jí)的MCP進(jìn)化版本」。
To MCP or not to MCP
標(biāo)準(zhǔn)化協(xié)議對(duì)于整個(gè)AI生態(tài)的構(gòu)建都是至關(guān)重要的。
就像互聯(lián)網(wǎng)需要HTTP協(xié)議奠定基礎(chǔ)一樣,AI時(shí)代同樣需要像MCP這樣的標(biāo)準(zhǔn)來促進(jìn)互操作性和創(chuàng)新。
如果谷歌宣布支持MCP,那么Gemini可以作為MCP客戶端,輕松連接到各種數(shù)據(jù)源和工具。
同時(shí),谷歌也可以提供MCP服務(wù)器,讓其他AI模型訪問其服務(wù),如Gmail、Google Calendar和Google Drive 。
但是,大如谷歌這樣的科技巨頭,做出任何決策都沒那么容易。
其中重要的是,依賴外部標(biāo)準(zhǔn)可能帶來的風(fēng)險(xiǎn)。
畢竟,MCP協(xié)議是由谷歌在AI領(lǐng)域的對(duì)手Anthropic推出和主導(dǎo)的。
谷歌很難影響其長(zhǎng)期的發(fā)展方向。
雖說MCP協(xié)議現(xiàn)在是開源的,但以后怎樣谷歌也拿不準(zhǔn)。
畢竟谷歌自己剛把開源的安卓變得封閉起來。