Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Docker 8 min read How-to easyNovice

MCP Security: A Developer’s Guide

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. One cited analysis found command injection flaws in 43% of MCP servers examined. Static AppSec tools miss these risks because agent behavior is non-deterministic and models can treat tool descriptions as instructions. The recommended guardrails are to containerize each server with resource and egress limits, route calls through a policy gateway that verifies signatures, enforces allowlists, redacts secrets, runs pre- and post-call interceptors and logs every call, and pin vetted servers by digest. Docker positions its MCP Gateway and MCP Catalog & Toolkit as the implementation.

Assumes: Model Context Protocol basicsDocker containers

Related posts

  • MCP Horror Stories: The Security Issues Threatening AI Infrastructure

    Docker mediumAdept

    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. Each class comes with checks to apply before installing a server, such as avoiding servers that build shell commands from input or take credentials as environment variables. Docker's MCP Gateway is presented as the mitigation, running each server in a container with no-new-privileges, CPU and memory limits, signature verification, L7 network allowlisting via --block-network, secret scanning via --block-secrets and call logging.

  • Securing Model Context Protocol: Safer Agentic AI with Containers

    Docker easyNovice

    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.

  • Docker MCP Gateway: Open Source, Secure Infrastructure for Agentic AI

    Docker mediumAdept

    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. The `docker mcp` CLI covers browsing the catalog, storing secrets such as API keys, writing per-server host config, and running gateways that expose chosen servers and a restricted set of tools over transports like SSE. Security interceptors can be switched on at startup to verify container image signatures, block secret-like content in payloads, and log tool calls. It ships in Docker Desktop and works with any community edition of Docker.

  • 5 Best Practices for Building, Testing, and Packaging MCP Servers

    Docker mediumAdept

    MCP servers work best when designed around the agent as the real caller: keep a small "tool budget" by grouping endpoints into use-case tools and prompts instead of one tool per API endpoint, and return error messages that tell the agent what to fix (e.g., an invalid API_TOKEN configuration) rather than human-facing denials. Tool names and descriptions double as documentation for agents, while user docs explain the value. Test the connect, list-tools and tool-call lifecycle with the MCP Inspector or `docker mcp` commands, and open connections per tool call rather than at startup so tools can be listed even when the server is misconfigured. Package servers as Docker images using stdio transport for submission to the Docker MCP Catalog.

  • Dynamic MCPs with Docker: Stop Hardcoding Your Agents’ World

    Docker mediumAdept

    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. The gateway can also hide added servers' tool definitions from tools/list so they stay discoverable without bloating the context window. A code-mode tool lets agents write JavaScript that composes tools from several MCP servers inside a Docker sandbox, keeping intermediate results out of the model and cutting per-turn token usage. The features ship in Docker Desktop 4.50 and are on by default, and cagent can expose such agents to ACP-enabled editors like Zed and Neovim.

The quest for software engineering knowledge.

Look:
Layout: