Blog Post

Azure AI Foundry Blog
8 MIN READ

Connecting the Dots: How MCP Enables Context-Aware Agents Across Diverse Data Sources

julietrajan's avatar
julietrajan
Icon for Microsoft rankMicrosoft
Oct 29, 2025

Unlock the power of MCP—connect data dots, break silos, and let your agents deliver smarter, real-time answers

Introduction

As a passionate innovator in AI systems, I’m on a mission to redefine how intelligent agents interact with the world—moving beyond isolated prompts to create context-aware, dynamic solutions. With Model Context Protocol (MCP), I aim to empower agents to seamlessly connect, interpret, and unify fragmented data sources, enabling them to think, plan, and collaborate intelligently across domains.

Intelligent agents are transforming industries by automating tasks, enhancing decision-making, and delivering personalized experiences. However, their effectiveness is often limited by their ability to access and interpret data from multiple, fragmented sources. This is especially true in many enterprise organizations, where data is distributed across various systems and formats. Enter Model Context Protocol (MCP) — a breakthrough that enables agents to interact with diverse data sources in a unified, context-aware manner. 

In this article, you will see how healthcare industry leverages MCP to interact with distributed data.

 

Why Agents Struggle to Connect to Diverse Data Sources 

Agents typically rely on structured inputs to generate meaningful responses. But in real-world scenarios, data is: 

  • Scattered across systems: EHRs, lab systems, imaging platforms, insurance databases. 
  • Stored in different formats: HL7, FHIR, JSON, XML, CSV. 
  • Accessed via varied protocols: REST APIs, GraphQL, SOAP, file-based systems. 

Key Challenges: 

  1. Context Loss – Agents often lack the ability to maintain context across multiple data sources. 
  2. Semantic Misalignment – Different systems may use different terminologies for the same concept. 
  3. Latency & Real-Time Needs – Some data must be accessed instantly (e.g., patient vitals). 
  4. Security & Access Control – Varying authentication mechanisms and data governance policies. 
  5. Scalability – Custom integrations are hard to maintain and scale across organizations. 

 

How MCP Helps Agents Overcome Data Source Challenges – Simply Explained 

Imagine an agent as a smart assistant trying to answer questions or perform tasks. To do this well, it needs to understand where the data is, what it means, and how it connects to the user’s query. That’s where Model Context Protocol (MCP) steps in. 

 

MCP is like a smart translator and coordinator between the agent and multiple data sources. It helps the agent: 

  • Understand the context of the user’s request 
  • Know which data sources to talk to 
  • Interpret different formats and meanings 
  • Keep everything connected and relevant 

 

How MCP Solves the Challenges 

Let’s revisit the challenges and see how MCP helps:

 

Data Silos 

Problem: Data is scattered across systems that don’t talk to each other. 

MCP’s Help: MCP creates a unified context so the agent can pull data from different places and treat it as one coherent story.

 

Inconsistent Formats 

Problem: One system uses HL7, another uses JSON and another uses FHIR. 

MCP’s Help: MCP normalizes these formats so the agent doesn’t get confused. It translates them into a format, the model understands.

 

Semantic Misalignment 

Problem: “Blood sugar” in one system is “glucose level” in another. 

MCP’s Help: MCP maps different terms to the same meaning, so the agent knows they’re talking about the same thing.

 

Security & Compliance 

Problem: Each system has its own access rules and privacy requirements. 

MCP’s Help: MCP respects access controls and ensures the agent only sees what it’s allowed to, keeping everything secure and compliant.

 

Context Loss 

Problem: When switching between systems, agents lose track of what the user asked. 

MCP’s Help: MCP maintains a continuous context, so the agent remembers the user’s intent and keeps the conversation relevant. 

 

Healthcare Example: Post-Surgery Monitoring Agent 

Let’s say a doctor asks the agent: “Show me post-op patients with abnormal vitals and pending lab results.”

Without MCP: 

  • The agent might pull vitals from one system, lab results from another, and struggle to connect them. 
  • It might not understand that “pending labs” in one system means “awaiting results” in another. 

With MCP: 

  • The agent knows where to look, how to interpret, and how to connect the data. 
  • It gives a clear, accurate answer — saving time and improving patient care. 

 

Here’s a simplified Python example for your healthcare scenario: 


from typing import Dict, Any
import requests

class MCPAgent:
    def __init__(self):
        self.context = {}

    def update_context(self, query: str):
        self.context['query'] = query

    def fetch_ehr_data(self):
        # Simulate EHR API call
        return {"patients": [{"id": 1, "status": "post-op"}]}

    def fetch_vitals(self):
        # Simulate wearable device API call
        return {"patients": [{"id": 1, "vitals": "abnormal"}]}

    def fetch_lab_results(self):
        # Simulate lab system API call
        return {"patients": [{"id": 1, "lab": "pending"}]}

    def process_query(self):
        ehr = self.fetch_ehr_data()
        vitals = self.fetch_vitals()
        labs = self.fetch_lab_results()

        # Merge data based on patient ID
        combined = []
        for patient in ehr['patients']:
            pid = patient['id']
            vitals_info = next((v for v in vitals['patients'] if v['id'] == pid), {})
            lab_info = next((l for l in labs['patients'] if l['id'] == pid), {})
            combined.append({**patient, **vitals_info, **lab_info})

        return combined

# Usage
agent = MCPAgent()
agent.update_context("Show me post-op patients with abnormal vitals and pending lab results")
result = agent.process_query()
print(result)

If you’re not a developer, the main idea is that MCP helps agents connect information from different systems, so you get answers that make sense, no matter where the data comes from.

Core Component in the code

Context Manager 

Purpose: Keeps track of the user’s query and any relevant information across multiple data sources. 

Why: Without context, the agent would treat each data source independently and fail to connect the dots.

def update_context(self, query: str):
    self.context['query'] = query

This stores the user’s intent, so the agent knows what to look for. 

 

Data Source Connectors 

Purpose: Interfaces to fetch data from different systems (EHR, wearable devices, lab systems). 

Why: Each system has its own API or format. Connectors standardize how the agent retrieves data. 

def fetch_ehr_data(self):
    # Simulate EHR API call
    return {"patients": [{"id": 1, "status": "post-op"}]}

def fetch_vitals(self):
    # Simulate wearable device API call
    return {"patients": [{"id": 1, "vitals": "abnormal"}]}

def fetch_lab_results(self):
    # Simulate lab system API call
    return {"patients": [{"id": 1, "lab": "pending"}]}

In real-world use, this would call an API endpoint and return structured data. 

 

Contextual Data Binding & Normalization 

Purpose: Merge and normalize data from multiple sources into a single, meaningful response. 

Why: Different systems use different terms and formats. MCP ensures semantic alignment. 

def process_query(self):
    ehr = self.fetch_ehr_data()
    vitals = self.fetch_vitals()
    labs = self.fetch_lab_results()

    # Merge data based on patient ID
    combined = []
    for patient in ehr['patients']:
        pid = patient['id']
        vitals_info = next((v for v in vitals['patients'] if v['id'] == pid), {})
        lab_info = next((l for l in labs['patients'] if l['id'] == pid), {})
        combined.append({**patient, **vitals_info, **lab_info})

    return combined

This merges patient data from all sources into one unified view. 

 

LLM Integration with MCP Host

# mcp_host.py
import openai
from mcp_client import MCPClient
import os

openai.api_type = "azure"
openai.api_base = os.getenv("AZURE_OPENAI_ENDPOINT")
openai.api_key = os.getenv("AZURE_OPENAI_KEY")
openai.api_version = "2023-05-15"

class MCPHost:
    def __init__(self, client):
        self.client = client
        self.context = {}

    def interpret_query(self, query):
        response = openai.ChatCompletion.create(
            engine=os.getenv("AZURE_OPENAI_DEPLOYMENT"),
            messages=[
                {"role": "system", "content": "You are an MCP orchestrator. Map user queries to EHR, vitals, and lab tools."},
                {"role": "user", "content": query}
            ]
        )
        return response['choices'][0]['message']['content']

    def process_query(self, query):
        self.context['query'] = query
        interpretation = self.interpret_query(query)
        print(f"LLM Interpretation: {interpretation}")

        # Call MCP tools
        ehr = self.client.fetch_ehr()
        vitals = self.client.fetch_vitals()
        labs = self.client.fetch_labs()

        combined = []
        for patient in ehr['patients']:
            pid = patient['id']
            vitals_info = next((v for v in vitals['patients'] if v['id'] == pid), {})
            lab_info = next((l for l in labs['patients'] if l['id'] == pid), {})
            combined.append({**patient, **vitals_info, **lab_info})

        return combined

# Usage
client = MCPClient("http://127.0.0.1:8000")
host = MCPHost(client)
result = host.process_query("Show me post-op patients with abnormal vitals and pending lab results")
print(result)

If you’re not a developer, the main idea is that MCP helps agents connect information from different systems, so you get answers that make sense, no matter where the data comes from

 

User Query → Azure OpenAI

 
  • The LLM interprets the query and decides which MCP tools to call.
  • Example interpretation: “Fetch EHR, vitals, and lab data for post-op patients.”
 

Host → Client → Server

 
  • Host uses MCP Client to fetch data from MCP Server.
 

Host Combines Data

  • Merges EHR, vitals, and lab results into a unified response.
 

Beyond Healthcare: MCP in Action Across Industries

MCP’s versatility extends far beyond healthcare. For example:

Finance: MCP enables agents to unify customer data across multiple banking systems, providing a 360-degree view for personalized financial advice and streamlined compliance checks.

Manufacturing: MCP connects data from supply chain, inventory, and production systems, allowing agents to detect bottlenecks and optimize resource allocation in real time.

Retail: MCP brings together sales, inventory, and customer feedback data, empowering agents to deliver tailored promotions and improve demand forecasting.

Telecommunications: MCP integrates customer service, billing, and network performance data, enabling agents to proactively resolve issues and enhance customer satisfaction.

Energy: MCP unifies sensor, maintenance, and usage data, helping agents predict equipment failures and optimize energy distribution.

 

Conclusion

The Model Context Protocol (MCP) represents a pivotal step forward in enabling intelligent agents to operate seamlessly across fragmented data landscapes. By unifying access, normalizing formats, and maintaining context, MCP empowers agents to deliver accurate, timely, and context-aware insights—especially in complex domains like healthcare. As organizations continue to adopt AI-driven solutions, embracing protocols like MCP will be essential for unlocking the full potential of autonomous agents.

 

Citations:

What is the Model Context Protocol (MCP)? - Model Context Protocol

Architecture overview - Model Context Protocol

Azure MCP Server documentation - Azure MCP Server | Microsoft Learn

Next Steps:

  • Explore MCP’s open-source documentation and sample implementations to get started.
  • Experiment with integrating MCP into your own agent workflows—begin with simple connectors and expand as your needs grow.
  • Stay updated on the latest advancements in agent orchestration and context management by following leading AI research forums and communities.

Further Learning:

By taking these steps, you’ll be well-positioned to build the next generation of context-aware, intelligent agents that truly connect the dots across your organization’s data.

About the author: 

I'm Juliet Rajan, a Lead Technical Trainer and passionate innovator in AI education. I specialize in crafting gamified, visionary learning experiences and building intelligent agents that go beyond traditional prompt-based systems. My recent work explores agentic AI, autonomous agents, and dynamic human-AI collaboration using platforms like Azure AI Foundry, MCP and Agents orchestration

 

#MSLearn #SkilledByMTT #MTTBloggingGroup



Updated Oct 29, 2025
Version 1.0
No CommentsBe the first to comment