Serverless MCP Server for AI Agent Data Lake Access on ECS Fargate

· Engineer's Notes · Cem Koyluoglu

A serverless MCP server on ECS Fargate centralizes AI agent access to enterprise data lakes, using metadata‑driven integration and centralized permission enforcement.

What happened

A centralized Model Context Protocol (MCP) server was deployed on Amazon Elastic Container Service (Amazon ECS) with AWS Fargate to provide AI agents with conversational access to a large enterprise data lake. The server acts as an agent‑agnostic gateway, eliminating the need for each agent to implement its own database or API integration. Adding a new dataset requires only a JSON metadata file that the server automatically discovers during the next pipeline sync. The architecture separates concerns into four layers: client, MCP server, tools, and knowledge‑base refresh. Each layer is independently scalable and deployable. The client layer authenticates users via Amazon Cognito, stores session state in Amazon DynamoDB, and forwards requests to the MCP server layer through an internal Application Load Balancer. The MCP server orchestrates query analysis, tool selection, execution, and response generation. Tools include Amazon Athena and Amazon Redshift for SQL execution, and Amazon Bedrock Knowledge Bases for semantic search. Responsible AI controls are enforced at the MCP server layer using Amazon Bedrock Guardrails, which filter harmful content and block prompt injection attempts. The knowledge‑base refresh layer ingests new dataset metadata, generates vector embeddings with Amazon Titan Text Embeddings, and indexes them into Bedrock Knowledge Bases, making the dataset discoverable without server restarts.

Why it matters in production

The serverless MCP design addresses key production concerns. First, reliability is improved because the MCP server is stateless; conversation state is persisted in DynamoDB, allowing tasks to be replaced or scaled without data loss. Second, cost efficiency is achieved by running the server on Fargate, which scales automatically with bursty AI workloads and eliminates the need for dedicated EC2 instances. Third, latency is bounded; context mapping configurations keep end‑to‑end interaction latency in the 15–20 second range by narrowing the metadata catalog search to relevant tables. Fourth, security and compliance are strengthened through centralized permission enforcement: the MCP server applies a SELECT‑only policy to Athena queries and enforces Bedrock Guardrails across all connected agents, providing a single audit point for data access decisions. Finally, operational overhead is reduced because adding a new dataset or business domain requires only a JSON file, eliminating multi‑day engineering efforts for custom integration code.

Engineering takeaways

  • Metadata‑driven integration: Store dataset schema, business context, and column semantics in a single JSON file; the MCP server uses this catalog at query time, eliminating hardcoded table structures.
  • Stateless server architecture: Deploy the MCP server on Fargate with DynamoDB‑backed session state; this allows seamless scaling and zero‑downtime updates.
  • Centralized permission enforcement: Implement SELECT‑only policies and Bedrock Guardrails at the MCP layer to provide a unified security posture across all agents.
  • Context mapping for latency: Use a context mapping configuration to restrict the metadata catalog search to relevant tables, reducing noise and improving SQL generation accuracy.
  • Automated knowledge‑base refresh: Ingest metadata files, generate embeddings, and index into Bedrock Knowledge Bases automatically; this keeps the catalog current without manual restarts.

Related work on this site

  • Agentic & LLM Automation — Multi-step LLM pipelines that run unattended: model cascades with fallbacks, validation gates, scheduled automation and alerting when something breaks.
  • RAG & Grounded LLM Systems — LLM features that answer from the right source instead of from memory: document-grounded assistants, transcript-grounded chat and quality gates around generated output.
  • YouTube AI Summarizer — Open-source Chrome extension on the Chrome Web Store: AI summaries, key points, deep analysis, a two-host AI podcast (Gemini TTS) and transcript-grounded chat for any YouTube video, using Groq or Ollama Cloud with the user’s own key.
  • Automated AI News Pipeline (this site) — The pipeline behind this site’s Tech News: scheduled GitHub Actions scrape sources, an LLM cascade on Groq rewrites and enhances articles, and layered quality gates (date integrity, language checks, instruction-leak detection, duplicate detection) decide what gets published, with Telegram alerts.

This note was drafted with AI assistance from the primary source credited on this page, and automatically checked against that source before publishing.

Source: https://aws.amazon.com/blogs/machine-learning/serverless-mcp-server-for-ai-agent-data-lake-access-on-amazon-ecs-fargate/

← All tech news