
Build and deploy an OpenAI-powered agent that uses your Model Context Protocol (MCP) tools to automatically generate detailed outbreak analytics reports from real-time public health updates and surveillance data.
🕐30 minutes ⭐⭐Intermediate 📅Last updated: Dec 25, 2025
Before you begin, ensure you have the following prerequisites and technical requirements in place to successfully implement and work with the MCP server:
By the end of this guide, you'll have:
Step-By-Step Implementation Walk Through:
(1) Create a new directory named "mcp-perplexityHealthcareSearch" in your C:\ drive by running the command: mkdir mcp-perplexityHealthcareSearch
(2) Open Visual Studio Code, click File, and select Open Folder.

(3) Select the folder “mcp-perplexityHealthcareSearch”

(4) Select “New Terminal” from the Menu.

(5) Type the following commands in your terminal:
PS C:\mcp-perplexityHealthcareSearch> python -m venv .venv and press Enter
PS C:\mcp-perplexityHealthcareSearch> .venv\Scripts\activate (For Windows) or source .venv\bin\activate (For Mac) and press Enter(.venv)
PS C:\mcp-perplexityHealthcareSearch> pip install python-dotenv perplexityai mcp and press Enter

(6) Create a new file called “server_pplx_mcp.py” and paste the following Python code into Visual Studio Code.

(7) Get your Perplexity API key from https://www.perplexity.ai/account/api/keys

(8) Create a new file called “.env” in Visual Studio Code and replace the placeholder PERPLEXITY_API_KEY = "YOUR_API_KEY" with your actual API key.

(9) Execute the MCP server by running the following command in your terminal:
(.venv) PS C:\mcp-perplexityHealthcareSearch> python server_pplx_mcp.py
If successful, you'll see this message: Starting MCP server 'perplexity_search' on http://127.0.0.1:8000/mcp

(10) The next step is to install the ngrok Agent CLI.
Your MCP server runs on your computer as localhost, which means only your computer can access it. People and services on the internet—including OpenAI Agent Builder—cannot reach localhost on your machine.
ngrok fixes this by giving your local server a public web address (an HTTPS URL). When someone (or an agent) calls that URL, ngrok securely forwards the request to your MCP server on your computer. This lets your agent access your MCP tools over the internet without you needing to deploy the server to a cloud server.
For MacOS:
https://ngrok.com/docs/getting-started#mac-os
For Windows:
https://ngrok.com/docs/getting-started#windows
For Linux:
https://ngrok.com/docsetting-started#debian-linux

(11) Once you have signed up or logged into ngrok, navigate to the ngrok dashboard, copy your authtoken, and execute the following command in PowerShell:ngrok config add-authtoken <YOUR_TOKEN>
For example:ngrok config add-authtoken 60rpoiVgRV5IfLBcbfnoGMbJmTP_SIAoCLrZ3aWZkSBvrjn9W
(12) For our setup, the MCP server operates on port 8000; execute the following command:ngrok http 8000
If you have a reserved domain/URL in ngrok, you can run the following command:ngrok http http://localhost:8000 --domain=example.ngrok.app
ngrok will print a public HTTPS URL or your reserved domain/URL that forwards traffic to your local server. Use that public URL as the endpoint your OpenAI Agent Builder tool calls.

(13) Create your OpenAI account at https://auth.openai.com/create-account and log in.
Select the Dashboard menu, then choose Agent Builder and click the "+Create" button.

(14) Click "My Agent" in the workflow. Copy the prompt and paste it into Instructions. Select your preferred model and set the reasoning effect to medium.

(15) Click "+" to add Tools as an MCP Server.

(16) Click “+ Server” to connect to your MCP server

(17) Complete the Connect to MCP Server form as follows:
URL
-Enter your MCP server endpoint: https://example.ngrok.app/mcp
Label
-Enter a connection name: perplexity_search
Description (optional)
-Add a brief description: My MCP Server
Authentication
-Select None for authentication type
Click Connect when done.

(18) If connected successfully, the tool will display as Perplexity_search.
For our setup, select Never require approval for any tool call under approval settings.
Click Add when done.


(19) Click Publish and name the workflow "Global Healthcare Advisory Tracker."
Click Publish when done.

20) Click the "Run" button at the top to test your OpenAI Agent. Enter the following prompt and click submit.Search for recent outbreak alerts published in Q4 2025 (1 Oct–31 Dec 2025) in Southeast Asia, organized by country

(21) When finished, you will see the analytics report as a result.

(22) Select the Dashboard menu, choose Logs, and click Responses to view input and output data. You can check token usage for each transaction.


Key Takeaways
OpenAI Agent Builder is the orchestration layer: it lets you define an agent’s instructions, connect external tools, and run repeatable workflows that convert raw signals into decision-ready outputs.
MCP standardizes tool integration for the agent: instead of building a custom connector per capability, you expose tools once via MCP and let Agent Builder invoke them consistently across use cases.
ngrok bridges development to production-like access: it maps your local MCP server to a public HTTPS URL so the OpenAI agent (running in the cloud) can reach your tools over the internet.
The result is a practical operating model: a business-friendly agent that can monitor, summarize, and structure updates (e.g., outbreaks/alerts) while engineers maintain the underlying MCP tools independently.
Technically, the architecture stays modular and scalable: MCP server (Python) hosts tool logic, ngrok provides secure routing, and Agent Builder handles tool calling, outputs, and iteration—enabling faster enhancements without rewiring the whole system.