Skip to content

Commit 8a2a21d

Browse files
authored
Python: MCP sample bugbash fixes (#4001)
* MCP sample bugbash fixes * import fix
1 parent cc98d5b commit 8a2a21d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

python/samples/02-agents/mcp/mcp_api_key_auth.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

3+
import asyncio
34
import os
45

56
from agent_framework import Agent, MCPStreamableHTTPTool
@@ -54,3 +55,7 @@ async def api_key_auth_example() -> None:
5455
print(f"User: {query}")
5556
result = await agent.run(query)
5657
print(f"Agent: {result.text}")
58+
59+
60+
if __name__ == "__main__":
61+
asyncio.run(api_key_auth_example())

python/samples/02-agents/mcp/mcp_github_pat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ async def github_mcp_example() -> None:
4747
# Set approval_mode="never_require" to allow the MCP tool to execute without approval
4848
client = OpenAIResponsesClient()
4949
github_mcp_tool = client.get_mcp_tool(
50-
server_label="GitHub",
51-
server_url="https://api.githubcopilot.com/mcp/",
50+
name="GitHub",
51+
url="https://api.githubcopilot.com/mcp/",
5252
headers=auth_headers,
53-
require_approval="never",
53+
approval_mode="never_require",
5454
)
5555

5656
# 5. Create agent with the GitHub MCP tool

0 commit comments

Comments
 (0)