From cc9c646f41298287f1cf6cac39cfcddf7fcd4e14 Mon Sep 17 00:00:00 2001 From: MoeenAsim Date: Wed, 15 Jul 2026 07:56:29 +0500 Subject: [PATCH 1/2] Add BGPT MCP sample for scientific literature retrieval --- python/samples/concepts/mcp/README.md | 14 ++++ .../mcp/agent_with_bgpt_mcp_plugin.py | 75 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 python/samples/concepts/mcp/agent_with_bgpt_mcp_plugin.py diff --git a/python/samples/concepts/mcp/README.md b/python/samples/concepts/mcp/README.md index a5233fbb2249..f821bae1a530 100644 --- a/python/samples/concepts/mcp/README.md +++ b/python/samples/concepts/mcp/README.md @@ -39,3 +39,17 @@ pip install semantic-kernel[mcp] cd python/samples/concepts/mcp python .py ``` +### BGPT sample + +The `agent_with_bgpt_mcp_plugin.py` sample demonstrates how to connect +Semantic Kernel to the BGPT MCP server using `MCPStreamableHttpPlugin` +for scientific literature retrieval. + +Run it with: + +```bash +python agent_with_bgpt_mcp_plugin.py +``` + +The sample requires an Azure OpenAI configuration (see the environment +variables documented in the sample). \ No newline at end of file diff --git a/python/samples/concepts/mcp/agent_with_bgpt_mcp_plugin.py b/python/samples/concepts/mcp/agent_with_bgpt_mcp_plugin.py new file mode 100644 index 000000000000..d85ab88d20a5 --- /dev/null +++ b/python/samples/concepts/mcp/agent_with_bgpt_mcp_plugin.py @@ -0,0 +1,75 @@ +# Copyright (c) Microsoft. All rights reserved. + +import asyncio + +from azure.identity import AzureCliCredential + +from semantic_kernel.agents import ChatCompletionAgent, ChatHistoryAgentThread +from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion +from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin + +""" +This sample demonstrates how to connect a ChatCompletionAgent +to the BGPT MCP Server using the MCPStreamableHttpPlugin. + +BGPT provides evidence-based retrieval over scientific literature +through a remote MCP server. + +It uses the Azure OpenAI service to create an agent. Make sure the +following environment variables are configured: + +- AZURE_OPENAI_CHAT_DEPLOYMENT_NAME +- Optionally: AZURE_OPENAI_API_KEY + +If no API key is configured, AzureCliCredential can also be used. +""" + + +# Example biomedical question +USER_INPUTS = [ + "Find recent papers about CRISPR gene editing in wheat.", +] + + +async def main() -> None: + # Create the BGPT MCP plugin + async with MCPStreamableHttpPlugin( + name="BGPT", + description="BGPT Scientific Literature Search", + url="https://bgpt.pro/mcp/stream", + ) as bgpt_plugin: + + # Create the agent + agent = ChatCompletionAgent( + service=AzureChatCompletion( + credential=AzureCliCredential(), + ), + name="BGPTAgent", + instructions=( + "You are a biomedical research assistant. " + "Use the BGPT MCP server to retrieve and summarize " + "scientific evidence." + ), + plugins=[bgpt_plugin], + ) + + for user_input in USER_INPUTS: + thread: ChatHistoryAgentThread | None = None + + print(f"# User: {user_input}") + + response = await agent.get_response( + messages=user_input, + thread=thread, + ) + + print(f"# {response.name}: {response}") + + thread = response.thread + + if thread: + await thread.delete() + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file From 29c5ba8d5f5ffe018bc5531baf6a296da00a7fb3 Mon Sep 17 00:00:00 2001 From: MoeenAsim Date: Wed, 15 Jul 2026 08:01:32 +0500 Subject: [PATCH 2/2] Add BGPT MCP sample for scientific literature retrieval --- python/samples/concepts/mcp/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/samples/concepts/mcp/README.md b/python/samples/concepts/mcp/README.md index f821bae1a530..6f2fb87b8edb 100644 --- a/python/samples/concepts/mcp/README.md +++ b/python/samples/concepts/mcp/README.md @@ -43,13 +43,14 @@ python .py The `agent_with_bgpt_mcp_plugin.py` sample demonstrates how to connect Semantic Kernel to the BGPT MCP server using `MCPStreamableHttpPlugin` -for scientific literature retrieval. +for evidence-based scientific literature retrieval. -Run it with: +Before running the sample, configure the required Azure OpenAI +environment variables as described in the sample file. + +Run the sample: ```bash +cd python/samples/concepts/mcp python agent_with_bgpt_mcp_plugin.py -``` - -The sample requires an Azure OpenAI configuration (see the environment -variables documented in the sample). \ No newline at end of file +``` \ No newline at end of file