Skip to content

Commit 79561a4

Browse files
authored
docs: Update client.md (#2013)
1 parent 9c7480d commit 79561a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/mcp/client.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ Then we can create the client:
116116
from pydantic_ai import Agent
117117
from pydantic_ai.mcp import MCPServerStreamableHTTP
118118

119-
server = MCPServerStreamableHTTP('http://localhost:8000/mcp')
120-
agent = Agent('openai:gpt-4o', mcp_servers=[server])
119+
server = MCPServerStreamableHTTP('http://localhost:8000/mcp') # (1)!
120+
agent = Agent('openai:gpt-4o', mcp_servers=[server]) # (2)!
121121

122122
async def main():
123123
async with agent.run_mcp_servers(): # (3)!
@@ -126,8 +126,9 @@ async def main():
126126
#> There are 9,208 days between January 1, 2000, and March 18, 2025.
127127
```
128128

129-
1. Create an agent with the MCP server attached.
130-
2. Create a client session to connect to the server.
129+
1. Define the MCP server with the URL used to connect.
130+
2. Create an agent with the MCP server attached.
131+
3. Create a client session to connect to the server.
131132

132133
_(This example is complete, it can be run "as is" with Python 3.10+ — you'll need to add `asyncio.run(main())` to run `main`)_
133134

0 commit comments

Comments
 (0)