Protecting MCP Servers with dmint-mcp

The Model Context Protocol (MCP) allows AI agents to discover and invoke tools. However, native MCP servers execute any tool call an agent makes without pre-execution authorization. dmint-mcp operates as a transparent security gateway and proxy between the AI agent and your downstream MCP servers:

Supported Transports

  1. stdio: Local commands executed as subprocesses (e.g. npx @modelcontextprotocol/server-postgres, uvx mcp-server-git).
  2. streamable-http: Remote MCP endpoints with automatic SSRF filtering, loopback protection, and Bearer authentication.

Step 1: Discover Tools & Generate Config

Instead of writing protection configs by hand, use dmint-cli to inspect your downstream server and generate both policy.json and mcp_protection.json:
This generates mcp_protection.json:
mcp_protection.json

Step 2: Run the dmint-mcp Gateway

Launch the proxy pointing to your Core-owned SQLite database and protection configuration:
The gateway exposes a clean MCP interface over stdio or HTTP that your AI editor can connect to directly.

Multi-Server Gateway Aggregation

You can protect multiple MCP servers behind a single dmint-mcp gateway:
Multi-Server mcp_protection.json
When an agent requests tools/list, dmint-mcp:
  1. Queries each downstream server.
  2. Namespaces tool names deterministically (e.g. db_prod_query, fs_read_file).
  3. Strips sensitive internal backend URLs or credentials from error messages.

Built-in Security Defenses

  • SSRF Protection: Remote streamable HTTP endpoints validate IPs using ipaddress parsing. Requests to loopback (127.0.0.1, ::1), private subnets, or cloud metadata endpoints (169.254.169.254, metadata.google.internal) are blocked fail-closed.
  • Error Sanitization: Downstream database stack traces or raw connection strings are intercepted and replaced with safe, sanitized error envelopes.
  • Deterministic Timeout Controls: Downstream MCP calls that hang or freeze are safely terminated after a strict timeout.

Next Steps

Cursor Integration

Configure Cursor to use dmint-mcp via .cursor/mcp.json.

Claude Code Integration

Configure Claude Code to route tools through dmint-mcp.