@@ -121,7 +121,7 @@ Then we can create the client:
121
121
from pydantic_ai import Agent
122
122
from pydantic_ai.mcp import MCPServerSSE
123
123
124
- server = MCPServerSSE(url = ' http://localhost:3001/sse' ) # (1)!
124
+ server = MCPServerSSE(' http://localhost:3001/sse' ) # (1)!
125
125
agent = Agent(' openai:gpt-4o' , toolsets = [server]) # (2)!
126
126
127
127
@@ -189,7 +189,7 @@ async def process_tool_call(
189
189
return await call_tool(name, tool_args, {' deps' : ctx.deps})
190
190
191
191
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)
193
193
agent = Agent(
194
194
model = TestModel(call_tools = [' echo_deps' ]),
195
195
deps_type = int ,
@@ -216,12 +216,12 @@ from pydantic_ai.mcp import MCPServerSSE
216
216
217
217
# Create two servers with different prefixes
218
218
weather_server = MCPServerSSE(
219
- url = ' http://localhost:3001/sse' ,
219
+ ' http://localhost:3001/sse' ,
220
220
tool_prefix = ' weather' # Tools will be prefixed with 'weather_'
221
221
)
222
222
223
223
calculator_server = MCPServerSSE(
224
- url = ' http://localhost:3002/sse' ,
224
+ ' http://localhost:3002/sse' ,
225
225
tool_prefix = ' calc' # Tools will be prefixed with 'calc_'
226
226
)
227
227
@@ -263,7 +263,7 @@ http_client = httpx.AsyncClient(
263
263
)
264
264
265
265
server = MCPServerSSE(
266
- url = ' http://localhost:3001/sse' ,
266
+ ' http://localhost:3001/sse' ,
267
267
http_client = http_client, # (1)!
268
268
)
269
269
agent = Agent(' openai:gpt-4o' , toolsets = [server])
@@ -362,7 +362,7 @@ Using this server with an `Agent` will automatically allow sampling:
362
362
from pydantic_ai import Agent
363
363
from pydantic_ai.mcp import MCPServerStdio
364
364
365
- server = MCPServerStdio(command = ' python' , args = [' generate_svg.py' ])
365
+ server = MCPServerStdio(' python' , args = [' generate_svg.py' ])
366
366
agent = Agent(' openai:gpt-4o' , toolsets = [server])
367
367
368
368
@@ -382,7 +382,7 @@ You can disallow sampling by setting [`allow_sampling=False`][pydantic_ai.mcp.MC
382
382
from pydantic_ai.mcp import MCPServerStdio
383
383
384
384
server = MCPServerStdio(
385
- command = ' python' ,
385
+ ' python' ,
386
386
args = [' generate_svg.py' ],
387
387
allow_sampling = False ,
388
388
)
@@ -502,7 +502,7 @@ async def handle_elicitation(
502
502
503
503
# Set up MCP server connection
504
504
restaurant_server = MCPServerStdio(
505
- command = ' python' , args = [' restaurant_server.py' ], elicitation_callback = handle_elicitation
505
+ ' python' , args = [' restaurant_server.py' ], elicitation_callback = handle_elicitation
506
506
)
507
507
508
508
# Create agent
0 commit comments