Building a robust, compliant, and scalable platform for sensitive data analysis requires research and innovation. Our MCP and Kafka based agentic RAG framework is engineered to handle real-time processing while keeping sensitive data inside a secure execution perimeter. This article explains how the architecture works and why it matters for developers and data engineers.
The Architecture
The following diagram provides a high-level view of the framework. It illustrates how components interact and how data flows from client requests to secure processing and response generation. Each part plays a specific role in ensuring security, scalability, and compliance.

Core Components and Their Roles
1. MCP Server (Green)
The MCP server, implemented in Python, forms the backbone of the system. It integrates with data collections such as SQL databases, S3 objects, key-value stores, MongoDB, or existing client systems. Its modular design enables smooth integration across diverse environments. The server acts as the controlled interface for all incoming requests.
2. Internal Processing Layer (Blue)
This processing layer manages intermediate results using structured prompts and controlled execution flows. Sensitive data is processed within strict boundaries, forming a secure execution perimeter. This layer ensures that raw data never leaves its origin and that all transformations occur locally.
3. RAG Tool
Behind the MCP server runs a Retrieval-Augmented Generation module. It filters, tracks, and validates outputs according to client-defined rules. Outputs pass through the governance controls defined by the Agent Context Protocol (ACP), ensuring compliance and preventing sensitive data from leaving the secure perimeter.
4. Kafka Integration
Kafka enables high-throughput and fault-tolerant communication for intermediate results. Its durability and delivery guarantees provide reliable real-time message flow between components. This ensures the system can scale under heavy workloads without compromising performance.
5. Wayang Plan Execution
Execution plans based on Apache Wayang operate entirely inside the secure perimeter. Because the Scalytics team originally created the technology that evolved into Apache Wayang, this execution model forms the analytical foundation for running sensitive workloads. Wayang plans handle computation while ensuring data locality, passing intermediate results through Kafka for downstream processing or client responses.
How It Works
The architecture is designed so that sensitive data stays where it is created. Instead of moving data between environments, the system uses local Large Language Models or Specialized Language Models that run inside the secure execution perimeter with locked-away data. Models do not expose the underlying data. Guardrails defined through ACP monitor and restrict agent behavior, ensuring no unauthorized information leaves the controlled environment.

Client Requests
A client sends a query or task to the MCP server. The server orchestrates access to data sources or intermediate results while remaining inside the secure perimeter.
Secure Data Processing
The MCP server retrieves required inputs or invokes the RAG tool. All data handling follows ACP governance rules. Processing occurs locally and adheres to compliance requirements.
Real-Time and Ad-Hoc Processing
The system supports real-time and ad-hoc requests. Wayang plans execute analytical tasks at the edge. Results flow through Kafka for downstream consumption.
Filtered Outputs
Outputs undergo strict filtering to ensure only approved information is returned to the client. ACP governance ensures the output matches allowed usage contexts.
Why It Matters
Compliance at Scale
The architecture aligns with regulations like GDPR and HIPAA. Sensitive data remains inside a controlled execution boundary, reducing the risk of exposure.
Developer-First Flexibility
With wide compatibility and modular components, the framework integrates into existing infrastructures without unnecessary overhead.
End-to-End Security
ACP and the secure execution perimeter ensure that data never leaves its origin environment. All interactions are monitored, filtered, and traceable.
High Scalability
Kafka and modular processing components allow the system to support heavy data flows and complex analytical workloads.
Real-World Applications
This architecture is suited for environments where security, compliance, and real-time performance intersect, such as:
- Sensitive financial data analysis under strict regulatory requirements
- Industrial monitoring and analytics for operational efficiency
- HIPAA-compliant medical data processing
Key Technical Highlights for Developers
- Optimized Message Flow: Kafka provides fault-tolerant, real-time communication with low latency.
- Dynamic Query Handling: Ad-hoc and real-time requests are processed securely without exposing underlying data.
- Wayang Plans: Execution plans optimize workloads while maintaining data locality and security.
- Integration-Ready: The MCP server supports plug-and-play integration with client environments.
Summary
Our MCP and Kafka based agentic RAG framework demonstrates how secure, scalable, and compliant data processing can be achieved without centralizing or moving sensitive data. By combining Python-based MCP servers, Kafka, ACP governance, and Wayang execution plans, Scalytics Federated delivers a modern architecture for organizations handling sensitive or regulated workloads. Whether operating on financial transactions, healthcare records, or real-time industrial data, this framework ensures performance, compliance, and security.
For more information or to explore how this architecture can support your workflows, get in touch.
About Scalytics
Scalytics Federated provides federated data processing across Spark, Flink, PostgreSQL, and cloud-native engines through a single abstraction layer. Our cost-based optimizer selects the right engine for each operation, reducing processing time while eliminating vendor lock-in.
Scalytics Copilot extends this foundation with private AI deployment: running LLMs, RAG pipelines, and ML workloads entirely within your security perimeter. Data stays where it lives. Models train where data resides. No extraction, no exposure, no third-party API dependencies.
For organizations in healthcare, finance, and government, this architecture isn't optional, it's how you deploy AI while remaining compliant with HIPAA, GDPR, and DORA.Explore our open-source foundation: Scalytics Community Edition
Questions? Reach us on Slack or schedule a conversation.
