@@ -85,19 +85,23 @@ from agents import Agent, HostedMCPTool, Runner
8585async def main () -> None :
8686 agent = Agent(
8787 name = " Assistant" ,
88+ instructions = " Use the DeepWiki hosted MCP server to inspect openai/openai-agents-python." ,
8889 tools = [
8990 HostedMCPTool(
9091 tool_config = {
9192 " type" : " mcp" ,
92- " server_label" : " gitmcp " ,
93- " server_url" : " https://gitmcp.io/openai/codex " ,
93+ " server_label" : " deepwiki " ,
94+ " server_url" : " https://mcp.deepwiki.com/mcp " ,
9495 " require_approval" : " never" ,
9596 }
9697 )
9798 ],
9899 )
99100
100- result = await Runner.run(agent, " Which language is this repository written in?" )
101+ result = await Runner.run(
102+ agent,
103+ " Which language is the repository openai/openai-agents-python written in?" ,
104+ )
101105 print (result.final_output)
102106
103107asyncio.run(main())
@@ -126,7 +130,7 @@ print(result.final_output)
126130``` python
127131from agents import MCPToolApprovalFunctionResult, MCPToolApprovalRequest
128132
129- SAFE_TOOLS = {" read_project_metadata " }
133+ SAFE_TOOLS = {" read_wiki_structure " , " read_wiki_contents " , " ask_question " }
130134
131135def approve_tool (request : MCPToolApprovalRequest) -> MCPToolApprovalFunctionResult:
132136 if request.data.name in SAFE_TOOLS :
@@ -139,8 +143,8 @@ agent = Agent(
139143 HostedMCPTool(
140144 tool_config = {
141145 " type" : " mcp" ,
142- " server_label" : " gitmcp " ,
143- " server_url" : " https://gitmcp.io/openai/codex " ,
146+ " server_label" : " deepwiki " ,
147+ " server_url" : " https://mcp.deepwiki.com/mcp " ,
144148 " require_approval" : " always" ,
145149 },
146150 on_approval_request = approve_tool,
@@ -464,4 +468,4 @@ agent = Agent(
464468
465469- [ Model Context Protocol] ( https://modelcontextprotocol.io/ ) – 사양 및 설계 가이드
466470- [ examples/mcp] ( https://github.com/openai/openai-agents-python/tree/main/examples/mcp ) – 실행 가능한 stdio, SSE, Streamable HTTP 샘플
467- - [ examples/hosted_mcp] ( https://github.com/openai/openai-agents-python/tree/main/examples/hosted_mcp ) – 승인과 커넥터를 포함한 완전한 호스티드 MCP 데모
471+ - [ examples/hosted_mcp] ( https://github.com/openai/openai-agents-python/tree/main/examples/hosted_mcp ) – 승인과 커넥터를 포함한 완전한 호스티드 MCP 데모
0 commit comments