---
title: "Securing Model Context Protocol: Safer Agentic AI with Containers"
description: "Running MCP servers via npx on the host with plaintext environment-variable secrets leaves agentic tooling exposed to supply-chain tampering, credential leakage, and attacks such as rug pulls, tool shadowing, and tool poisoning."
url: "https://swe.quest/articles/securing-model-context-protocol-safer-agentic-ai-with-containers-f3a8a077a2aa77b5"
canonical: "https://www.docker.com/blog/whats-next-for-mcp-security/"
source: "Docker"
published: "2025-05-06"
difficulty: "easy"
kind: "Opinion"
reading_minutes: 9
tags: ["ai-agents","sandboxing","supply-chain-security","containers"]
---

# Securing Model Context Protocol: Safer Agentic AI with Containers

A post on [Docker](https://swe.quest/sources/docker.md), published 2025-05-06, 9 min read, Opinion. Original: [https://www.docker.com/blog/whats-next-for-mcp-security/](https://www.docker.com/blog/whats-next-for-mcp-security/)

## Summary

Running MCP servers via npx on the host with plaintext environment-variable secrets leaves agentic tooling exposed to supply-chain tampering, credential leakage, and attacks such as rug pulls, tool shadowing, and tool poisoning. Containers address part of this through isolation, reproducibility, and verifiable provenance. They should be paired with scoped secret injection, a single MCP Gateway that screens all server-to-client traffic, and separate policies for which servers are trusted versus which a given agent needs. Tool annotations like readOnlyHint and destructiveHint can be enforced at container runtime, and Docker's MCP Catalog and Toolkit package these ideas behind one socat-over-STDIO connection.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Supply chain security](https://swe.quest/tags/supply-chain-security.md) (Security)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)

## Prerequisites

- Model Context Protocol basics
- Docker containers ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))

## Keywords

Model Context Protocol, Docker MCP Toolkit, Docker MCP Catalog, MCP Gateway, Tool Poisoning, Docker Hub

## Related posts

- [Highlights from AWS re:Invent: Supercharging Kiro with Docker Sandboxes and MCP Catalog](https://swe.quest/articles/highlights-from-aws-re-invent-supercharging-kiro-with-docker-sandboxes-and-mcp-a18d4753910b06e8.md): Docker · 2025-12-12 · Medium · 7 min read · AI agents, Sandboxing & isolation, Containers, AI for coding
  Docker Sandboxes run coding agents like AWS's Kiro inside isolated containers that see only the project directory and none of the host's credentials, while the Docker MCP Toolkit supplies tools through a gateway that injects secrets only into the specific MCP server that needs them.
- [MCP Horror Stories: The Security Issues Threatening AI Infrastructure](https://swe.quest/articles/mcp-horror-stories-the-security-issues-threatening-ai-infrastructure-11571cbab816ae96.md): Docker · 2025-07-31 · Medium · 10 min read · AI agents, Security, Supply chain security, Containers, Sandboxing & isolation
  MCP servers expose AI agents to six recurring vulnerability classes: OAuth discovery flaws (e.g. CVE-2025-6514 in mcp-remote), command injection (reported in 43% of analyzed servers), unrestricted network fetches (33%), file path leakage (22%), tool poisoning (5.5%) and plaintext secret exposure.
- [MCP Security: A Developer’s Guide](https://swe.quest/articles/mcp-security-a-developer-s-guide-ee8f7d25fd64b2f2.md): Docker · 2025-09-16 · Easy · 8 min read · AI agents, Security, Supply chain security, Containers
  MCP servers expand what AI agents can do but introduce risks across four categories: misconfigurations and weak defaults, malicious or compromised servers, secret leakage, and prompt injection or tool poisoning.
- [Docker MCP Gateway: Open Source, Secure Infrastructure for Agentic AI](https://swe.quest/articles/docker-mcp-gateway-open-source-secure-infrastructure-for-agentic-ai-8fe8cf36e09a039e.md): Docker · 2025-07-09 · Medium · 3 min read · AI agents, Containers, Security, Open source
  Docker's MCP Gateway, now open source, is a single enforcement point between AI agents and the MCP servers they call, aggregating multiple containerized servers behind one interface and integrating with Docker Compose.
- [Dynamic MCPs with Docker: Stop Hardcoding Your Agents’ World](https://swe.quest/articles/dynamic-mcps-with-docker-stop-hardcoding-your-agents-world-a530a7120388ea63.md): Docker · 2025-11-06 · Medium · 11 min read · AI agents, LLMs, Sandboxing & isolation, Containers, Developer tools
  Docker MCP Gateway now exposes primordial tools (mcp-find, mcp-add) that let agents search a curated catalog of 270+ MCP servers, add them to the live session, and trigger OAuth or elicitation flows, instead of hand-editing JSON config and restarting.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
