@@ -121,7 +121,7 @@ Then we can create the client:
121121from pydantic_ai import Agent
122122from pydantic_ai.mcp import MCPServerSSE
123123
124- server = MCPServerSSE(url = ' http://localhost:3001/sse' ) # (1)!
124+ server = MCPServerSSE(' http://localhost:3001/sse' ) # (1)!
125125agent = Agent(' openai:gpt-4o' , toolsets = [server]) # (2)!
126126
127127
@@ -189,7 +189,7 @@ async def process_tool_call(
189189 return await call_tool(name, tool_args, {' deps' : ctx.deps})
190190
191191
192- server = MCPServerStdio(' python' , [' mcp_server.py' ], process_tool_call = process_tool_call)
192+ server = MCPServerStdio(' python' , args = [' mcp_server.py' ], process_tool_call = process_tool_call)
193193agent = Agent(
194194 model = TestModel(call_tools = [' echo_deps' ]),
195195 deps_type = int ,
@@ -216,12 +216,12 @@ from pydantic_ai.mcp import MCPServerSSE
216216
217217# Create two servers with different prefixes
218218weather_server = MCPServerSSE(
219- url = ' http://localhost:3001/sse' ,
219+ ' http://localhost:3001/sse' ,
220220 tool_prefix = ' weather' # Tools will be prefixed with 'weather_'
221221)
222222
223223calculator_server = MCPServerSSE(
224- url = ' http://localhost:3002/sse' ,
224+ ' http://localhost:3002/sse' ,
225225 tool_prefix = ' calc' # Tools will be prefixed with 'calc_'
226226)
227227
@@ -263,7 +263,7 @@ http_client = httpx.AsyncClient(
263263)
264264
265265server = MCPServerSSE(
266- url = ' http://localhost:3001/sse' ,
266+ ' http://localhost:3001/sse' ,
267267 http_client = http_client, # (1)!
268268)
269269agent = Agent(' openai:gpt-4o' , toolsets = [server])
@@ -362,7 +362,7 @@ Using this server with an `Agent` will automatically allow sampling:
362362from pydantic_ai import Agent
363363from pydantic_ai.mcp import MCPServerStdio
364364
365- server = MCPServerStdio(command = ' python' , args = [' generate_svg.py' ])
365+ server = MCPServerStdio(' python' , args = [' generate_svg.py' ])
366366agent = Agent(' openai:gpt-4o' , toolsets = [server])
367367
368368
@@ -382,7 +382,7 @@ You can disallow sampling by setting [`allow_sampling=False`][pydantic_ai.mcp.MC
382382from pydantic_ai.mcp import MCPServerStdio
383383
384384server = MCPServerStdio(
385- command = ' python' ,
385+ ' python' ,
386386 args = [' generate_svg.py' ],
387387 allow_sampling = False ,
388388)
@@ -502,7 +502,7 @@ async def handle_elicitation(
502502
503503# Set up MCP server connection
504504restaurant_server = MCPServerStdio(
505- command = ' python' , args = [' restaurant_server.py' ], elicitation_callback = handle_elicitation
505+ ' python' , args = [' restaurant_server.py' ], elicitation_callback = handle_elicitation
506506)
507507
508508# Create agent
0 commit comments